aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/InitPreprocessor.cpp
AgeCommit message (Collapse)Author
2011-07-05Don't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.Fariborz Jahanian
Patch by Jean-Daniel Dupas. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis
'ownership', not 'lifetime'. rdar://9477613. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-20Define __cplusplus to 201103L when in (non-GNU) C++0x mode.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133437 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16Unconditionally #define the ARC ownership qualifiers, instead of #definingJohn McCall
them only on Darwin tool chains. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133112 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15Automatic Reference Counting.John McCall
Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10__OBJC__ is also a standard predefined macro.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132855 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-07The macros defined by the language standard are still available even when theNick Lewycky
-undef flag is passed in. Also __ASSEMBLER__ with -x assembler-with-cpp. (Don't ask.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132708 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09Add a FIXME.Francois Pichet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-07Temporary preprocessor hack to get around the Microsoft __identifier(x) ↵Francois Pichet
extension. http://msdn.microsoft.com/en-us/library/hzc8ytsz(v=VS.100).aspx Microsoft doc claims this is a C++/CLI feature but it is really always enabled. This removes 2 error when parsing MFC code with clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131051 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin ↵Francois Pichet
defines to real types. Otherwise statements like: __int64 var = __int64(0); would be expanded to: long long var = long long(0); and fail to compile. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-23Move all of the logic for __DEPRECATED to the driver based on commentsChandler Carruth
from dgregor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130066 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-23Fix Clang's __DEPRECATED define to be controled by -Wdeprecated. ThisChandler Carruth
matches GCC behavior which libstdc++ uses to limit #warning-based messages about deprecation. The machinery involves threading this through a new '-fdeprecated-macro' flag for CC1. The flag defaults to "on", similarly to -Wdeprecated. We turn the flag off in the driver when the warning is turned off (modulo matching some GCC bugs). We record this as a language option, and key the preprocessor on the option when introducing the define. A separate flag rather than a '-D' flag allows us to properly represent the difference between C and C++ builds (only C++ receives the define), and it allows the specific behavior of following -Wdeprecated without potentially impacting the set of user-provided macro flags. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130055 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21PR9772: Fix the definition of WINT_MIN and WINT_MAX on Linux -ffreestanding.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31Change Clang's __VERSION__ to include the same basic info as in clang -v.Daniel Dunbar
- Please never ever ever ever write a tool that sniffs this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19Preprocessor: Don't define __STDC__ in -traditional-cpp mode.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true ↵Argyrios Kyrtzidis
the SourceManager should report the original file name for contents of files that were overriden by other files, otherwise it should report the name of the new file. Default is true. Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Reimplement DefineTypeSize in terms of APInt. This eliminates someChris Lattner
magic integer arithmetic and allows it to work with types larger than 64 bits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126365 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23Preserve what the user passed to -include when emitting .d files. Fixes PR8974!Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126334 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.Michael J. Spencer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122340 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04Implement -cl-fast-relaxed-mathPeter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29Merge System into Support.Michael J. Spencer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner
FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03Implement -working-directory.Argyrios Kyrtzidis
When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05Tell the VS headers that char16_t and char32_t are keywords, so yvals.h ↵Steven Watanabe
doesn't try to define them as typedefs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03First test commit by Francois Pichet. _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES ↵Francois Pichet
is not a predefined macro, remove it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30Predeclare class type_info in Microsoft mode, from Francois Pichet!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Fix typo in comment.Michael J. Spencer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03PR7795: Fix the definition of __WCHAR_MAX__ with -fshort-wchar.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03fix some undefined behavior, PR7779.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26Introduce basic support for loading a precompiled preamble whileDouglas Gregor
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
2010-07-23Basic plumbing for generating a precompiled preamble for anDouglas Gregor
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
2010-06-30Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't alwaysDaniel Dunbar
'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
2010-06-28Remove state assertion.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28Don't crash in InitializePreprocessor() when there is no valid PTHManager. ↵Ted Kremenek
Fixes <rdar://problem/8098441>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24Remove HAS_TLS define.Eric Christopher
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24More clang support for darwin tls. Add a __has_feature macro andEric Christopher
target specific preprocessor define as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106715 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28Add several more predefines from modern versions of GCC.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26Predefine the '__clang_analyzer__' macro when using '-analyze'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30Add Clang version inspection macros. Fixes PR6681.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26fix PR6936: don't generate line marker directives when preprocessingChris Lattner
.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
2010-04-21Sink the _GNU_SOURCE definition down into the target configuration,Douglas Gregor
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
2010-04-16Only predefine the macro _GNU_SOURCE in C++ mode when we're on aDouglas Gregor
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
2010-02-27When given unsaved files in clang_createTranslationUnitFromSourceFile,Douglas Gregor
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
2010-02-10Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixesDaniel Dunbar
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
2010-01-23Extend clang_createTranslationUnitFromSourceFile() to support creatingDouglas Gregor
translation units that include unsaved files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20Move the MacroBuilder utilitiy to its own header. Update references.Chandler Carruth
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
2010-01-20Fix an invalid Twine use spotty by abbeyj, it isn't safe to use TwineDaniel Dunbar
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
2010-01-13Predefine __weak attribute when doing objective-cFariborz Jahanian
rewriting for any target. (refixes radar 7530235). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10Fix PR5982, a refacto in checking for '=' in a -D argument.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09Use MacroBuilder for TargetDefines instead of std::vector.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93058 91177308-0d34-0410-b5e6-96231b3b80d8