summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for ↵David Majnemer2013-10-181-0/+1
| | | | | | | | | | | | | | 'final' Summary: Some MS headers use these features. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1948 llvm-svn: 192936
* Add has_feature support for reflecting the presence of refined Objective-C ↵Ted Kremenek2013-10-141-0/+1
| | | | | | ABI mangling for qualified id<...>. Fixes <rdar://problem/14799110>. llvm-svn: 192643
* Mark lambda init-captures as complete.Richard Smith2013-09-281-4/+5
| | | | llvm-svn: 191607
* Mark variable template implementation as complete. Nearly all of the creditRichard Smith2013-09-271-1/+2
| | | | | | here goes to Larisse Voufo. llvm-svn: 191549
* Make Preprocessor::Lex non-recursive.Eli Friedman2013-09-191-28/+6
| | | | | | | | | | | | | | | Before this patch, Lex() would recurse whenever the current lexer changed (e.g. upon entry into a macro). This patch turns the recursion into a loop: the various lex routines now don't return a token when the current lexer changes, and at the top level Preprocessor::Lex() now loops until it finds a token. Normally, the recursion wouldn't end up being very deep, but the recursion depth can explode in edge cases like a bunch of consecutive macros which expand to nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this patch). <rdar://problem/14569770> llvm-svn: 190980
* Add a define for the ObjFW runtime ABI version.Benjamin Kramer2013-09-161-1/+0
| | | | | | | | | This removes __has_feature(objc_msg_lookup_stret), as it is not required anymore after this patch. Patch by Jonathan Schleifer! llvm-svn: 190791
* Make __has_extension(c_thread_local) work.Ed Schouten2013-09-141-0/+1
| | | | | | | | | | | Unlike C++11's "thread_local" keyword, C11's "_Thread_local" is in the reserved namespace, meaning we provide it unconditionally; it is marked as KEYALL in TokenKinds.def. This means that like all the other C11 keywords, we can expose its presence through __has_extension(). llvm-svn: 190755
* DataFlowSanitizer; Clang changes.Peter Collingbourne2013-08-071-0/+1
| | | | | | | | | | | | | DataFlowSanitizer is a generalised dynamic data flow analysis. Unlike other Sanitizer tools, this tool is not designed to detect a specific class of bugs on its own. Instead, it provides a generic dynamic data flow analysis framework to be used by clients to help detect application-specific issues within their own code. Differential Revision: http://llvm-reviews.chandlerc.com/D966 llvm-svn: 187925
* Support for Thread Safety Analysis in CDavid Blaikie2013-07-291-0/+1
| | | | | | Patch by Ethan Jackson. llvm-svn: 187365
* Reduce stack frame size by avoiding a large token vector on an error path.Bob Wilson2013-07-271-1/+1
| | | | | | | | | | | | | | | | | Beginning with svn r186971, we noticed an internal test started to fail when using clang built with LTO. After much investigation, it turns out that there are no blatant bugs here, we are just running out of stack space and crashing. Preprocessor::ReadFunctionLikeMacroArgs already has one vector of 64 Tokens, and r186971 added another. When built with LTO, that function is inlined into Preprocessor::HandleMacroExpandedIdentifier, which for our internal test is invoked in a deep recursive cycle. I'm leaving the original 64 Token vector alone on the assumption that it is important for performance, but the new FixedArgTokens vector is only used on an error path, so it should be OK if it requires additional heap storage. It would be even better if we could avoid the deep recursion, but I think this change is a good thing to do regardless. <rdar://problem/14540345> llvm-svn: 187315
* Fix GNU ObjC ABI for a message returning a struct.Eli Friedman2013-07-261-0/+1
| | | | | | | | | This allows the ObjFW runtime to correctly implement message forwarding for messages which return a struct. Patch by Jonathan Schleifer. llvm-svn: 187174
* Rename feature test for lambda init-captures from cxx_generalized_capture toRichard Smith2013-07-241-2/+2
| | | | | | | | cxx_init_capture. "generalized" is neither descriptive nor future-proof. No compatibility problems expected, since we've never advertised having this feature. llvm-svn: 187058
* Update documentation to match current C++1y feature set.Richard Smith2013-07-241-2/+2
| | | | llvm-svn: 187055
* Add new diagnostic messages when too many arguments are presented to aRichard Trieu2013-07-231-16/+191
| | | | | | | | | | | | | function-like macro. Clang will attempt to correct the arguments by detecting braced initializer lists: 1) If possible, suggest parentheses around arguments containing braced lists which will give the proper number of arguments. 2) If a braced list is detected at the start of a macro argument, it cannot be corrected by parentheses. Instead, just point out the location of these braced lists. llvm-svn: 186971
* Generalize hack allowing 'const' in __has_attribute (etc) to allow any tokenRichard Smith2013-07-091-3/+1
| | | | | | | with identifier info. This covers most identifier-like entities (other than the ISO646 keywords). llvm-svn: 185895
* Match MSVC's handling of commas during macro argument expansionReid Kleckner2013-06-261-1/+6
| | | | | | | | | | | | This allows clang to parse the type_traits header in Visual Studio 2012, which is included widely in practice. This is a rework of r163022 by João Matos. The original patch broke preprocessing of gtest headers, which this patch addresses. Patch by Will Wilson! llvm-svn: 184968
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-201-1/+2
| | | | | | | headers may be included from within the module, but not from outside the module. llvm-svn: 184471
* C++1y: provide full 'auto' return type deduction for lambda expressions. ThisRichard Smith2013-05-121-1/+1
| | | | | | completes the implementation of N3638. llvm-svn: 181669
* C++1y: Update __cplusplus to temporary value 201305L to allow detection of ↵Richard Smith2013-05-071-1/+13
| | | | | | | | | provisional C++1y support. Add __has_feature and __has_extension checks for C++1y features (based on the provisional names from the C++ features study group), and update documentation to match. llvm-svn: 181342
* [Preprocessor] For the MacroExpands preprocessor callback, also pass the ↵Argyrios Kyrtzidis2013-05-031-4/+5
| | | | | | | | MacroArgs object that provides information about the argument tokens for a function macro. llvm-svn: 181065
* Only evaluate __has_feature(c_thread_local) and ↵Douglas Gregor2013-05-021-2/+4
| | | | | | __has_feature(cxx_thread_local) true when the target supports thread-local storage. llvm-svn: 180909
* C++11 support is now feature-complete.Richard Smith2013-04-191-1/+3
| | | | llvm-svn: 179861
* [modules] Re-enable the "ambiguous expansion of macro" warning.Argyrios Kyrtzidis2013-03-271-11/+10
| | | | | | | | | | Also update "test/Modules/macros.c" to test modified semantics: -When there is an ambiguous macro, expand using the latest introduced version, not the first one. -#undefs in submodules cause the macro to not be exported by that submodule, it doesn't cause undefining of macros in the translation unit that imported that submodule. This reduces macro namespace interference across modules. llvm-svn: 178105
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-112/+8
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
* [PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.Argyrios Kyrtzidis2013-03-221-6/+14
| | | | | | | | | -Serialize the macro directives history into its own section -Get rid of the macro updates section -When de/serializing an identifier from a module, associate only one macro per submodule that defined+exported it. llvm-svn: 177761
* [preprocessor] Use MacroDirective in the preprocessor callbacks to make ↵Argyrios Kyrtzidis2013-02-241-9/+13
| | | | | | | | available the full information about the macro (e.g if it was imported and where). llvm-svn: 175978
* [libclang] Fix assertion hit when code-completing inside a function macro ↵Argyrios Kyrtzidis2013-02-221-2/+4
| | | | | | | | with more arguments than it should accept. llvm-svn: 175925
* [preprocessor] Split the MacroInfo class into two separate concepts, ↵Argyrios Kyrtzidis2013-02-201-47/+48
| | | | | | | | | | | | | | | | | | | | | | | | | MacroInfo class for the data specific to a macro definition (e.g. what the tokens are), and MacroDirective class which encapsulates the changes to the "macro namespace" (e.g. the location where the macro name became active, the location where it was undefined, etc.) (A MacroDirective always points to a MacroInfo object.) Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but splitting the concepts allows us to better model the effect of modules to the macro namespace (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas). Modules can have their own macro history, separate from the local (current translation unit) macro history; MacroDirectives will be used to model the macro history (changes to macro namespace). For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created to indicate that "FOO" became active at the import location. Module "A" itself will contain another MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives will point to the same MacroInfo object. Introducing the separation of macro concepts is the first part towards better modeling of module macros. llvm-svn: 175585
* Reinstate r173952, this time limiting it to exactly the formDouglas Gregor2013-01-301-1/+4
| | | | | | | | #define X X for which there is no point warning, ever. llvm-svn: 173991
* Revert "[preprocessor] Don't warn about "disabled expansion of recursive macro""Argyrios Kyrtzidis2013-01-301-4/+1
| | | | | | This reverts commit r173952 llvm-svn: 173970
* [preprocessor] Don't warn about "disabled expansion of recursive macro"Argyrios Kyrtzidis2013-01-301-1/+4
| | | | | | | | | for "#define X X". This is a pattern that, for example, stdbool.h uses. rdar://12435773 llvm-svn: 173952
* [PCH] Temporarily disable the "ambiguous macro" warning that is currently ↵Argyrios Kyrtzidis2013-01-231-0/+4
| | | | | | | | | | | | bogus with a PCH that redefined a macro without undef'ing it first. Proper reconstruction of the macro info history from modules will properly fix this in subsequent commits. rdar://13016031 llvm-svn: 173281
* [PCH/Modules] Revert r172843, it caused a module to fail building.Argyrios Kyrtzidis2013-01-191-5/+9
| | | | llvm-svn: 172884
* [PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!Argyrios Kyrtzidis2013-01-181-9/+5
| | | | | | | | | Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once. Unfortunately I couldn't get a reduced test case. rdar://13016031 llvm-svn: 172843
* [ubsan] Add support for -fsanitize-blacklistWill Dietz2013-01-181-3/+3
| | | | llvm-svn: 172808
* Revert Clang r172620 and r172629, which caused a hang when buildingDouglas Gregor2013-01-181-5/+9
| | | | | | | complicated modules (<rdar://problem/13038265>). Unfortunately, this un-fixes <rdar://problem/13016031>. llvm-svn: 172783
* No longer crashing with an assert when __has_include or __has_include_next ↵Aaron Ballman2013-01-161-0/+6
| | | | | | is used outside of a preprocessor directive. This fixes PR14837. llvm-svn: 172639
* [PCH/Modules] Change how macro [re]definitions are de/serialized.Argyrios Kyrtzidis2013-01-161-9/+5
| | | | | | | | | | | | | | | | | | Previously we would serialize the macro redefinitions as a list, part of the identifier, and try to chain them together across modules individually without having the info that they were already chained at definition time. Change this by serializing the macro redefinition chain and then try to synthesize the chain parts across modules. This allows us to correctly pinpoint when 2 different definitions are ambiguous because they came from unrelated modules. Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH is redefined without undef'ing it first. rdar://13016031 llvm-svn: 172620
* Typo correction; no functional change.Aaron Ballman2013-01-151-1/+1
| | | | llvm-svn: 172555
* Constify argument of Preprocessor::getMacroInfoHistory and propagate toDmitri Gribenko2013-01-141-1/+1
| | | | | | callers, removing unneeded const_cast llvm-svn: 172372
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Make __has_include a bit more resilient in the presence of macros. ↵Eli Friedman2013-01-091-2/+8
| | | | | | <rdar://problem/12748859>. llvm-svn: 171939
* Add __has_feature support to detect if clang supports the explicit "atomic" ↵Ted Kremenek2013-01-041-0/+1
| | | | | | | | keyword for ObjC properties. Fixes <rdar://problem/12953378>. llvm-svn: 171504
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-35/+35
| | | | llvm-svn: 171367
* [libclang] Fix crash when code-completing a macro invocation thatArgyrios Kyrtzidis2012-12-221-0/+4
| | | | | | reached EOF and did not expand the argument into the source context. llvm-svn: 170980
* [libclang] Follow-up to r170824, provide the correct number of arguments forArgyrios Kyrtzidis2012-12-211-0/+11
| | | | | | a not-fully-formed macro invocation during code-completion. llvm-svn: 170833
* [libclang] Make sure we can code-complete inside a macro argument even thoughArgyrios Kyrtzidis2012-12-211-14/+26
| | | | | | | | the macro invocation is not fully formed. rdar://11290992 llvm-svn: 170824
* Add __has_feature(memory_sanitizer).Evgeniy Stepanov2012-12-201-0/+1
| | | | llvm-svn: 170686
* tsan: add __has_feature(thread_sanitizer)Dmitry Vyukov2012-12-171-0/+1
| | | | llvm-svn: 170314
* [preprocessor] For errors at a function macro invocation, also includeArgyrios Kyrtzidis2012-12-141-0/+8
| | | | | | a note about where the macro is defined. llvm-svn: 170228
OpenPOWER on IntegriCloud