summaryrefslogtreecommitdiff
path: root/lib/Frontend/InitPreprocessor.cpp
Commit message (Collapse)AuthorAge
...
* fix some undefined behavior, PR7779.Chris Lattner2010-08-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110116 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce basic support for loading a precompiled preamble whileDouglas Gregor2010-07-26
| | | | | | | | | | | | | | | | | | | | | | | | | reparsing an ASTUnit. When saving a preamble, create a buffer larger than the actual file we're working with but fill everything from the end of the preamble to the end of the file with spaces (so the lexer will quickly skip them). When we load the file, create a buffer of the same size, filling it with the file and then spaces. Then, instruct the lexer to start lexing after the preamble, therefore continuing the parse from the spot where the preamble left off. It's now possible to perform a simple preamble build + parse (+ reparse) with ASTUnit. However, one has to disable a bunch of checking in the PCH reader to do so. That part isn't committed; it will likely be handled with some other kind of flag (e.g., -fno-validate-pch). As part of this, fix some issues with null termination of the memory buffers created for the preamble; we were trying to explicitly NULL-terminate them, even though they were also getting implicitly NULL terminated, leading to excess warnings about NULL characters in source files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109445 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic plumbing for generating a precompiled preamble for anDouglas Gregor2010-07-23
| | | | | | | | ASTUnit/CXTranslationUnit. We can't actually use this preamble yet, however. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109202 91177308-0d34-0410-b5e6-96231b3b80d8
* Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't alwaysDaniel Dunbar2010-06-30
| | | | | | | | 'long'. The practical upshot is so that the uint64_t we define in our stdint.h ends up being compatible with that defined by gcc (at least on Darwin), which otherwise could lead to type incompatibilities with other system headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107255 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove state assertion.Ted Kremenek2010-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107064 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash in InitializePreprocessor() when there is no valid PTHManager. ↵Ted Kremenek2010-06-28
| | | | | | Fixes <rdar://problem/8098441>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107061 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove HAS_TLS define.Eric Christopher2010-06-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106786 91177308-0d34-0410-b5e6-96231b3b80d8
* More clang support for darwin tls. Add a __has_feature macro andEric Christopher2010-06-24
| | | | | | | target specific preprocessor define as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106715 91177308-0d34-0410-b5e6-96231b3b80d8
* Add several more predefines from modern versions of GCC.Dan Gohman2010-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104906 91177308-0d34-0410-b5e6-96231b3b80d8
* Predefine the '__clang_analyzer__' macro when using '-analyze'.Ted Kremenek2010-05-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104742 91177308-0d34-0410-b5e6-96231b3b80d8
* Add Clang version inspection macros. Fixes PR6681.Douglas Gregor2010-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102686 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6936: don't generate line marker directives when preprocessingChris Lattner2010-04-26
| | | | | | | | | .S files. "# 123" is passed through as-is, not treated as a line marker in this mode. No testcase, because it would be nasty and isn't worth it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102391 91177308-0d34-0410-b5e6-96231b3b80d8
* Sink the _GNU_SOURCE definition down into the target configuration,Douglas Gregor2010-04-21
| | | | | | | | and only define it where we know we need it---Linux and Cygwin. Thanks to Chris for the prodding. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101989 91177308-0d34-0410-b5e6-96231b3b80d8
* Only predefine the macro _GNU_SOURCE in C++ mode when we're on aDouglas Gregor2010-04-16
| | | | | | | | platform that typically uses glibc. Fixes a Boost.Thread compilation failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101450 91177308-0d34-0410-b5e6-96231b3b80d8
* When given unsaved files in clang_createTranslationUnitFromSourceFile,Douglas Gregor2010-02-27
| | | | | | | | | | | copy the source buffers provided rather than referencing them directly, so that the caller can free those buffers immediately after calling clang_createTranslationUnitFromSourceFile(). Otherwise, we risk hitting those buffers later (when building source ranges, forming diagnostics, etc.). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97296 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixesDaniel Dunbar2010-02-10
| | | | | | | calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling, for Darwin ARM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95787 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend clang_createTranslationUnitFromSourceFile() to support creatingDouglas Gregor2010-01-23
| | | | | | | translation units that include unsaved files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94258 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the MacroBuilder utilitiy to its own header. Update references.Chandler Carruth2010-01-20
| | | | | | | Comments and/or improvements to the documentation are welcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93982 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an invalid Twine use spotty by abbeyj, it isn't safe to use TwineDaniel Dunbar2010-01-20
| | | | | | | temporaries (this is one reason I'm nervous about propagating their use beyond particularly performance critical places). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93981 91177308-0d34-0410-b5e6-96231b3b80d8
* Predefine __weak attribute when doing objective-cFariborz Jahanian2010-01-13
| | | | | | | | rewriting for any target. (refixes radar 7530235). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93331 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR5982, a refacto in checking for '=' in a -D argument.Daniel Dunbar2010-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93088 91177308-0d34-0410-b5e6-96231b3b80d8
* Use MacroBuilder for TargetDefines instead of std::vector.Benjamin Kramer2010-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93058 91177308-0d34-0410-b5e6-96231b3b80d8
* Move MacroBuilder into Frontend/Utils.h and clean it up a bit.Benjamin Kramer2010-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93057 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework InitPreprocessor to use a MacroBuilder class instead of pushing aroundBenjamin Kramer2010-01-09
| | | | | | | | | | | | | std::vectors. - MacroBuilder wraps a raw_ostream so it can easily write to any buffer supported by raw_ostream. - MacroBuilder's method take Twines for easy string concatenation (this was done with sprintf and temporary buffers before). - Targets still use std::vector as they don't have access to the builder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93051 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch UndefineBuiltinMacro() over to using StringRefKovarththanan Rajaratnam2010-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93049 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch DefineBuiltinMacro() over to using StringRefKovarththanan Rajaratnam2010-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93048 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert from char pointer to char arrayKovarththanan Rajaratnam2010-01-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92923 91177308-0d34-0410-b5e6-96231b3b80d8
* Tigthen scope of local char arrayKovarththanan Rajaratnam2010-01-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92917 91177308-0d34-0410-b5e6-96231b3b80d8
* Integrate the following from the 'objective-rewrite' branch:Steve Naroff2009-12-04
| | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=70926 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90596 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix two more diagnostic-on-stderr instances that thought they could hide ↵Daniel Dunbar2009-12-03
| | | | | | from me -- they thought wrong. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90442 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend -remap-file=from;to to permit mapping from a non-existentDouglas Gregor2009-12-02
| | | | | | | | | | | | | | file. This is accomplished by introducing the notion of a "virtual" file into the file manager, which provides a FileEntry* for a named file whose size and modification time are known but which may not exist on disk. Added a cute little test that remaps both a .c file and a .h file it includes to alternative files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90329 91177308-0d34-0410-b5e6-96231b3b80d8
* Move file-remapping logic into InitPreprocesor. No functionality changeDouglas Gregor2009-12-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90322 91177308-0d34-0410-b5e6-96231b3b80d8
* Exit the command line into <built-in> instead of going directly from the ↵Rafael Espindola2009-12-01
| | | | | | | | | | command line to the input file. We passed <built-in> on the way in, so we should pass it again on the way out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90250 91177308-0d34-0410-b5e6-96231b3b80d8
* Define __SIG_ATOMIC_WIDTH__ for use in stdint.h.Ken Dyck2009-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89597 91177308-0d34-0410-b5e6-96231b3b80d8
* Define __WCHAR_WIDTH__ for use in stdint.h.Ken Dyck2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89353 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __WINT_WIDTH__ to paramaterize the limits of WINT_MIN and WINT_MAX in Ken Dyck2009-11-19
| | | | | | | | stdint.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89348 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __SIZE_WIDTH__ to eventually replace __SIZE_TYPE__ in stdint.h.Ken Dyck2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89346 91177308-0d34-0410-b5e6-96231b3b80d8
* Restore __INTMAX_TYPE__, __UINTMAX_TYPE__, __PTRDIFF_TYPE__, andKen Dyck2009-11-19
| | | | | | | | | __INTPTR_TYPE__ as the last is used in the test/CodeGen/const-init.c and all could potentially be in use in the wild. My apologies. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89345 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove __PTRDIFF_TYPE__ as it is no longer needed by stdint.h. It has been Ken Dyck2009-11-19
| | | | | | | | replaced with __PTRDIFF_WIDTH__. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89344 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __PTRDIFF_WIDTH__ macro to eventually replace __PTRDIFF_TYPE__ in stdint.h.Ken Dyck2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89342 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove __INTPTR_TYPE__ as it is no longer needed by stdint.h, which usesKen Dyck2009-11-19
| | | | | | | | __INTPTR_WIDTH__ instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89340 91177308-0d34-0410-b5e6-96231b3b80d8
* Predefine __INTPTR_WIDTH__ for future use in stdint.h.Ken Dyck2009-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89231 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the __INTMAX_TYPE__ and __UINTMAX_TYPE__ built-in macros as they are noKen Dyck2009-11-18
| | | | | | | | longer used by stdint.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89230 91177308-0d34-0410-b5e6-96231b3b80d8
* Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros inKen Dyck2009-11-18
| | | | | | | stdint.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89203 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify PreprocessorOptions, it doesn't need abstracted field access.Daniel Dunbar2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89047 91177308-0d34-0410-b5e6-96231b3b80d8
* Parameterize the constant-generating macros in stdint.h with new built-inKen Dyck2009-11-16
| | | | | | | | __INTn_C_SUFFIX__ macros that are defined for types with corresponding constant suffixes (i.e. long and long long). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88914 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize stdint.h for non-8-bit-multiple types, patch by Chris Lattner2009-11-12
| | | | | | | | | | | | Ken Dyck! "This adds definitions for types of 8-bit multiples from 8 to 64 to stdint.h and rationalizes the selection of types for the exact-width definitions in InitPreprocessor.cpp." git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86977 91177308-0d34-0410-b5e6-96231b3b80d8
* do not store wchar/char16/char32/intmax width/alignment infoChris Lattner2009-11-12
| | | | | | | | | into TargetInfo, just derive this based on the underlying type. This prevents them from getting out of synch, patch by Ken Dyck! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86976 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak PCH -include handling to make sure it matches the name as would be presentDaniel Dunbar2009-11-11
| | | | | | in the predefines buffer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86903 91177308-0d34-0410-b5e6-96231b3b80d8
* Always initialize the header search object as part of InitializePreprocessor;Daniel Dunbar2009-11-11
| | | | | | not doing this has little to no utility. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86883 91177308-0d34-0410-b5e6-96231b3b80d8