Commit Graph

52 Commits

Author SHA1 Message Date
Douglas Gregor f994f062fd PCH support for inline assembly statements.
This completes support for all of C (+ extensions). We can (again)
build a PCH file for Carbon.h.

llvm-svn: 69385
2009-04-17 20:57:14 +00:00
Douglas Gregor c95701da6c PCH support for blocks
llvm-svn: 69373
2009-04-17 19:21:43 +00:00
Douglas Gregor af97671954 PCH support for GNU statement expressions
llvm-svn: 69370
2009-04-17 19:05:30 +00:00
Douglas Gregor 779d865b48 PCH support for indirect gotos and address-of-label expressions.
llvm-svn: 69369
2009-04-17 18:58:21 +00:00
Douglas Gregor 6cc68a47b5 PCH support for labels and goto.
llvm-svn: 69364
2009-04-17 18:18:49 +00:00
Douglas Gregor 915b6c663d PCH support for declaration statements, and a test for PredefinedExpr
llvm-svn: 69356
2009-04-17 16:55:36 +00:00
Douglas Gregor f961e5921f PCH support for return statements.
Optimize PCH encoding for switch-case statements slightly, by making
the switch-case numbering local to a particular statement.

llvm-svn: 69355
2009-04-17 16:34:57 +00:00
Douglas Gregor 71517c47e6 PCH support for do-while and for loops
llvm-svn: 69334
2009-04-17 00:29:51 +00:00
Douglas Gregor e24cbc0f4b PCH support for while and continue statements
llvm-svn: 69332
2009-04-17 00:16:09 +00:00
Douglas Gregor a9af1d13da PCH support for the first batch of statements, including null,
compound, case, default, if, switch, and break statements.

llvm-svn: 69329
2009-04-17 00:04:06 +00:00
Douglas Gregor 8f45df58b3 Prepare PCH reader and writer for (de-)serialization of statements. No
functionality change.

llvm-svn: 69319
2009-04-16 22:23:12 +00:00
Douglas Gregor 6d955a9d25 Eliminate pch::TYPE_ATTR, which is never used
llvm-svn: 69256
2009-04-16 02:45:14 +00:00
Douglas Gregor 4c5cd33527 PCH support for CompoundLiteralExpr. This is the last C expression
that does not require PCH support for statements. Only AddrLabelExpr,
StmtExpr, and BlockExpr remain (for C).

llvm-svn: 69255
2009-04-16 02:33:48 +00:00
Douglas Gregor 38676d50dc PCH support for InitListExpr, DesignatedInitExpr, and ImplicitValueInitExpr.
llvm-svn: 69251
2009-04-16 00:55:48 +00:00
Douglas Gregor a3c5590ec2 PCH support for ShuffleVectorExpr and BlockDeclRefExpr
llvm-svn: 69244
2009-04-16 00:01:45 +00:00
Douglas Gregor 8693ec4e58 PCH support for TypesCompatibleExpr, ChooseExpr, and GNUNullExpr.
llvm-svn: 69242
2009-04-15 23:33:31 +00:00
Douglas Gregor 2ebf8717a5 PCH support for ExtVectorElementExpr and VAArgExpr.
llvm-svn: 69240
2009-04-15 23:02:49 +00:00
Douglas Gregor d4ed114e23 PCH support for CompoundAssignOperator and ConditionalOperator
llvm-svn: 69237
2009-04-15 22:40:36 +00:00
Douglas Gregor 978887b6b0 PCH support for ImaginaryLiteral and ArraySubscriptExpr
llvm-svn: 69233
2009-04-15 22:19:53 +00:00
Douglas Gregor bc8a78d5a4 PCH support for declaration attributes
llvm-svn: 69225
2009-04-15 21:30:51 +00:00
Douglas Gregor e95304ac93 PCH support for the string literal of a FileScopeAsmDecl.
Some minor cleanup.

llvm-svn: 69196
2009-04-15 18:43:11 +00:00
Douglas Gregor 8324327993 For source location entries that describe instantiations, encode the
token length in the PCH file rather than trying (and failing) to
reconstruct it be getting the spelling token's length.

llvm-svn: 69191
2009-04-15 18:05:10 +00:00
Douglas Gregor e20a2e5fa3 PCH support for MemberExpr and CallExpr.
llvm-svn: 69186
2009-04-15 17:43:59 +00:00
Douglas Gregor 958dfc9bbd PCH support for string literals
llvm-svn: 69172
2009-04-15 16:35:07 +00:00
Douglas Gregor 0253c83610 PCH support for UnaryOperator, SizeOfAlignOfExpr
llvm-svn: 69169
2009-04-15 15:58:59 +00:00
Douglas Gregor 67fdb085b9 PCH support for CStyleCastExpr and BinaryOperator expression kinds.
llvm-svn: 69119
2009-04-15 00:25:59 +00:00
Douglas Gregor 954a830eca PCH support for ParenExpr
llvm-svn: 69106
2009-04-14 23:59:37 +00:00
Douglas Gregor f0b575f79d Add PCH support for ImplicitCastExprs. This is the first expression
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.

llvm-svn: 69101
2009-04-14 23:32:43 +00:00
Douglas Gregor e0a3a51637 Add PCH support for PredefinedExpr and FloatingLiteral expressions
llvm-svn: 69084
2009-04-14 21:55:33 +00:00
Douglas Gregor feb84b0074 PCH support for a few very, very simple kinds of expressions. Hook up
expression (de-)serialization for VLAs, variable initializers,
enum constant initializers, and bitfield widths.

llvm-svn: 69075
2009-04-14 21:18:50 +00:00
Douglas Gregor 1a0d0b9acc When writing a PCH file, keep track of all of the non-static,
non-inline external definitions (and tentative definitions) that are
found at the top level. The corresponding declarations are stored in a
record in the PCH file, so that they can be provided to the
ASTConsumer (via HandleTopLevelDecl) when the PCH file is read.

llvm-svn: 69005
2009-04-14 00:24:19 +00:00
Douglas Gregor a541485bab Partial PCH support for FileScopeAsmDecl and BlockDecl. Both require
expression or statement serialization before we can test them.

llvm-svn: 69002
2009-04-13 22:49:25 +00:00
Douglas Gregor 92f056fadf PCH support for functions and their parameters.
llvm-svn: 68997
2009-04-13 22:18:37 +00:00
Douglas Gregor 183671e2d2 PCH support for record decls/types and their fields. Now that we can
handle the definition of __builtin_va_list on x86-64, eliminate the
forced -triple in PCH tests to get better coverage.

llvm-svn: 68988
2009-04-13 21:20:57 +00:00
Douglas Gregor 1daeb69f95 Add PCH support for enumerations and enumerators.
llvm-svn: 68974
2009-04-13 18:14:40 +00:00
Douglas Gregor 4c7626e7b6 Include the SourceManager's line table in the PCH file. We can now
properly cope with #line directives in PCH files.

llvm-svn: 68963
2009-04-13 16:31:14 +00:00
Chris Lattner 0af3ba1748 implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310
llvm-svn: 68933
2009-04-13 01:29:17 +00:00
Chris Lattner c523d8e88c now that we have an identifier table in the PCH file, finish hooking up
macro deserialization.  We now correctly install II's in tokens, handle
function-like macros, etc.

llvm-svn: 68882
2009-04-11 21:15:38 +00:00
Chris Lattner 225dd6c830 add some #includes for better compatibility with gcc 4.4,
thanks to Tobias Stadler for pointing this out.

llvm-svn: 68868
2009-04-11 18:40:46 +00:00
Douglas Gregor 3ed42cb0b3 Store unique IDs for identifiers in the PCH file. Use some bitmangling
so that we only need to perform the lookup and identifier resolution
once per identifier in the PCH file.

llvm-svn: 68846
2009-04-11 00:14:32 +00:00
Douglas Gregor 92863e475e Compare the predefines buffer in the PCH file with the predefines
buffer generated for the current translation unit. If they are
different, complain and then ignore the PCH file. This effectively
checks for all compilation options that somehow would affect
preprocessor state (-D, -U, -include, the dreaded -imacros, etc.).

When we do accept the PCH file, throw away the contents of the
predefines buffer rather than parsing them, since all of the results
of that parsing are already stored in the PCH file. This eliminates
the ugliness with the redefinition of __builtin_va_list, among other
things.

llvm-svn: 68838
2009-04-10 23:10:45 +00:00
Chris Lattner 34321bcd0b add support for reading macros. This does all the reading (with a bunch of
fixme's, e.g. for tokens with identifiers) but does not actually install
them.  Some details with the predefines buffer needs to be sorted out first.

llvm-svn: 68828
2009-04-10 21:41:48 +00:00
Douglas Gregor bfbde53ce1 Encode the target triple in the PCH file, and check that target triple when using the PCH file
llvm-svn: 68824
2009-04-10 21:16:55 +00:00
Douglas Gregor 55abb2389d Implement serialization/deserialization of LangOptions in the PCH
file. When de-serializing LangOptions, we check that the
currently-provided language options are consistent with the options
used to compile the PCH file. If they are not, we emit a diagnostic
and ignore the PCH file.

llvm-svn: 68820
2009-04-10 20:39:37 +00:00
Chris Lattner 2916a482fb add a new PP_MACRO_NAME hack so that I can test object-like macros.
llvm-svn: 68803
2009-04-10 18:22:18 +00:00
Chris Lattner 2199f5b4e5 emit tokens, constify the Preprocessor passed down into PCH writer.
llvm-svn: 68798
2009-04-10 18:08:30 +00:00
Chris Lattner baa52f47c1 emit function-like and object-like macros to the PCH file.
Note that we don't do anything useful with identifier infos yet
and don't emit the tokens that the macros are defined to.

llvm-svn: 68797
2009-04-10 18:00:12 +00:00
Douglas Gregor 1e9bf3bad4 Various minor fixes to PCH reading and writing, with general
cleanup. Aside from a minor tweak to the PCH file format, no
functionality change. 

llvm-svn: 68793
2009-04-10 17:25:41 +00:00
Chris Lattner 0910e3b92e improve punctuation
llvm-svn: 68791
2009-04-10 17:16:57 +00:00
Chris Lattner eeffaef7b9 Arrange for the preprocessor to be passed down into the PCH writer.
llvm-svn: 68790
2009-04-10 17:15:23 +00:00