Commit Graph

13341 Commits

Author SHA1 Message Date
Douglas Gregor da7be08a0c When instantiating UnresolvedLookupExpr and UnresolvedMemberExpr
expressions, be sure to set the naming class of the LookupResult
structure. Fixes PR6947.

llvm-svn: 102434
2010-04-27 16:10:10 +00:00
Daniel Dunbar 2cb4e7a872 Simplify.
llvm-svn: 102432
2010-04-27 15:35:03 +00:00
Daniel Dunbar 34d7a99062 Add Driver support for -fno-constant-cfstrings.
llvm-svn: 102431
2010-04-27 15:34:57 +00:00
David Chisnall 75afda6c33 Ensure return from a message to nil is always 0 (GNU runtime).
This works around stack corruption / crashes resulting from PR6944, and also
works around people who expect 'what works on my machine' to work everywhere
(GCC crashes in a number of cases on SPARC that should now work correctly with
clang).

llvm-svn: 102430
2010-04-27 15:08:48 +00:00
Daniel Dunbar 19d6355b77 Fix comments.
llvm-svn: 102429
2010-04-27 14:51:07 +00:00
Enea Zaffanella f205977e6f Wrap a couple of long lines. (Test commit.)
llvm-svn: 102420
2010-04-27 07:38:32 +00:00
John McCall 1e67dd6b2f Improve the diagnostic you get when making a qualified member access
with a qualifier referencing a different type.

llvm-svn: 102409
2010-04-27 01:43:38 +00:00
John McCall 2408e32096 Make the InjectedClassNameType the canonical type of the current instantiation
of a class template or class template partial specialization.  That is to
say, in
  template <class T> class A { ... };
or
  template <class T> class B<const T*> { ... };
make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType
when written inside the appropriate context.  This allows us to track the
current instantiation appropriately even inside AST routines.  It also allows
us to compute a DeclContext for a type much more efficiently, at some extra
cost every time we write a template specialization (which can be optimized,
but I've left it simple in this patch).

llvm-svn: 102407
2010-04-27 00:57:59 +00:00
Fariborz Jahanian b310259060 New method to construct/destruct ivars that have non-trivial default
constructors or destructors, not used yet.

llvm-svn: 102403
2010-04-26 23:51:25 +00:00
Devang Patel 42fb6f8b9a Enable debug info for local variables at -O1+.
llvm-svn: 102398
2010-04-26 23:28:46 +00:00
Douglas Gregor 9da641912d Improve source-location information in a C++ typeid (type) expression
by using TypeSourceInfo, cleaning up the representation
somewhat. Teach getTypeOperand() to strip references and
cv-qualifiers, providing the semantic view of the type without
requiring any extra storage (the unmodified type remains within the
TypeSourceInfo). This fixes a bug found by Boost's call_traits test.

Finally, clean up semantic analysis, by splitting the ActOnCXXTypeid
routine into ActOnCXXTypeId (the parser action) and two BuildCXXTypeId
functions, which perform the semantic analysis for typeid(type) and
typeid(expression), respectively. We now perform less work at template
instantiation time (we don't look for std::type_info again) and can
give better diagnostics.

llvm-svn: 102393
2010-04-26 22:37:10 +00:00
Chris Lattner 678eaa90ab fix PR6936: don't generate line marker directives when preprocessing
.S files.  "# 123" is passed through as-is, not treated as a line
marker in this mode.  No testcase, because it would be nasty and isn't
worth it.

llvm-svn: 102391
2010-04-26 22:08:10 +00:00
Fariborz Jahanian 0103d67f98 Diagnose declaration of reference typed ivars.
llvm-svn: 102390
2010-04-26 22:07:03 +00:00
Douglas Gregor 8385a06929 Introduce Type::isStructureOrClassType(), which does the obvious
thing. Audit all uses of Type::isStructure(), changing those calls to
isStructureOrClassType() as needed (which is alsmost
everywhere). Fixes the remaining failure in Boost.Utility/Swap.

llvm-svn: 102386
2010-04-26 21:31:17 +00:00
Fariborz Jahanian 65654df92c Cleanup error recovery for a missing '-'|'+'
on a method declaration (radar 7822196).

llvm-svn: 102383
2010-04-26 21:18:08 +00:00
Douglas Gregor b7e20eb883 Implement template instantiation for implicit property references in
Objective-C++. This is the last bit of (non-blocks-related) template
instantiation logic for Objective-C++. Yay! 

llvm-svn: 102382
2010-04-26 21:04:54 +00:00
Douglas Gregor 9faee21f67 Implement template instantiation for ObjCPropertyRefExpr.
llvm-svn: 102379
2010-04-26 20:47:02 +00:00
Chris Lattner 5e8416a77f emit dtors with the right calling convention in -fno-use-cxa-atexit
mode.

llvm-svn: 102377
2010-04-26 20:35:54 +00:00
Douglas Gregor d51d90dd04 Implement template instantiation for value-dependent Objective-C ivar
references and isa expressions. Also, test template instantiation of
unresolved member references to Objective-C ivar references and isa
expressions.

llvm-svn: 102374
2010-04-26 20:11:03 +00:00
Douglas Gregor f4e837f66c Implement template instantiation for Objective-C @catch
statements. This is the last of the Objective-C statements.

llvm-svn: 102356
2010-04-26 17:57:08 +00:00
Douglas Gregor f356419bf5 Refactor Objective-C @catch parameter checking by detangling it from
function-parameter checking and splitting it into the normal
ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch
parameter rather than the ill-fitting ParmVarDecl.

llvm-svn: 102347
2010-04-26 17:32:49 +00:00
Douglas Gregor 46a572b871 Make the static type of the exception variable in an Objective-C
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.

llvm-svn: 102341
2010-04-26 16:46:50 +00:00
Douglas Gregor d984815ed9 Ensure that we have completed a type before attempting initialization
on that type. Fixes several problems in Boost.Interprocess.

llvm-svn: 102339
2010-04-26 14:36:57 +00:00
Douglas Gregor 516d672310 When name lookup finds a single declaration that was imported via a
using declaration, look at its underlying declaration to determine the
lookup result kind (e.g., overloaded, unresolved). Fixes at least one
issue in Boost.Bimap.

llvm-svn: 102317
2010-04-25 21:15:30 +00:00
Douglas Gregor 861eb80a3b Improve the diagnostic when we find something we did not expect in a
member expression (p-> or x.), by showing the type we looked into and
what we did actually find.

llvm-svn: 102315
2010-04-25 20:55:08 +00:00
Daniel Dunbar 710cb20cd6 IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:
- Fix some places that had the alignment hard coded.
 - Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice.

This should be equivalent for x86_64, but fixes the alignment for ARM.

llvm-svn: 102314
2010-04-25 20:39:32 +00:00
Daniel Dunbar 5e63927d41 IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI.
llvm-svn: 102312
2010-04-25 20:39:01 +00:00
Douglas Gregor 645d76f271 When performing name lookup for an operator name, be sure to look
through using declarations. Fixes ~18 tests in Boost.Fusion.

llvm-svn: 102311
2010-04-25 20:25:43 +00:00
Anders Carlsson 06eed9bee2 Land another cleanup patch.
llvm-svn: 102293
2010-04-25 01:03:12 +00:00
Douglas Gregor d0ace02496 When copying a temporary object to initialize an entity for which the
temporary needs to be bound, bind the copy object. Otherwise, we won't
end up calling the destructor for the copy. Fixes Boost.Optional.

llvm-svn: 102290
2010-04-25 00:55:24 +00:00
Anders Carlsson 53e1ba948d Revert enough of my patches to fix self-host again :(
llvm-svn: 102289
2010-04-25 00:52:09 +00:00
Douglas Gregor 9556257252 When we create a temporary of class type that we don't immediately
bind, check accessibility of the destructor and mark the declaration
as referenced. Fixes a bunch of Boost.Regex failures.

llvm-svn: 102287
2010-04-24 23:45:46 +00:00
Anders Carlsson dde8b46e62 Cleanup SynthesizeCXXCopyConstructor.
llvm-svn: 102286
2010-04-24 23:11:18 +00:00
Anders Carlsson 84e3b62ac0 Clean up SynthesizeCXXCopyAssignment a little.
llvm-svn: 102285
2010-04-24 23:09:21 +00:00
Anders Carlsson c4ba0cd2ea RenameGetAddressOfBaseOfCompleteClass to GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases.
llvm-svn: 102284
2010-04-24 23:01:49 +00:00
Anders Carlsson 36db0d9c47 Add an explicit UsuallyTinyPtrVector that takes a single element.
llvm-svn: 102283
2010-04-24 22:54:32 +00:00
Anders Carlsson 26b6e23d57 More cleanup.
llvm-svn: 102282
2010-04-24 22:43:39 +00:00
Anders Carlsson 9523ad4fd3 Simplify EmitClassMemberwiseCopy now that it's only used for fields.
llvm-svn: 102281
2010-04-24 22:36:50 +00:00
Nick Lewycky 0a7de38a22 Switch this to new API.
llvm-svn: 102280
2010-04-24 22:31:36 +00:00
Anders Carlsson 90235beb55 DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).
llvm-svn: 102279
2010-04-24 22:25:18 +00:00
Anders Carlsson af13c7bea9 When building implicit base initializers, add a derived-to-base cast that points to the exact base specifier.
llvm-svn: 102277
2010-04-24 22:02:54 +00:00
Anders Carlsson bea9e74e82 Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.
llvm-svn: 102275
2010-04-24 21:51:08 +00:00
Anders Carlsson 795213efde Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to use the new version.
llvm-svn: 102274
2010-04-24 21:27:51 +00:00
Anders Carlsson 8a64c1c94c Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.
llvm-svn: 102273
2010-04-24 21:23:59 +00:00
Anders Carlsson c6eaea70af Convert more call sites over to the new GetAddressOfBaseClass.
llvm-svn: 102272
2010-04-24 21:12:55 +00:00
Douglas Gregor d5c231e745 When we attempt to create a temporary object of class type, be sure
that the type we're copying is complete. 

Boost.Regex now builds, although it's failing its regression tests
with our favorite "Sema doesn't consider destructor as used."
assertion.

llvm-svn: 102271
2010-04-24 21:09:25 +00:00
Anders Carlsson d829a02514 Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.
llvm-svn: 102270
2010-04-24 21:06:20 +00:00
Douglas Gregor c779e99540 When we are performing copy initialization of a class type via its
copy constructor, suppress user-defined conversions on the
argument. Otherwise, we can end up in a recursion loop where the
bind the argument of the copy constructor to another copy constructor call,
whose argument is then a copy constructor call...

Found by Boost.Regex which, alas, still isn't building.

llvm-svn: 102269
2010-04-24 20:54:38 +00:00
Daniel Dunbar cfc12ddb0a Headers: Hide intptr_t and uintptr_t definitions behind _INTPTR_T and _UINTPTR_T
defines, for increased compatibility with Darwin gcc.
 - This is a bit of a hack, since platform compatibility issues don't belong
   here, but I don't think this hurts anyone either.

llvm-svn: 102264
2010-04-24 20:32:12 +00:00
Benjamin Kramer 20f2d4382f Fix pasto, add a comment.
llvm-svn: 102263
2010-04-24 20:26:20 +00:00