summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/variables.h
Commit message (Collapse)AuthorAgeFilesLines
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* PCH support for a few very, very simple kinds of expressions. Hook upDouglas Gregor2009-04-141-1/+1
| | | | | | | expression (de-)serialization for VLAs, variable initializers, enum constant initializers, and bitfield widths. llvm-svn: 69075
* implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310Chris Lattner2009-04-131-0/+8
| | | | llvm-svn: 68933
* now that we have an identifier table in the PCH file, finish hooking upChris Lattner2009-04-111-1/+1
| | | | | | | macro deserialization. We now correctly install II's in tokens, handle function-like macros, etc. llvm-svn: 68882
* test this in non-pch mode as well as in pch mode.Chris Lattner2009-04-111-0/+5
| | | | llvm-svn: 68881
* do a dance with predefines, and finally enable reading of macros fromChris Lattner2009-04-101-0/+1
| | | | | | | PCH. This works now, except for limitations not being able to do things with identifiers. The basic example in the testcase works though. llvm-svn: 68832
* PCH serialization/deserialization of the source manager. With thisDouglas Gregor2009-04-101-2/+9
| | | | | | | | | | | | improvement, source locations read from the PCH file will properly resolve to the source files that were used to build the PCH file itself. Once we have the preprocessor state stored in the PCH file, source locations that refer to macro instantiations that occur in the PCH file should have the appropriate instantiation information. llvm-svn: 68758
* Implementation of pre-compiled headers (PCH) based on lazyDouglas Gregor2009-04-091-0/+5
de-serialization of abstract syntax trees. PCH support serializes the contents of the abstract syntax tree (AST) to a bitstream. When the PCH file is read, declarations are serialized as-needed. For example, a declaration of a variable "x" will be deserialized only when its VarDecl can be found by a client, e.g., based on name lookup for "x" or traversing the entire contents of the owner of "x". This commit provides the framework for serialization and (lazy) deserialization, along with support for variable and typedef declarations (along with several kinds of types). More declarations/types, along with important auxiliary structures (source manager, preprocessor, etc.), will follow. llvm-svn: 68732
OpenPOWER on IntegriCloud