summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* [preprocessor] Enhance PreprocessingRecord to keep track of locations of ↵Argyrios Kyrtzidis2012-03-052-4/+99
| | | | | | | | | conditional directives. Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns true if a given range intersects with a conditional directive block. llvm-svn: 152018
* [preprocessor] Enhance the preprocessor callbacks:Argyrios Kyrtzidis2012-03-051-27/+29
| | | | | | | | -Add location parameter for the directives callbacks -Skip callbacks if the directive is inside a skipped range. -Make sure the directive callbacks are invoked in source order. llvm-svn: 152017
* Lexing support for user-defined literals. Currently these lex as the same tokenRichard Smith2012-03-052-6/+88
| | | | | | | kinds as the underlying string literals, and we silently drop the ud-suffix; those issues will be fixed by subsequent patches. llvm-svn: 152012
* Add a pile of tests for unrestricted unions, and advertise support for them.Richard Smith2012-03-031-1/+1
| | | | llvm-svn: 151992
* Remove unused variable.Benjamin Kramer2012-03-031-1/+0
| | | | llvm-svn: 151989
* Adding support for #pragma include_alias in MS compatibility mode. This ↵Aaron Ballman2012-03-022-0/+126
| | | | | | implements PR 10705. llvm-svn: 151949
* Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek2012-03-012-7/+7
| | | | | | | | commit to a particular syntax for modules, and don't have time to push it forward in the near future. llvm-svn: 151841
* Implement double underscore names support in __has_attributeJean-Daniel Dupas2012-03-011-1/+6
| | | | llvm-svn: 151809
* Revert r151800, which was committed without review and has correctness issues.Richard Smith2012-03-012-108/+0
| | | | llvm-svn: 151804
* Implements support for #pragma include_alias in ms compatibility mode. ↵Aaron Ballman2012-03-012-0/+108
| | | | | | Fixes PR10705. llvm-svn: 151800
* Move suport for redefining operator keywords from -fms-extensions to ↵Nico Weber2012-03-011-1/+1
| | | | | | -fms-compatibility. llvm-svn: 151776
* Allow operator keywords to be #defined in ms-ext mode.Nico Weber2012-02-291-1/+8
| | | | | | | | | | | | | | Fixes PR10606. I'm not sure if this is the best way to go about it, but I locally enabled this code path without the msext conditional, and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp which explicitly checks that operator keywords can't be redefined. I also parsed chromium/win with a clang with and without this patch. It introduced no new errors, but removes 43 existing errors. llvm-svn: 151768
* Initializer lists are now supported.Sebastian Redl2012-02-251-1/+1
| | | | llvm-svn: 151458
* Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (andRichard Smith2012-02-251-2/+13
| | | | | | likewise for __has_extension). Patch by Jonathan Sauer! llvm-svn: 151445
* Don't record nested macro expansions in the preprocessing record,Argyrios Kyrtzidis2012-02-252-9/+6
| | | | | | | | it can only bring pain when dealing with preprocessor abuse (see: boost). rdar://10898986 llvm-svn: 151427
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+1
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Provide the __is_trivially_assignable type trait, which providesDouglas Gregor2012-02-231-0/+1
| | | | | | | compiler support for the std::is_trivially_assignable library type trait. llvm-svn: 151240
* Clang now supports lambda expressions.Douglas Gregor2012-02-231-1/+1
| | | | llvm-svn: 151231
* Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith2012-02-201-2/+2
| | | | | | | The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. llvm-svn: 150958
* Advertize support for constexpr.Richard Smith2012-02-141-1/+1
| | | | llvm-svn: 150524
* Implement warning for non-wide string literals with an unexpected encoding. ↵Eli Friedman2012-02-111-15/+40
| | | | | | Downgrade error for non-wide character literals with an unexpected encoding to a warning for compatibility with gcc and older versions of clang. <rdar://problem/10837678>. llvm-svn: 150295
* Fixing hex floating literal support so that it handles 0x.2p2 properly.Aaron Ballman2012-02-081-6/+11
| | | | llvm-svn: 150072
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-15/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Hex literals without a significand no longer crash the lexer. Fixes bug 7910Aaron Ballman2012-02-071-0/+6
| | | | | | Patch by Eitan Adler llvm-svn: 149984
* Move instantiateTemplateAttribute into the sema namespace, make helpers static.Benjamin Kramer2012-02-061-1/+2
| | | | llvm-svn: 149864
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-0512-42/+42
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-052-4/+4
| | | | llvm-svn: 149798
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-043-3/+3
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Remove Diagnostic.h include from Preprocessor.h.Benjamin Kramer2012-02-041-0/+15
| | | | | | | - Move the offending methods out of line and fix transitive includers. - This required changing an enum in the PPCallback API into an unsigned. llvm-svn: 149782
* Change Lexer::makeFileCharRange() to have it accept a CharSourceRangeArgyrios Kyrtzidis2012-02-031-24/+35
| | | | | | | instead of a SourceRange, and handle the case where the range is a char (not token) range. llvm-svn: 149677
* Back out my heinous hack that tricked the module generation mechanismDouglas Gregor2012-02-021-5/+52
| | | | | | | | | | | | | | | | | | | | into using non-absolute system includes (<foo>)... ... and introduce another hack that is simultaneously more heineous and more effective. We whitelist Clang-supplied headers that augment or override system headers (such as float.h, stdarg.h, and tgmath.h). For these headers, Clang does not provide a module mapping. Instead, a system-supplied module map can refer to these headers in a system module, and Clang will look both in its own include directory and wherever the system-supplied module map suggests, then adds either or both headers. The end result is that Clang-supplied headers get merged into the system-supplied module for the C standard library. As a drive-by, fix up a few dependencies in the _Builtin_instrinsics module. llvm-svn: 149611
* Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.Ted Kremenek2012-02-021-2/+10
| | | | llvm-svn: 149566
* objc2: add __has_feature(objc_default_synthesize_properties).Fariborz Jahanian2012-02-021-0/+1
| | | | | | // rdar://10770497 llvm-svn: 149565
* fix a crash on:Chris Lattner2012-01-311-1/+2
| | | | | | | | | | __has_builtin in an empty file, as we were overwriting the EOF token. Overwriting an arbitrary token never seems like a good idea in the error case. This fixes a bug reported on the GCC list :) llvm-svn: 149397
* Thread a TargetInfo through to the module map; we'll need it forDouglas Gregor2012-01-303-6/+20
| | | | | | target-specific module requirements. llvm-svn: 149224
* Implement code completion support for module import declarations, e.g.,Douglas Gregor2012-01-291-0/+55
| | | | | | | | | | | | @import <complete with module names here> or @import std.<complete with submodule names here> Addresses <rdar://problem/10710117>. llvm-svn: 149199
* Rework HeaderSearch's interface for getting a module from a name andDouglas Gregor2012-01-292-97/+72
| | | | | | | | | for getting the name of the module file, unifying the code for searching for a module with a given name (into lookupModule()) and separating out the mapping to a module file (into getModuleFileName()). No functionality change. llvm-svn: 149197
* Introduce module attributes into the module map grammar, along with aDouglas Gregor2012-01-272-12/+112
| | | | | | | | | | | | | single attribute ("system") that allows us to mark a module as being a "system" module. Each of the headers that makes up a system module is considered to be a system header, so that we (for example) suppress warnings there. If a module is being inferred for a framework, and that framework directory is within a system frameworks directory, infer it as a system framework. llvm-svn: 149143
* Only mark an IdentifierInfo as having changed since deserializationDouglas Gregor2012-01-241-3/+4
| | | | | | | | when it actually has changed (and not, e.g., when we've simply attached a deserialized macro definition). Good for ~1.5% reduction in module file size, mostly in the identifier table. llvm-svn: 148808
* Improve Lexer::getImmediateMacroName to take into account inner macrosArgyrios Kyrtzidis2012-01-231-3/+29
| | | | | | | | | of macro arguments. For "MAC1( MAC2(foo) )" and location of 'foo' token it would return "MAC1" instead of "MAC2". llvm-svn: 148704
* Enhance Lexer::makeFileCharRange to check for ranges inside a macro argumentArgyrios Kyrtzidis2012-01-201-11/+61
| | | | | | | expansion, in which case it returns a file range in the location where the argument was spelled. llvm-svn: 148551
* Introduce Lexer::getSourceText() that returns a string for the sourceArgyrios Kyrtzidis2012-01-191-0/+42
| | | | | | that the given source range encompasses. llvm-svn: 148481
* Introduce Lexer::makeFileCharRange() that accepts a token source rangeArgyrios Kyrtzidis2012-01-191-0/+29
| | | | | | and returns a character range with file locations. llvm-svn: 148480
* For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macroArgyrios Kyrtzidis2012-01-191-15/+21
| | | | | | | | | start/end location. It is commonly needed after calling the function; with this way we avoid recalculating it. llvm-svn: 148479
* Refactor: Pull getImmediateMacroName() out of DiagnosticRenderer andAnna Zaks2012-01-181-0/+21
| | | | | | into Lexer and Preprocessor; making it widely available. llvm-svn: 148410
* stop claiming unicode escape sequences are too long in strings, because they ↵Seth Cantrell2012-01-181-2/+0
| | | | | | never are llvm-svn: 148391
* Improves support for Unicode in character literalsSeth Cantrell2012-01-181-64/+115
| | | | | | | | | | | | | | | | | | | | Updates ProcessUCNExcape() for C++. C++11 allows UCNs in character and string literals that represent control characters and basic source characters. Also C++03 allows UCNs that refer to surrogate codepoints. UTF-8 sequences in character literals are now handled as single c-chars. Added error for multiple characters in Unicode character literals. Added errors for when a the execution charset encoding of a c-char cannot be represented as a single code unit in the associated character type. Note that for the purposes of this error the asso- ciated character type for a narrow character literal is char, not int, even though in C narrow character literals have type int. llvm-svn: 148389
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-176-10/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-0/+4
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* Two variables had been added for an assert, but their values wereChandler Carruth2012-01-151-3/+3
| | | | | | | | | | re-computed rather than the variables be re-used just after the assert. Just use the variables since we have them already. Fixes an unused variable warning. Also fix an 80-column violation. llvm-svn: 148212
OpenPOWER on IntegriCloud