summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Incrementally compute the list of overridden module macros based onRichard Smith2015-04-274-46/+89
| | | | | | | the active module macros at the point of definition, rather than reconstructing it from the macro history. No functionality change intended. llvm-svn: 235941
* Remove unused variable to silence GCC warningDavid Majnemer2015-04-241-3/+2
| | | | llvm-svn: 235693
* [modules] Partial revert of r235669: don't create ModuleMacros for imported ↵Richard Smith2015-04-241-6/+0
| | | | | | | | local macros. The surrounding infrastructure isn't quite ready for this yet. llvm-svn: 235677
* [modules] Refactor creation of ModuleMacros and create them when importing ↵Richard Smith2015-04-232-12/+24
| | | | | | from local submodules. llvm-svn: 235669
* [modules] Properly attribute macros to modules if they're in a file ↵Richard Smith2015-04-233-6/+11
| | | | | | textually included into a file in the module. llvm-svn: 235661
* [modules] Store a ModuleMacro* on an imported macro directive rather than ↵Richard Smith2015-04-234-29/+35
| | | | | | duplicating the info within it. llvm-svn: 235644
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-235-20/+124
| | | | | | | | | | | that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
* [modules] Actually allocate the extra space we use for the tail-allocated arrayRichard Smith2015-04-231-3/+5
| | | | | | in this class. llvm-svn: 235570
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-221-0/+9
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-222-0/+47
| | | | | | | | This graph will be used to determine the current set of active macros. This is foundation work for getting macro visibility correct across submodules of the current module. No functionality change for now. llvm-svn: 235461
* [MSVC] Mimic MSVC whitespace collapse for incompatible token pastingWill Wilson2015-04-171-0/+7
| | | | | | | | | | In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing. Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51) Resolves http://llvm.org/pr23071 llvm-svn: 235186
* MSan told me that we actually dump the entire scratch buffer into PCH files, ↵Benjamin Kramer2015-04-061-3/+4
| | | | | | | | | | | initialize it. Writing 4k of zeros is preferrable to 4k of random memory. Document that. While there remove the initialization of the first byte of the buffer and start at index zero. It was writing a literal '0' instead of a null byte at the beginning anyways, which didn't matter since we never read it. llvm-svn: 234202
* Prefer uninitialized memory for scratch space.Benjamin Kramer2015-04-061-1/+1
| | | | | | No functional change intended. llvm-svn: 234184
* [lex] Provide a valid token when __has_include is found outside of a pp ↵Benjamin Kramer2015-03-291-0/+3
| | | | | | | | | | | directive ExpandBuiltinMacro would strip the identifier and downstream users crash when they encounter an identifier token with nullptr identifier info. Found by afl-fuzz. llvm-svn: 233497
* [lex] Don't create a garbage token if parsing of __has_include fails.Benjamin Kramer2015-03-291-2/+4
| | | | | | It will crash downstream somewhere. Found by afl-fuzz. llvm-svn: 233493
* [lex] Don't read past the end of the bufferBenjamin Kramer2015-03-291-3/+4
| | | | | | | | | While dereferencing ThisTokEnd is fine and we know that it's not in [a-zA-Z0-9_.], ThisTokEnd[1] is really past the end. Found by asan and with a little help from clang-fuzz. llvm-svn: 233491
* [lex] Turn range checks into asserts.Benjamin Kramer2015-03-291-44/+36
| | | | | | | We know that the last accessible char is not in [a-zA-Z0-9_.] so we can happily scan on as long as it is. No functionality change. llvm-svn: 233490
* [modules] Restrict the module use-declaration to only appear in top-levelRichard Smith2015-03-261-17/+13
| | | | | | | modules, and allow sub-modules of a module with a use-declaration to make use of the nominated modules. llvm-svn: 233323
* Make Oveflow tracking more legible (CR feedback from Richard Smith on r232999)David Blaikie2015-03-231-1/+2
| | | | llvm-svn: 233006
* Refactor: Simplify boolean expresssions in lib/LexDavid Blaikie2015-03-231-1/+1
| | | | | | | | | | Simplify boolean expressions using `true` and `false` with `clang-tidy` Patch by Richard Thomson. Differential Revision: http://reviews.llvm.org/D8531 llvm-svn: 232999
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-186-27/+26
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Lex: Don't call getIdentifierInfo on annotation tokensDavid Majnemer2015-03-181-1/+1
| | | | | | | | These calls are usually guarded by checks for isAnnotation() but it looks like we missed a spot. This would cause the included test to crash clang. llvm-svn: 232616
* Implement PreprocessingRecord's and LazyVector's iterators on top of ↵Benjamin Kramer2015-03-151-1/+1
| | | | | | | | | | | | | iterator_adaptor_base This basically creates a wrapper around an 'int' that poses as an iterator. While that looks a bit counter-intuitive it works just fine because iterator operations and basic integer arithmetic works in exactly the same way. Remove the manual integer wrapping code and reduce the reliance on iterator internals in the implementation. No functionality change intended. llvm-svn: 232322
* When building a module, all headers of submodules can be used.Daniel Jasper2015-03-131-1/+2
| | | | | | This extends r232159. llvm-svn: 232168
* Make a module "use" also count as use of all its submodulesDaniel Jasper2015-03-131-3/+5
| | | | llvm-svn: 232159
* Teach raw_ostream to accept SmallString.Yaron Keren2015-03-101-1/+1
| | | | | | | | | | | | | | Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. llvm-svn: 231763
* [modules] This check is run before we resolve the header, not after, so justRichard Smith2015-03-101-21/+14
| | | | | | | check that private headers are in a list matching the role. (We can't perform the opposite checks for non-private headers because we infer those.) llvm-svn: 231728
* [modules] Don't assert if the same header is named as both a public and aRichard Smith2015-03-091-9/+18
| | | | | | private header within the same module. llvm-svn: 231725
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-5/+2
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Properly initialize the parser_crash debug token.Benjamin Kramer2015-03-081-0/+2
| | | | | | Found by msan. llvm-svn: 231605
* Use delegating ctors to reduce code duplication. NFC.Benjamin Kramer2015-03-061-8/+2
| | | | llvm-svn: 231476
* [Modules] Fix crash in Preprocessor::getLastMacroWithSpelling().Argyrios Kyrtzidis2015-03-041-3/+3
| | | | | | Macro names that got undefined inside a module may not have their MacroInfo set. llvm-svn: 231251
* Add clang support for Objective-C application extensions.Bob Wilson2015-03-021-0/+1
| | | | | | | | This adds the -fapplication-extension option, along with the ios_app_extension and macosx_app_extension availability attributes. Patch by Ted Kremenek llvm-svn: 230989
* Commit patch for PR19649. Set the correct sign of wide character for ↵Michael Wong2015-02-241-1/+3
| | | | | | | | | | literals based on underlying type of wchar_t. Reviewed: http://reviews.llvm.org/D7559 Patch by Rachel Craig; Test cases by Hubert Tong. llvm-svn: 230333
* Don't load Framework module.map files when searching subdirectoriesBen Langmuir2015-02-241-2/+4
| | | | | | | | | | | This would cause frameworks to have spurious "redefinition" errors if they had both a (legacy) "module.map" and a (new) "module.modulemap" file and we happened to do a sub-directory search in that directory using a non-framework include path (e.g. -Ifoo/ -Ffoo/). For migration purposes it's very handy that the compiler will prefer the new spelling of the filename and not look at the old one if it doesn't need to. llvm-svn: 230308
* Revert "Mangle the IsSystem bit into the .pcm file name"Ben Langmuir2015-02-191-8/+2
| | | | | | | | While I investigate some possible problems with this patch. This reverts commit r228966 llvm-svn: 229910
* Spelling correction.Yaron Keren2015-02-191-1/+1
| | | | llvm-svn: 229839
* Allow errors on use of a private module header to be disabled, to better ↵Richard Smith2015-02-191-3/+3
| | | | | | support incremental transition to modules. llvm-svn: 229788
* [modules] Accept //-style comments in module maps on purpose rather than byRichard Smith2015-02-141-1/+3
| | | | | | accident, and accept them even when they begin '//*'. llvm-svn: 229240
* [modules] If we have a choice between including a file textually and importingRichard Smith2015-02-131-2/+17
| | | | | | a prebuilt form from a module, prefer the modular form, all else being equal. llvm-svn: 229188
* Mangle the IsSystem bit into the .pcm file nameBen Langmuir2015-02-121-2/+8
| | | | | | | | | When mangling the module map path into a .pcm file name, also mangle the IsSystem bit, which can also depend on the header search paths. For example, the user may change from -I to -isystem. This can affect diagnostics in the importing TU. llvm-svn: 228966
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-061-6/+7
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* Allow objc_bridge(id) to be used on typedefs of [cv] void*.John McCall2015-02-011-1/+2
| | | | | | rdar://19678874 llvm-svn: 227774
* Inherit attributes when infering a framework moduleBen Langmuir2015-01-131-24/+23
| | | | | | | | | | If a module map contains framework module * [extern_c] {} We will now infer [extern_c] on the inferred framework modules (we already inferred [system] as a special case). llvm-svn: 225803
* Remove unused method canInferFrameworkModuleBen Langmuir2015-01-131-24/+0
| | | | llvm-svn: 225801
* Lex: Don't let annotation tokens get into macro expansionDavid Majnemer2014-12-281-1/+2
| | | | | | | | | | We'd let annotation tokens from '#pragma pack' and the like get inside a function-like macro. This would lead to terror and mayhem; stop the madness early. This fixes PR22037. llvm-svn: 224896
* Fixed warnings on redefine keywords and reserved ids.Serge Pavlov2014-12-181-14/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | Repared support for warnings -Wkeyword-macro and -Wreserved-id-macro. The warning -Wkeyword-macro now is not issued in patterns that are used in configuration scripts: #define inline also for 'const', 'extern' and 'static'. If macro repalcement is identical to macro name, the warning also is not issued: #define volatile volatile And finally if macro replacement is also a keyword identical to the replaced one but decorated with leading/trailing underscores: #define inline __inline #define inline __inline__ #define inline _inline // in MSVC compatibility mode Warning -Wreserved-id-macro is off by default, it could help catching things like: #undef __cplusplus llvm-svn: 224512
* Move -Wkeyword-macro into -pedantic, remove -Wreserved-id-macro.Nico Weber2014-12-161-50/+5
| | | | | | | | | | | | | | | | | | | As discussed on the post-commit review thread for r224012, -Wkeyword-macro fires mostly on headers trying to set up portable defines and doesn't find much bad stuff in practice. But [macro.names]p2 does disallow defining or undefining keywords, override and final, and alignas, so keep the warning but move it into -pedantic. -Wreserved-id-macro warns on #define __need_size_t which is more or less public api for glibc headers. Since this warning isn't motivated by a standard, remove it. (See also r223114 for a previous follow-up to r224012.) llvm-svn: 224371
* Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacroDavid Majnemer2014-12-151-4/+10
| | | | | | | | | | | We would CreateString on arbitrary garbage instead of just skipping to the end of the builtin macro. Eventually, this would cause us to crash because we would end up replacing the contents of a character token with a numeric literal. This fixes PR21825. llvm-svn: 224238
* MSVC: A wide string literal from L#macro_arg in a macroAlexey Bataev2014-12-151-3/+19
| | | | | | | | Clang should form a wide string literal from L#macro_arg in a function-like macro in -fms-compatibility mode. Fix for http://llvm.org/PR9984. Differential Revision: http://reviews.llvm.org/D6604 llvm-svn: 224228
OpenPOWER on IntegriCloud