summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Try to make the source location information for token pastes a bit more ↵Eli Friedman2012-12-011-0/+6
| | | | | | | | | consistent. Fixes a crash printing diagnostics on the gcc testsuite, and also makes diagnostic range printing print nicer results for token pastes. llvm-svn: 169068
* Comments: no need to escape any characters in \code ... \endcode.Dmitri Gribenko2012-11-301-6/+6
| | | | llvm-svn: 169030
* Support for #pragma region/endregion for MSVC compatibility. Patch thanks ↵Aaron Ballman2012-11-301-0/+25
| | | | | | to pravic! llvm-svn: 169028
* Keep track of modules that have failed to build. If we encounter anDouglas Gregor2012-11-291-1/+8
| | | | | | | | | | | | import of that module elsewhere, don't try to build the module again: it won't work, and the experience is quite dreadful. We track this information somewhat globally, shared among all of the related CompilerInvocations used to build modules on-the-fly, so that a particular Clang instance will only try to build a given module once. Fixes <rdar://problem/12552849>. llvm-svn: 168961
* Remove obsolete comment missed by r162937Andy Gibbs2012-11-281-4/+0
| | | | llvm-svn: 168778
* Teach Lexer::getSpelling about raw string literals. Specifically, if a rawRichard Smith2012-11-281-42/+67
| | | | | | | | string literal needs cleaning (because it contains line-splicing in the encoding prefix or in the ud-suffix), do not clean the section between the double-quotes -- that's the "raw" bit! llvm-svn: 168776
* Clean up code according to coding standardsAndy Gibbs2012-11-171-3/+2
| | | | llvm-svn: 168274
* Fix crash on end-of-file after \ in a char literal, fixes PR14369.Nico Weber2012-11-171-6/+8
| | | | | | | This makes LexCharConstant() look more like LexStringLiteral(), which doesn't have this bug. Add tests for eof after \ for several other cases. llvm-svn: 168269
* Prevent premature macro expansion in __has_builtin, __has_feature,Andy Gibbs2012-11-171-3/+3
| | | | | | | __has_attribute, __has_extension, making them behave more akin to conventional macros. llvm-svn: 168268
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-173-5/+12
| | | | llvm-svn: 168267
* Refactored duplicate string literal lexing code within Preprocessor, into aAndy Gibbs2012-11-173-148/+86
| | | | | | | | | | | | | common LexStringLiteral function. In doing so, some consistency problems have been ironed out (e.g. where the first token in the string literal was lexed with macro expansion, but subsequent ones were not) and also an erroneous diagnostic has been corrected. LexStringLiteral is complemented by a FinishLexStringLiteral function which can be used in the situation where the first token of the string literal has already been lexed. llvm-svn: 168266
* Fix handling of invalid uses of the __has_warning builtin macroAndy Gibbs2012-11-171-2/+6
| | | | llvm-svn: 168265
* If an excluded header does not exist, just ignore itDouglas Gregor2012-11-151-1/+3
| | | | llvm-svn: 168077
* Suppress elided variadic macro argument extension diagnostic for macros usingEli Friedman2012-11-143-4/+40
| | | | | | | | | | | | | | | | | | | | | | the related comma pasting extension. In certain cases, we used to get two diagnostics for what is essentially one extension. This change suppresses the first diagnostic in certain cases where we know we're going to print the second diagnostic. The diagnostic is redundant, and it can't be suppressed in the definition of the macro because it points at the use of the macro, so we want to avoid printing it if possible. The implementation works by detecting constructs which look like comma pasting at the time of the definition of the macro; this information is then used when the macro is used. (We can't actually detect whether we're using the comma pasting extension until the macro is actually used, but we can detecting constructs which will be comma pasting if the varargs argument is elided.) <rdar://problem/12292192> llvm-svn: 167907
* Fix an assertion failure printing the unused-label fixit in files using CRLF ↵Eli Friedman2012-11-141-1/+8
| | | | | | line endings. <rdar://problem/12639047>. llvm-svn: 167900
* Revert r167801, "[preprocessor] When #including something that contributes noDaniel Dunbar2012-11-132-23/+1
| | | | | | tokens at all,". This change broke External/Nurbs in LLVM test-suite. llvm-svn: 167858
* UCNs in char literals are done (in LiteralSupport), remove FIXME. Expand UCN ↵Nico Weber2012-11-131-2/+1
| | | | | | FIXME in LexNumericConstant. llvm-svn: 167818
* [preprocessor] When #including something that contributes no tokens at all,Argyrios Kyrtzidis2012-11-132-1/+23
| | | | | | | | | don't recursively continue lexing. This avoids a stack overflow with a sequence of many empty #includes. rdar://11988695 llvm-svn: 167801
* In Lexer::LexTokenInternal, avoid code duplication; no functionality change.Argyrios Kyrtzidis2012-11-131-39/+26
| | | | llvm-svn: 167800
* s/BCPLComment/LineComment/Nico Weber2012-11-111-22/+22
| | | | llvm-svn: 167690
* Improved support for removing the comma preceding __VA_ARGS__ where __VA_ARGS__Andy Gibbs2012-11-091-17/+64
| | | | | | | | | | is empty in a variadic macro expansion. This fixes a divergence in support for the ", ## __VA_ARGS__" GCC extension which differed in behaviour when in strict C99 mode (note: there is no change in behaviour has been made in the gnu99 mode that clang uses by default). In addition, there is improved support for the Microsoft alternative extension ", __VA_ARGS__". llvm-svn: 167613
* LiteralSupport: Don't overflow the temporary buffer when decoding invalid ↵Benjamin Kramer2012-11-081-5/+6
| | | | | | | | | string parts. Instead just use a dummy buffer, we're not going to use the decoded string anyways. Fixes PR14292. llvm-svn: 167594
* LiteralSupport: Clean up style violations. No functionality change.Benjamin Kramer2012-11-081-15/+15
| | | | llvm-svn: 167593
* Remove C++11-isms I just introduced in r167482Douglas Gregor2012-11-061-3/+3
| | | | llvm-svn: 167483
* Introduce inferred framework modules into the module map file,Douglas Gregor2012-11-062-85/+263
| | | | | | | | | | | | | | allowing a module map to be placed one level above the '.framework' directories to specify that all .frameworks within that directory can be inferred as framework modules. One can also specifically exclude frameworks known not to work. This makes explicit (and more restricted) behavior modules have had "forever", where *any* .framework was assumed to be able to be built as a module. That's not necessarily true, so we white-list directories (with exclusions) when those directories have been audited. llvm-svn: 167482
* Rename LangOptions members for address sanitizer and thread sanitizer fromRichard Smith2012-11-051-1/+1
| | | | | | *Sanitizer to Sanitize* in preparation for later patches. llvm-svn: 167405
* Make the FilenameRange of the InclusionDirective callback more accurate,Argyrios Kyrtzidis2012-11-011-2/+2
| | | | | | | | preserve the macro location of the range end if the filename came from a macro. Patch by Kim Gräsman! llvm-svn: 167239
* Handle string encoding diagnostics when there are too many invalid ranges.David Blaikie2012-10-301-1/+2
| | | | llvm-svn: 167059
* improve highlighting of invalid string encodingsSeth Cantrell2012-10-281-11/+49
| | | | | | | limit highlight to exactly the bad encoding, and highlight every bad encoding in a string. llvm-svn: 166900
* Take into account that there may be a BOM at the beginning of the file,Argyrios Kyrtzidis2012-10-251-3/+6
| | | | | | when computing the size of the precompiled preamble. llvm-svn: 166659
* Teach the preprocessor to hold onto the preprocessor options.Douglas Gregor2012-10-241-2/+5
| | | | llvm-svn: 166599
* Move HeaderSearchOptions into the Lex library, make it intrusivelyDouglas Gregor2012-10-241-2/+4
| | | | | | reference-counted, and hold a reference to it in HeaderSearch. llvm-svn: 166583
* Removed an extra blank line.Mahesha S2012-10-241-1/+0
| | | | llvm-svn: 166571
* Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor2012-10-231-1/+2
| | | | | | | the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
* Fix for PR13334. This prevents crashes that result from badly formedRichard Trieu2012-10-221-12/+27
| | | | | | expressions involving __has_include llvm-svn: 166438
* Teach TargetInfo to hold on to the TargetOptions with which it wasDouglas Gregor2012-10-151-11/+9
| | | | | | created. llvm-svn: 165943
* Introduce the notion of excluded headers into the module mapDouglas Gregor2012-10-151-30/+46
| | | | | | | | description. Previously, one could emulate this behavior by placing the header in an always-unavailable submodule, but Argyrios guilted me into expressing this idea properly. llvm-svn: 165921
* Sanitize the names of modules determined based on the names of headersDouglas Gregor2012-10-121-6/+67
| | | | | | | or directories, to make sure that they are identifiers that are not keywords in any dialect. Fixes <rdar://problem/12489495>. llvm-svn: 165821
* Track which particular submodule #undef's a macro, so that the actualDouglas Gregor2012-10-121-6/+12
| | | | | | #undef only occurs if that submodule is imported. llvm-svn: 165773
* Diagnose the expansion of ambiguous macro definitions. This can happenDouglas Gregor2012-10-112-7/+35
| | | | | | | only with modules, when two disjoint modules #define the same identifier to different token sequences. llvm-svn: 165746
* Introduce a simple "hint" scheme to eliminate the quadratic behaviorDouglas Gregor2012-10-111-3/+3
| | | | | | associated with deserializing macro history for an identifier. llvm-svn: 165729
* Remove an unused bit from the serialized IdentifierInfoDouglas Gregor2012-10-111-1/+1
| | | | llvm-svn: 165683
* Deserialize macro history when we deserialize an identifier that hasDouglas Gregor2012-10-112-14/+93
| | | | | | | | | | | | | | | | | | | | | | | | macro history. When deserializing macro history, we arrange history such that the macros that have definitions (that haven't been #undef'd) and are visible come at the beginning of the list, which is what the preprocessor and other clients of Preprocessor::getMacroInfo() expect. If additional macro definitions become visible later, they'll be moved toward the front of the list. Note that it's possible to have ambiguities, but we don't diagnose them yet. There is a partially-implemented design decision here that, if a particular identifier has been defined or #undef'd within the translation unit, that definition (or #undef) hides any macro definitions that come from imported modules. There's still a little work to do to ensure that the right #undef'ing happens. Additionally, we'll need to scope the update records for #undefs, so they only kick in when the submodule containing that update record becomes visible. llvm-svn: 165682
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-093-5/+19
| | | | | | | | | | | | | | | | MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
* [Modules] Introduce Module::TopHeaders which is a set of top-level headersArgyrios Kyrtzidis2012-10-051-0/+1
| | | | | | that are associated with a (sub)module. llvm-svn: 165279
* [preprocessing record] Have PPEntityID be independent of the size of theArgyrios Kyrtzidis2012-10-051-14/+18
| | | | | | | loaded entities vector, otherwise its meaning will change when a module is imported and the vector size changes. llvm-svn: 165278
* Add info in the preprocessing record whether an inclusion directiveArgyrios Kyrtzidis2012-10-021-3/+5
| | | | | | resulted in an automatic module import. llvm-svn: 165022
* Move the 'find macro by spelling' infrastructure to the Preprocessor class andDmitri Gribenko2012-09-291-0/+33
| | | | | | | use it to suggest appropriate macro for __attribute__((deprecated)) in -Wdocumentation-deprecated-sync. llvm-svn: 164892
* For PPCallbacks::InclusionDirective() add a parameter for the module, wheneverArgyrios Kyrtzidis2012-09-293-10/+36
| | | | | | | an inclusion directive was automatically turned into a module import, and PPCallbacks::moduleImport() for an explicit module import. llvm-svn: 164874
* Add an assertion to make sure the implicitly imported moduleArgyrios Kyrtzidis2012-09-291-0/+2
| | | | | | is the same as the suggested one when looking up the include filename. llvm-svn: 164872
OpenPOWER on IntegriCloud