Commit Graph

565 Commits

Author SHA1 Message Date
Douglas Gregor 5b11d49a7c Make ASTContext always use the BumpPtrAllocator.
llvm-svn: 109375
2010-07-25 17:53:33 +00:00
Douglas Gregor 5cc2c8b9c3 Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.

Patch from Anton Yartsev!

llvm-svn: 109229
2010-07-23 15:58:24 +00:00
Fariborz Jahanian 3c7ebc3a5e Patch to type match comparing Objective-C Classes which implement
protocols (Radar 8191774).

llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Douglas Gregor 747eb7840a Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.

llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Douglas Gregor 2530efd3cf When printing statistics for the ASTContext, also print them for its BumpPtrAllocator
llvm-svn: 107790
2010-07-07 16:40:34 +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 6685e8a747 Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.
llvm-svn: 107597
2010-07-04 21:44:35 +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 cdb8b3f7ec Read/write specialization info of static data members for PCH.
llvm-svn: 107593
2010-07-04 21:44:00 +00:00
Douglas Gregor 9672f92f7f Lazily declare default constructors. We now delay the construction of
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:

  4/159 implicit default constructors created
  18/236 implicit copy constructors created
  70/241 implicit copy assignment operators created
  0/173 implicit destructors created

And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.

llvm-svn: 107551
2010-07-03 00:47:00 +00:00
Douglas Gregor a6d695057c Lazily declare implicit copy constructors.
llvm-svn: 107543
2010-07-02 23:41:54 +00:00
Douglas Gregor 330b9cff74 Lazily declare copy-assignment operators.
llvm-svn: 107521
2010-07-02 21:50:04 +00:00
Douglas Gregor 7454c563f1 Lazily declare the implicitly-declared destructor in a C++ class.
llvm-svn: 107510
2010-07-02 20:37:36 +00:00
Argyrios Kyrtzidis 2c2167ac3d Fully read/write CXXRecordDecl for PCH.
llvm-svn: 107475
2010-07-02 11:55:32 +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
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
Fariborz Jahanian 3bf0ded346 Patch to provide separate ASTs for multiple ObjC class extension
declarations (implements radar 7928731).

llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Ted Kremenek 520f47b66f Change two static variables into instance variables of ASTContext. This allows us to have multiple copies
of ASTContext at the same time.

llvm-svn: 106258
2010-06-18 00:31:04 +00:00
Douglas Gregor 7dbfb46163 Canonicalize template template parameters when canonicalizing a
template name that refers to such a parameter. It's amazing that this
problem didn't surface earlier. Fixes PR7387.

llvm-svn: 106147
2010-06-16 21:09:37 +00:00
Douglas Gregor 2ebcae1931 Revert r106099; it broke self-host.
llvm-svn: 106100
2010-06-16 15:23:05 +00:00
Abramo Bagnara bec18dbb88 Added TemplateTypeParmType::getDecl().
llvm-svn: 106099
2010-06-16 14:59:30 +00:00
Douglas Gregor b90df60b3b Introduce Type::isIntegralOrEnumerationType(), to cover those places
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.

llvm-svn: 106071
2010-06-16 00:17:44 +00:00
John McCall 30576cdce3 TemplateSpecializationType's isCurrentInstantiation bit can be derived
from its canonical type.

llvm-svn: 105912
2010-06-13 09:25:03 +00:00
John McCall 773cc98c3a Don't store ASTContext references in the TST nodes just to support profiling.
llvm-svn: 105820
2010-06-11 11:07:21 +00:00
John McCall dad856dba3 Provide an Objective C mangling for wchar_t. Patch by Nico Weber!
llvm-svn: 105818
2010-06-11 10:11:05 +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
Douglas Gregor 1fc3d66da4 Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.

llvm-svn: 105678
2010-06-09 03:53:18 +00:00
Ted Kremenek 076baeb03e Fix memory leak in ASTContext where ASTRecordLayout objects involving C++ structures wouldn't have
their associated memory destroyed when using a BumpPtrAllocator.  These objects internally use
a DenseMap.

llvm-svn: 105659
2010-06-08 23:00:58 +00:00
John McCall 8cb7bdfd33 Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.
This is never null, but the associated type might be.

llvm-svn: 105503
2010-06-04 23:28:52 +00:00
Rafael Espindola e971b9a260 Correctly align large arrays in x86-64. This fixes PR5599.
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
John McCall 8e346702b6 Preserve more information from a block's original function declarator, if one
was given.  Remove some unnecessary accounting from BlockScopeInfo.  Handle
typedef'ed function types until such time as we decide not.

llvm-svn: 105478
2010-06-04 19:02:56 +00:00
David Chisnall b190a2c74a Fixed Objective-C type encoding for bitfields for the GNU runtime to match the encoding used by GCC.
llvm-svn: 105451
2010-06-04 01:10:52 +00:00
Fariborz Jahanian c77f0f394a Fix 80-column.
llvm-svn: 104847
2010-05-27 16:35:00 +00:00
Fariborz Jahanian 9ea5839cb6 Objective-c++ IR gen.
Flag synthesized struct decl. as non-empty so
CXX side of ir gen does not skip its Null initialization.
Fixes radar 8027844 for objc++'s collection statement.

llvm-svn: 104837
2010-05-27 16:05:06 +00:00
Anders Carlsson df291d8d8b Move the relevant ASTContext member functions that deal with ASTRecordLayoutBuilder into RecordLayoutBuilder.cpp. This matches the way we interact with other builder classes (CGRecordLayoutBuilder, VTableBuilder and VTTBuilder) and it also allows for making ASTRecordLayoutBuilder a private class without a header file.
llvm-svn: 104671
2010-05-26 04:56:53 +00:00
Douglas Gregor e05d3cb770 A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.

llvm-svn: 104545
2010-05-24 20:13:53 +00:00
Douglas Gregor 1a80933d24 Keep track of all of the class and function template's "common"
pointers in the ASTContext, so that the folding sets stored inside
them will be deallocated when the ASTContext is destroyed (under
-disable-free). <rdar://problem/7998824>.

llvm-svn: 104465
2010-05-23 18:26:36 +00:00
Douglas Gregor 5e8c8c0e12 Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206.

llvm-svn: 104461
2010-05-23 16:10:32 +00:00
John McCall 87fe5d5618 Support implicitly closing on 'this' in a block. Fixed PR7165.
(the codegen works here, too, but that's annoying to test without execution)

llvm-svn: 104202
2010-05-20 01:18:31 +00:00
Fariborz Jahanian f633ebd961 Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.

llvm-svn: 104168
2010-05-19 21:37:30 +00:00
John McCall a9e6e8d654 Teach the ObjC mangler to ignore member pointers just like gcc does.
llvm-svn: 104001
2010-05-17 23:56:34 +00:00
Douglas Gregor 3b05bdba5a Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.

llvm-svn: 103958
2010-05-17 18:45:21 +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
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Ted Kremenek 7e550caf4e Allocate most of DeclarationNamesTable using ASTContext's allcocator. The only things that
aren't allocated this way are the internal FoldingSets.

llvm-svn: 103429
2010-05-10 20:56:10 +00:00
Ted Kremenek 6aead3a051 Start converting pieces of DeclarationNameTable to be allocated using ASTContext's allocator.
While DeclarationNameTable doesn't leak, it uses 'malloc' too often.  Start with having
'CXXLiteralOperatorNames' allocated using ASTContext's allocator and add a 'DoDestroy()' method
to DeclarationNameTable that is called by ~ASTContext.

llvm-svn: 103426
2010-05-10 20:40:08 +00:00
Fariborz Jahanian c5158203dd Implement encoding of methods which have instantiated
template arguments.

llvm-svn: 103221
2010-05-07 00:28:49 +00:00
John McCall 4d4dcc8ed7 When synthesizing Objective C records, give the synthetic fields public
access.  Fixes an assertion.

Fixes rdar://problem/7927811.  Too lazy to reduce a test case.

llvm-svn: 102776
2010-04-30 21:35:41 +00:00
Daniel Dunbar edd5bae86c Revert "Fix for PR6953: per gcc, regparm and noreturn affect the compatibility of", it is breaking the builds of quite a few projects (emacs, dovecot, gnutar, bison).
llvm-svn: 102501
2010-04-28 16:20:58 +00:00
Eli Friedman 7955e52f5c Fix for PR6953: per gcc, regparm and noreturn affect the compatibility of
function types.

This could potentially have unexpected side-effects, so look here if there are
new regressions.

llvm-svn: 102464
2010-04-27 21:07:06 +00:00