summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Introduce SourceManager::PredefinesFileID, to allow each checking of whetherArgyrios Kyrtzidis2013-02-011-0/+1
| | | | | | a source location came from the predefines buffer. llvm-svn: 174190
* Lexer: Don't warn about Unicode in preprocessor directives.Jordan Rose2013-01-311-2/+4
| | | | | | | | | This allows people to use Unicode in their #pragma mark and in macros that exist only to be string-ized. <rdar://problem/13107323&13121362> llvm-svn: 174081
* Preprocessor: initialize member introduced in r173881.Jordan Rose2013-01-311-0/+1
| | | | | | | Compilation always sets this explicitly, but creating a preprocessor manually should still put the 'IsPreprocessedOutput' flag in a valid state. llvm-svn: 174077
* Micro-change: moved a brace for better readabilityAlexander Kornienko2013-01-311-2/+2
| | | | llvm-svn: 174075
* 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
* Fix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.Jordan Rose2013-01-301-0/+1
| | | | | | | | This caused hangs as we processed the same invalid byte over and over. <rdar://problem/13115651> llvm-svn: 173959
* [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
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-303-12/+15
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* Don't warn about Unicode characters in -E mode.Jordan Rose2013-01-301-18/+20
| | | | | | | | | | | | | | | People use the C preprocessor for things other than C files. Some of them have Unicode characters. We shouldn't warn about Unicode characters appearing outside of identifiers in this case. There's not currently a way for the preprocessor to tell if it's in -E mode, so I added a new flag, derived from the PreprocessorOutputOptions. This is only used by the Unicode warnings for now, but could conceivably be used by other warnings or even behavioral differences later. <rdar://problem/13107323> llvm-svn: 173881
* [Preprocessor] When checking if we can concatenate two tokens, checkArgyrios Kyrtzidis2013-01-291-3/+4
| | | | | | | | | | | | if they were already concatenated in source using the spelling locations even if they came from a macro expansion. This fixes an issue where a GUID passed as macro argument ends up malformed after preprocessing because we added spaces inside it. rdar://13016645 llvm-svn: 173826
* PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.Jordan Rose2013-01-281-1/+2
| | | | | | Fixes a crash. Thanks, Richard. llvm-svn: 173701
* PR15067: Don't assert when a UCN appears in a C90 file.Jordan Rose2013-01-272-4/+7
| | | | | | | Unfortunately, we can't accept the UCN as an extension because we're required to treat it as two tokens for preprocessing purposes. llvm-svn: 173622
* <limits.h> includes <linux/limits.h> on Linux, no need to special-case itDmitri Gribenko2013-01-262-6/+2
| | | | llvm-svn: 173578
* Since we're stuck with realpath for the header <-> module mapping,Douglas Gregor2013-01-262-44/+26
| | | | | | | | factor the realpath calls into FileManager::getCanonicalName() so we can cache the results of this epically slow operation. 5% speedup on my modules test, and realpath drops out of the profile. llvm-svn: 173542
* Lexer.cpp: Fix a warning with ptrdiff_t on i686. [-Wsign-compare]NAKAMURA Takumi2013-01-251-1/+1
| | | | llvm-svn: 173447
* [Lex] Remove DirectoryLookup.UserSpecified, which is unused.Daniel Dunbar2013-01-251-1/+1
| | | | llvm-svn: 173409
* Clarify comment: "diagnose" is better than "warn" when emitting an error.Jordan Rose2013-01-251-1/+1
| | | | | | Thanks, Dmitri. llvm-svn: 173400
* Add a fixit for \U1234 -> \u1234.Jordan Rose2013-01-241-1/+9
| | | | llvm-svn: 173371
* As an extension, treat Unicode whitespace characters as whitespace.Jordan Rose2013-01-241-0/+23
| | | | llvm-svn: 173370
* Handle universal character names and Unicode characters outside of literals.Jordan Rose2013-01-242-17/+331
| | | | | | | | | | | | | | | | | | | | | | | | This is a missing piece for C99 conformance. This patch handles UCNs by adding a '\\' case to LexTokenInternal and LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN. If the UCN is not syntactically well-formed, we fall back to the old treatment: a backslash followed by an identifier beginning with 'u' (or 'U'). Because the spelling of an identifier with UCNs still has the UCN in it, we need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo. Of course, valid code that does *not* use UCNs will see only a very minimal performance hit (checks after each identifier for non-ASCII characters, checks when converting raw_identifiers to identifiers that they do not contain UCNs, and checks when getting the spelling of an identifier that it does not contain a UCN). This patch also adds basic support for actual UTF-8 in the source. This is treated almost exactly the same as UCNs except that we consider stray Unicode characters to be mistakes and offer a fixit to remove them. llvm-svn: 173369
* Unify diagnostics for \x, \u, and \U without any following hex digits.Jordan Rose2013-01-241-2/+2
| | | | llvm-svn: 173368
* [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
* Fix compilation on Linux, which defines PATH_MAX in a weird place,Douglas Gregor2013-01-222-0/+10
| | | | | | from Saleem Abdulrasool! llvm-svn: 173208
* [PCH/Modules] Revert r172843, it caused a module to fail building.Argyrios Kyrtzidis2013-01-191-5/+9
| | | | llvm-svn: 172884
* Adopt llvm::hexDigitValue.Jordan Rose2013-01-181-13/+4
| | | | llvm-svn: 172861
* [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
* Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are ↵Joey Gouly2013-01-171-0/+6
| | | | | | not supported. llvm-svn: 172732
* Remove unnecessary initialization i Added in r172668.David Blaikie2013-01-161-6/+5
| | | | | | | echristo already fixed this in r172649, but I'll leave the reformatting in since I'm in the blame history for it now anyway. llvm-svn: 172672
* Fix -Wreorder warning.David Blaikie2013-01-161-13/+11
| | | | | | Rewrapping courtesy of clang-format. llvm-svn: 172668
* Move initialization of ParsingIfOrElifDirective down next to the macroEric Christopher2013-01-161-4/+3
| | | | | | initializations to fix Wreorder warning. llvm-svn: 172649
* No longer crashing with an assert when __has_include or __has_include_next ↵Aaron Ballman2013-01-163-1/+11
| | | | | | is used outside of a preprocessor directive. This fixes PR14837. llvm-svn: 172639
* [preprocessor] Call the MacroUndefined callback even when the macro was not ↵Argyrios Kyrtzidis2013-01-162-5/+8
| | | | | | | | defined. Patch by Enea Zaffanella! llvm-svn: 172623
* [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
* Infer "link" lines for top-level frameworks. Essentially, a frameworkDouglas Gregor2013-01-141-0/+30
| | | | | | | | will have a shared library with the same name as its framework (and no suffix!) within its .framework directory. Detect this both when inferring the whole top-level framework and when parsing a module map. llvm-svn: 172439
* Implement parsing, AST, (de-)serialization, and placeholder globalDouglas Gregor2013-01-141-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | metadata for linking against the libraries/frameworks for imported modules. The module map language is extended with a new "link" directive that specifies what library or framework to link against when a module is imported, e.g., link "clangAST" or link framework "MyFramework" Importing the corresponding module (or any of its submodules) will eventually link against the named library/framework. For now, I've added some placeholder global metadata that encodes the imported libraries/frameworks, so that we can test that this information gets through to the IR. The format of the data is still under discussion. llvm-svn: 172437
* 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-128-17/+17
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rework the realpath nonsense for framework lookups to deal moreDouglas Gregor2013-01-102-102/+139
| | | | | | uniformly with symlinks between top-level and embedded frameworks. llvm-svn: 172030
* [PreprocessingRecord] A macro expansion can be reported out-of-order in ↵Argyrios Kyrtzidis2013-01-091-3/+11
| | | | | | | | | | | | cases when there are macro expansions inside macro arguments where the arguments are not expanded in the same order as listed; don't assert that all macro expansions are in source order. rdar://12397063 llvm-svn: 172018
* Make __has_include a bit more resilient in the presence of macros. ↵Eli Friedman2013-01-091-2/+8
| | | | | | <rdar://problem/12748859>. llvm-svn: 171939
* Pull the bulk of Lexer::MeasureTokenLength() out into a new function,Argyrios Kyrtzidis2013-01-071-5/+15
| | | | | | | | Lexer::getRawToken(). No functionality change. llvm-svn: 171771
* realpath'ify the mapping from header includes to module imports.Douglas Gregor2013-01-041-0/+13
| | | | llvm-svn: 171516
* 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
* Add the module name to the 'incomplete umbrella header' warning.Douglas Gregor2013-01-041-1/+1
| | | | llvm-svn: 171497
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-026-59/+59
| | | | llvm-svn: 171367
* [libclang] Fix crash when code-completing a macro invocation thatArgyrios Kyrtzidis2012-12-222-14/+33
| | | | | | reached EOF and did not expand the argument into the source context. llvm-svn: 170980
OpenPOWER on IntegriCloud