summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/MacroArgs.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Preprocessor] For the MacroExpands preprocessor callback, also pass the ↵Argyrios Kyrtzidis2013-05-031-1/+1
| | | | | | | | MacroArgs object that provides information about the argument tokens for a function macro. llvm-svn: 181065
* Handle _Pragma on a u8, u, or U string literal per the C11 specification. AlsoRichard Smith2013-03-091-9/+5
| | | | | | | | handle raw string literals here. C++11 doesn't yet specify how they will behave, but discussion on core suggests that we should just strip off everything but the r-char-sequence. llvm-svn: 176779
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* StringRef'ize Preprocessor::CreateString().Dmitri Gribenko2012-09-241-1/+1
| | | | llvm-svn: 164555
* Correct handling of _Pragma macro inside a macro argument.Argyrios Kyrtzidis2012-04-031-0/+5
| | | | | | | | | | | | | | | | If we are pre-expanding a macro argument don't actually "activate" the pragma at that point, activate the pragma whenever we encounter it again in the token stream. This ensures that we will activate it in the correct location or that we will ignore it if it never enters the token stream, e.g: \#define EMPTY(x) \#define INACTIVE(x) EMPTY(x) INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\"")) This also fixes the crash in rdar://11168596. llvm-svn: 153959
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-1/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Fixed exapnsion range for # and ##.Abramo Bagnara2011-10-031-4/+9
| | | | llvm-svn: 141012
* ArrayRef-ifying MacroArgs::create's arguments argument.David Blaikie2011-09-221-11/+14
| | | | llvm-svn: 140288
* Handle a code-completion token being passed to the macro stringify operator.Argyrios Kyrtzidis2011-09-041-0/+2
| | | | | | Fixes http://llvm.org/PR10826. llvm-svn: 139087
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-1/+7
| | | | llvm-svn: 136210
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* Silence more -Wnon-pod-memset given its current implementation. I may beChandler Carruth2011-04-281-1/+1
| | | | | | | able to revert these based on a patch I'm working on, but no reason for people to be spammed with warnings in the interim. llvm-svn: 130394
* Audit all Preprocessor::getSpelling() callers, improving failureDouglas Gregor2010-03-161-12/+19
| | | | | | recovery for those that need it. llvm-svn: 98689
* use best-fit instead of first-fit when reusing a MacroArgs object,Chris Lattner2009-12-281-7/+16
| | | | | | this speeds up Eonly on the testcase in PR5888 from 30.5s to 0.85s llvm-svn: 92203
* The PreExpArgTokens array is indexed with an argument #,Chris Lattner2009-12-281-5/+6
| | | | | | | not a token number. Fix the reserve logic to get the right amount of space. llvm-svn: 92202
* fix the microsoft "charify" extension to return the charified token Chris Lattner2009-12-231-1/+1
| | | | | | | as a character literal, not a string literal. This might fix rdar://7486575 llvm-svn: 92025
* enable reuse of MacroArgs objects. This is a small (2.5%) win Chris Lattner2009-12-151-10/+32
| | | | | | | | | | on PR5610 (2.185 -> 2.130s). The big issue is that this is making insanely huge macro argument lists with over a million tokens in it. The reason that mallco and free are so expensive is that we are actually going to the kernel to get it, and switching to a bump pointer allocator won't change this in an interesting way. llvm-svn: 91449
* set up the machinery for a MacroArgs cache hanging off Preprocessor.Chris Lattner2009-12-151-0/+13
| | | | | | | | | We creating and free thousands of MacroArgs objects (and the related std::vectors hanging off them) for the testcase in PR5610 even though there are only ~20 live at a time. This doesn't actually use the cache yet. llvm-svn: 91391
* move the VarargsElided member of MacrosArgs to shrink the MacroArgs structChris Lattner2009-12-141-2/+3
| | | | | | | on 64-bit targets. Pass Preprocessor into create/destroy methods of MacroArgs even though it isn't used yet. llvm-svn: 91345
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-17/+17
| | | | llvm-svn: 81346
* When we expect two arguments but have zero, make sure to addChris Lattner2009-05-131-0/+1
| | | | | | | | | two empty arguments. Also, add an assert so that this bug manifests as an assertion failure, not a valgrind problem. This fixes rdar://6880648 - [cpp] crash in ArgNeedsPreexpansion llvm-svn: 71616
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* remove my hacks that aggressively threw away multiple Chris Lattner2009-01-261-6/+0
| | | | | | | | | | | instantiation history in an effort to speed up c99-intconst-1.c. Now that multiple nested instantiations are allowed, we just make them and don't pay the cost of lookups. With the other changes that went in before this, reverting this is actually a speedup for c99-intconst-1.c, speeding it up from 1.96s to 1.80s, and preserves much better loc info. llvm-svn: 63036
* This change refactors some of the low-level lexer interfaces a bit.Chris Lattner2009-01-261-2/+1
| | | | | | | | | | | | | Token now has a class of kinds for "literals", which include numeric constants, strings, etc. These tokens can optionally have a pointer to the start of the token in the lexer buffer. This makes it faster to get spelling and do other gymnastics, because we don't have to go through source locations. This change is performance neutral, but will make other changes more feasible down the road. llvm-svn: 63028
* eagerly resolve the spelling locations of macro argument preexpansions.Chris Lattner2009-01-261-2/+9
| | | | | | | | | | | | | | | This reduces fsyntax-only time on c99-intconst-1.c from 2.43s down to 2.01s (20%), reducing the number of fileid lookups from 2529040 linear and 64771121 binary to 5625902 linear and 4151182 binary. This knocks getFileID down to only 4.6% of compile time on this testcase. At this point, malloc/free is over 35% of compile time, primarily allocating MacroArgs objects and their argument preexpansion vectors. I don't feel like malloc avoiding right now, so I'm just going to call this good. llvm-svn: 62994
* Optimize stringification a bit to avoid std::string thrashing andChris Lattner2009-01-051-10/+24
| | | | | | | avoid the version of Preprocessor::getSpelling that returns an std::string. llvm-svn: 61769
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+225
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud