Commit Graph

310 Commits

Author SHA1 Message Date
Sebastian Redl 1ea025bef9 Add a little more data to chained PCHs. WIP
llvm-svn: 108528
2010-07-16 16:36:56 +00:00
Daniel Dunbar 01ad0a78d0 Suppress !+Asserts warning.
llvm-svn: 108480
2010-07-16 00:00:11 +00:00
Sebastian Redl 85b2a6a430 Add a callback interface that allows interested parties to get notified whenever PCHReader deserializes a type or decl (and possibly other things in the future). Have PCHWriter implement these callbacks as noops and register to receive them if we're chaining PCHs. This will allow PCHWriter to track the IDs of these things, which it needs to write the dependent files. WIP
llvm-svn: 108383
2010-07-14 23:45:08 +00:00
Benjamin Kramer 8d5609b604 Pass StringRefs by value.
llvm-svn: 108375
2010-07-14 23:19:41 +00:00
Sebastian Redl 409183ff7c Increase the max PCH level for declarations to 7. Add a FromPCH flag to types.
llvm-svn: 108354
2010-07-14 20:26:45 +00:00
Sebastian Redl 75fbb3b5e5 Make PCHReader cope with PCH files containing more than one predefines buffer.
llvm-svn: 108340
2010-07-14 17:49:11 +00:00
Douglas Gregor 8ed0c0b99d Introduce -f{no-}spell-checking options to enable/disable
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.

llvm-svn: 107992
2010-07-09 17:35:33 +00:00
Argyrios Kyrtzidis 7e8996c7e6 Introduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord when initializing.
ReadDeclRecord would hit assertion if the translation unit declaration was already loaded during
IdentifierInfo initialization.

llvm-svn: 107885
2010-07-08 17:13:02 +00:00
Argyrios Kyrtzidis a4ed18191c For TagType and TemplateSpecializationType, isDependent calculation may be invalid because some decls that the
calculation is using may still be initializing.
Thus, store the isDependent flag to PCH and restore directly to Type.

llvm-svn: 107873
2010-07-08 13:09:53 +00:00
Argyrios Kyrtzidis ad65c6926b Fix broken reading of NestedNameSpecifiers from PCH.
llvm-svn: 107784
2010-07-07 15:46:30 +00:00
Argyrios Kyrtzidis 903ccd6121 Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
declarations are fully initialized.

llvm-svn: 107783
2010-07-07 15:46:26 +00:00
Argyrios Kyrtzidis af2eac2869 Add to PCH missing Sema information about VTable uses and dynamic classes.
llvm-svn: 107664
2010-07-06 15:37:04 +00:00
Argyrios Kyrtzidis b5fcdc21c2 Fix a regression of a previous commit of mine (rdar://8158953).
Some of the invariant checks for creating Record/Enum types don't hold true during PCH reading.
Introduce more suitable ASTContext::getRecordType() and getEnumType().

llvm-svn: 107598
2010-07-04 21:44:47 +00:00
Argyrios Kyrtzidis e862cbc5f6 Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

llvm-svn: 107595
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis 3701fcd759 Read/write CastExpr's CXXBaseSpecifierArray for PCH.
llvm-svn: 107542
2010-07-02 23:30:27 +00:00
Argyrios Kyrtzidis 2c2167ac3d Fully read/write CXXRecordDecl for PCH.
llvm-svn: 107475
2010-07-02 11:55:32 +00:00
Argyrios Kyrtzidis e929095f4a Fix reading of DependentNameType.
llvm-svn: 107474
2010-07-02 11:55:24 +00:00
Argyrios Kyrtzidis dab33c5d33 Allow reading of InjectedClassNameType from PCH even when its decl is currently initializing.
llvm-svn: 107473
2010-07-02 11:55:20 +00:00
Argyrios Kyrtzidis ee776bcb7a Fix broken reading of member pointer from PCH.
llvm-svn: 107472
2010-07-02 11:55:15 +00:00
Argyrios Kyrtzidis 45a83f9acc - Allow a typedef type to be read from PCH even if its decl is currently initializing.
- Fix creation of TemplateSpecializationType.

llvm-svn: 107471
2010-07-02 11:55:11 +00:00
Argyrios Kyrtzidis e3029a7e7b Fix broken reading of "#lines" from PCH.
llvm-svn: 107470
2010-07-02 11:55:05 +00:00
Argyrios Kyrtzidis 4a57bd0d62 Support DependentSizedArrayType for PCH.
llvm-svn: 107267
2010-06-30 08:49:25 +00:00
Argyrios Kyrtzidis d0795b2d78 Modify the way sub-statements are stored and retrieved from PCH.
Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.

x = sizeof(int[1]);

would crash PCH.

Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
 PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.

llvm-svn: 107087
2010-06-28 22:28:35 +00:00
Argyrios Kyrtzidis ddf5f211d0 Fix PCH emitting/reading for template arguments that contain expressions.
llvm-svn: 106996
2010-06-28 09:31:42 +00:00
Argyrios Kyrtzidis 0b0369a6b3 Fix various bugs in recent commits for C++ PCH.
llvm-svn: 106995
2010-06-28 09:31:34 +00:00
Chris Lattner 51924e517b Implement support for -fwrapv, rdar://7221421
As part of this, pull together trapv handling into the same enum.

This also add support for NSW multiplies.

This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get 
defined etc).

llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Argyrios Kyrtzidis f0f7a792d7 Support DependentTemplateSpecializationType and ElaboratedType for PCH.
llvm-svn: 106858
2010-06-25 16:24:58 +00:00
Argyrios Kyrtzidis bfcacee9b3 Support a couple more C++ Exprs for PCH.
llvm-svn: 106727
2010-06-24 08:57:31 +00:00
Argyrios Kyrtzidis 818c5db054 Support C++ class template specializations and partial specializations for PCH.
llvm-svn: 106625
2010-06-23 13:48:30 +00:00
Chris Lattner 37141f4fb4 improve altivec vector bool/pixel support, patch by Anton Yartsev
with several tweaks by me.

llvm-svn: 106619
2010-06-23 06:00:24 +00:00
Argyrios Kyrtzidis ae85e2414c -Introduce PCHReader::ReadTemplateArgumentLoc()
-Introduce PCHWriter::AddTemplateArgumentLocInfo()
-Modify PCHWriter::AddTemplateArgumentLoc() to also write TemplateArgumentLoc's TemplateArgument
  and move the existing calls of AddTemplateArgumentLoc() to AddTemplateArgumentLocInfo().

llvm-svn: 106533
2010-06-22 09:54:59 +00:00
Argyrios Kyrtzidis 95c04caf92 Initial support for reading templates from PCH.
llvm-svn: 106392
2010-06-19 19:29:09 +00:00
Argyrios Kyrtzidis 106caf92cd Initial support for writing templates to PCH.
llvm-svn: 106391
2010-06-19 19:28:53 +00:00
John McCall c392f37ae8 Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'.  The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.

llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Daniel Dunbar 6d3bc0898e Fix undefined behavior, noticed by GCC 4.5. Patch by Dimitry Andric!
llvm-svn: 105329
2010-06-02 15:47:10 +00:00
John McCall 75b960e5ee Alter the ExternalASTSource interface to permit by-name lookups. PCH continues to
bring in the entire lookup table at once.

Also, give ExternalSemaSource's vtable a home.  This is important because otherwise
any reference to it will cause RTTI to be emitted, and since clang is compiled
with -fno-rtti, that RTTI will contain unresolved references (to ExternalASTSource's
RTTI).  So this change makes it possible to subclass ExternalSemaSource from projects
compiled with RTTI, as long as the subclass's home is compiled with -fno-rtti.

llvm-svn: 105268
2010-06-01 09:23:16 +00:00
Abramo Bagnara d754848f10 Added basic source locations to Elaborated and DependentName types.
llvm-svn: 104169
2010-05-19 21:37:53 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Daniel Dunbar 4707cef758 Revert r103770, "Added basic source locations to Elaborated and DependentName
types.", it is breaking Clang bootstrap.

llvm-svn: 103775
2010-05-14 16:34:09 +00:00
Abramo Bagnara e9f4d6ed7d Added basic source locations to Elaborated and DependentName types.
llvm-svn: 103770
2010-05-14 14:14:23 +00:00
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Chris Lattner cba86142a4 pchify CXXTemporary, CXXBindTemporaryExpr, and
CXXExprWithTemporaries.

llvm-svn: 103387
2010-05-10 00:25:06 +00:00
Chris Lattner ca025db769 add PCH support for a bunch of C++ Decls, patch by
Andrew Sutton!

llvm-svn: 103301
2010-05-07 21:43:38 +00:00
Fariborz Jahanian e804c28745 More work toward implementing
NeXt's -fno-constant-cfstrings - wip.

llvm-svn: 102189
2010-04-23 17:41:07 +00:00
Fariborz Jahanian 62c560246e Check for -fno-constant-cfstrings consistency
in pch.

llvm-svn: 102130
2010-04-22 21:01:59 +00:00
Chandler Carruth e03aa55bfd Add support for '-fgnu-keywords' and '-fasm' to Clang's driver. They are not
implemented precisely the same as GCC, but the distinction GCC makes isn't
useful to represent. This allows parsing code which uses GCC-specific keywords
('asm', etc.) without parsing in a fully GNU mode.

llvm-svn: 101667
2010-04-17 20:17:31 +00:00
Douglas Gregor 08288f2846 On Windows, disable the modification-time check for files used in
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.

llvm-svn: 100866
2010-04-09 15:54:22 +00:00
Douglas Gregor d720daf8bc Make code-completion for Objective-C message sends to "id" work in the
presence of precompiled headers by forcibly loading all of the
methods we know about from the PCH file before constructing our
code-completion list.

llvm-svn: 100535
2010-04-06 17:30:22 +00:00
Chris Lattner 58c79341ab Match MemoryBuffer API changes.
llvm-svn: 100484
2010-04-05 22:42:27 +00:00
Douglas Gregor c1d2d8a014 Rename TypenameType to DependentNameType in anticipation of some
refactoring work in this area.

llvm-svn: 100019
2010-03-31 17:34:00 +00:00