summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Post-commit review coding style change: renaming HasAttribute to ↵Aaron Ballman2014-03-311-1/+1
| | | | | | hasAttribute. No functional changes. llvm-svn: 205201
* Reapplying r204952 a second time.Aaron Ballman2014-03-311-15/+3
| | | | | | | | | | Clean up the __has_attribute implementation without modifying its behavior. Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. llvm-svn: 205181
* Reverting r204968 and r204969; while more build bots are happy with the ↵Aaron Ballman2014-03-271-3/+15
| | | | | | results, some still have link errors. llvm-svn: 204974
* Reapplying r204952 with fixes which should hopefully resolve linking issues ↵Aaron Ballman2014-03-271-15/+3
| | | | | | with non-MSVC compilers. llvm-svn: 204968
* Reverting r204952, while I figure out what's going on with the makefile build.Aaron Ballman2014-03-271-3/+15
| | | | llvm-svn: 204955
* Clean up the __has_attribute implementation without modifying its behavior. Aaron Ballman2014-03-271-15/+3
| | | | | | | | Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. llvm-svn: 204952
* Added a __has_feature() for 'is_constructible'Marshall Clow2014-03-181-0/+1
| | | | llvm-svn: 204153
* Implement the MS extension __identifier properly: take a token and strip it ofRichard Smith2014-03-151-6/+47
| | | | | | its keywordliness. llvm-svn: 203987
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-1/+1
| | | | llvm-svn: 202639
* If a module A exports a macro M, and a module B imports that macro and #undef'sRichard Smith2014-03-011-5/+5
| | | | | | | | | | | | | | it, importers of B should not see the macro. This is complicated by the fact that A's macro could also be visible through a different path. The rules (as hashed out on cfe-commits) are included as a documentation update in this change. With this, the number of regressions in libc++'s testsuite when modules are enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are due to remaining bugs in this change (in particular, the handling of submodules is imperfect). llvm-svn: 202560
* Fix cxx_variable_templates feature check and documentationAlp Toker2014-01-151-1/+1
| | | | | | | | | | This C++ feature has been marked complete since r191549, but the documentation claimed it wasn't supported at all and the extension check misreported it as being available in C. No regression test; this was a short-lived typo. llvm-svn: 199292
* __has_attribute now understands target-specific attributes. So when you ask ↵Aaron Ballman2014-01-091-2/+2
| | | | | | whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others. llvm-svn: 198897
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Cleanup: Switch the preprocessor to err_pp_expected_afterAlp Toker2013-12-301-5/+7
| | | | | | | | | | This is approaching consistency but the PP and Parse categories they still have slightly different wording: def err_pp_expected_after : Error<"missing %1 after %0">; def err_expected_after : Error<"expected %1 after %0">; llvm-svn: 198189
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-2/+2
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Tweak the ordering of a conditional to possibly avoid a few strcmps.Aaron Ballman2013-12-061-1/+1
| | | | llvm-svn: 196584
* Fix a typo in a comment: expasion -> expansionJames Dennett2013-12-021-1/+1
| | | | llvm-svn: 196123
* [-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
OpenPOWER on IntegriCloud