summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/MacroInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-171-1/+4
| | | | | | | public. Add a __private_macro__ directive to hide a macro, similar to the __module_private__ declaration specifier. llvm-svn: 142188
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-011-0/+2
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.Chandler Carruth2011-07-251-2/+2
| | | | llvm-svn: 135962
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Copy IsWarnIfUnused too when making a copy of a MacroInfo.Benjamin Kramer2011-06-031-0/+1
| | | | | | Found by valgrind. llvm-svn: 132540
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-1/+2
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* More PCH -> AST renaming.Sebastian Redl2010-08-181-2/+2
| | | | llvm-svn: 111472
* Implement #pragma push_macro, patch by Francois Pichet!Chris Lattner2010-08-171-0/+18
| | | | llvm-svn: 111234
* Record macros in dependent PCHs. Also add various info tables to dependent ↵Sebastian Redl2010-07-271-0/+1
| | | | | | PCHs; tests for this to follow. llvm-svn: 109554
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-6/+6
| | | | llvm-svn: 81346
* fix PR3764 - A redefinition of a pre-processor macro failsChris Lattner2009-03-091-3/+8
| | | | | | | Redefinition checking should ignore the leading whitespace and start of line flags on the first token of an expansion. llvm-svn: 66442
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+70
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