Commit Graph

22537 Commits

Author SHA1 Message Date
Douglas Gregor 95c70ec678 When instantiating a member function declared via a typedef, don't try
to enter the instantiated parameter declarations into the local
instantiation scope; they can't be referenced anyway. Fixes PR7022.

llvm-svn: 102914
2010-05-03 15:32:18 +00:00
Douglas Gregor 456ad1a817 When a class contains a non-empty anonymous union or struct, mark is
as non-empty. Fixes PR7021.

llvm-svn: 102913
2010-05-03 15:18:25 +00:00
Anders Carlsson d040e6b25a Don't build an aggregate constructor loop when the constructor is trivial.
llvm-svn: 102912
2010-05-03 15:09:17 +00:00
Anders Carlsson 604f560c39 Add test case that I forgot to check in.
llvm-svn: 102905
2010-05-03 14:22:40 +00:00
Benjamin Kramer bebee84281 Replace a char*/size pair with stringref.
llvm-svn: 102902
2010-05-03 13:08:54 +00:00
Anders Carlsson c144bc226c Simplify.
llvm-svn: 102896
2010-05-03 02:07:56 +00:00
Anders Carlsson 16e94af67c Don't copy or initialize empty classes. Fixes PR7012.
llvm-svn: 102891
2010-05-03 01:20:20 +00:00
Anders Carlsson 8bdbb5be19 Store the entire base subobject in SubVTTIndices.
llvm-svn: 102890
2010-05-03 00:55:11 +00:00
Anders Carlsson f4da2cf20a Remove OldGetAddressOfBaseClass - bye bye ambiguities.
llvm-svn: 102889
2010-05-03 00:32:27 +00:00
Anders Carlsson c58fb552f3 Get rid of the last caller of OldGetAddressOfBaseClass.
llvm-svn: 102888
2010-05-03 00:29:58 +00:00
Anders Carlsson c4d0d0fed1 More work towards getting rid of OldGetAddressOfBaseClass.
llvm-svn: 102887
2010-05-03 00:07:07 +00:00
Anders Carlsson e089060fd0 Get rid of a call to GetAddressOfDirectBaseInCompleteClass.
llvm-svn: 102886
2010-05-02 23:57:15 +00:00
Anders Carlsson 859b3064cb Have getSubVTTIndex take a BaseSubobject instead of just a base.
llvm-svn: 102885
2010-05-02 23:53:25 +00:00
Anders Carlsson edea1de7c4 Change CXXConstructExpr::Create to take a ConstructionKind.
llvm-svn: 102884
2010-05-02 23:53:04 +00:00
Anders Carlsson 4d205ba87f Pass ForVirtualBase all the way to GetVTTParameter.
llvm-svn: 102883
2010-05-02 23:33:10 +00:00
Anders Carlsson f8a71f08d1 Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
llvm-svn: 102882
2010-05-02 23:29:11 +00:00
Anders Carlsson e11f9ce9dc Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
llvm-svn: 102881
2010-05-02 23:20:53 +00:00
Anders Carlsson 4c638f1217 Pass the construction kind down to EmitCXXConstructorCall.
llvm-svn: 102880
2010-05-02 23:01:10 +00:00
Anders Carlsson bcc066b659 Add an enum to CXXConstructExpr so we can determine if the construction expression constructs a non-virtual or virtual base.
llvm-svn: 102879
2010-05-02 22:54:08 +00:00
Anders Carlsson 245820b9d9 Remove another unused function.
llvm-svn: 102871
2010-05-02 18:13:35 +00:00
Anders Carlsson 54eb4843b1 Remove an unused function.
llvm-svn: 102870
2010-05-02 18:12:22 +00:00
Benjamin Kramer 2718b4d757 CodeGen: Shrink RValue. 4 words -> 2 words.
llvm-svn: 102863
2010-05-02 14:59:10 +00:00
David Chisnall ff5f88c38e As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.
llvm-svn: 102862
2010-05-02 13:41:58 +00:00
Douglas Gregor b139cd5843 Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators. 

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

  - For a class subobject, call the appropriate copy-assignment
    operator, after overload resolution has determined what that is.
  - For an array of scalar types or an array of class types that have
    trivial copy assignment operators, construct a call to
    __builtin_memcpy.
  - For an array of class types with non-trivial copy assignment
    operators, synthesize a (possibly nested!) for loop whose inner
    statement calls the copy constructor.
  - For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.

llvm-svn: 102853
2010-05-01 20:49:11 +00:00
Chris Lattner ef8c6e8ba7 fix a broken link, diagnostickinds.td was fissioned.
llvm-svn: 102851
2010-05-01 17:35:19 +00:00
Anders Carlsson b136e626ea Simplify EmitCopyCtorCall.
llvm-svn: 102849
2010-05-01 17:07:40 +00:00
Anders Carlsson aab3b57359 Simplify EmitClassAggrMemberwiseCopy.
llvm-svn: 102848
2010-05-01 17:02:18 +00:00
Douglas Gregor 1af7cc2830 Bump default template instantiation depth to 1024, as required by C++0x
llvm-svn: 102847
2010-05-01 16:59:21 +00:00
Anders Carlsson ab826ad169 Clean up EmitClassMemberwiseCopy further.
llvm-svn: 102846
2010-05-01 16:54:05 +00:00
Anders Carlsson 820022c55c Get rid of a parameter from EmitClassMemberwiseCopy.
llvm-svn: 102845
2010-05-01 16:49:43 +00:00
Anders Carlsson 7911150a3d When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.
llvm-svn: 102842
2010-05-01 16:39:01 +00:00
Douglas Gregor a57478e8f6 Added an RAII object that helps set up/tear down the Sema context
information required to implicitly define a C++ special member
function. Use it rather than explicitly setting CurContext on entry
and exit, which is fragile. 

Use this RAII object for the implicitly-defined default constructor,
copy constructor, copy assignment operator, and destructor.

llvm-svn: 102840
2010-05-01 15:04:51 +00:00
David Chisnall c0cf422d56 Attach message send metadata to the lookup as well as to the call (GNU runtime).
llvm-svn: 102839
2010-05-01 12:56:56 +00:00
David Chisnall ea529a43d4 Make super message lookups cacheable (GNUstep Runtime)
llvm-svn: 102837
2010-05-01 12:37:16 +00:00
David Chisnall 9eecafa480 Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.
Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.

llvm-svn: 102833
2010-05-01 11:15:56 +00:00
Chris Lattner 036078ca76 with recent optimizer changes, these all get devirtualized.
llvm-svn: 102825
2010-05-01 01:42:06 +00:00
John McCall 0b66eb38c7 It turns out that basically every caller to RequireCompleteDeclContext
already knows what context it's looking in.  Just pass that context in
instead of (questionably) recalculating it.

llvm-svn: 102818
2010-05-01 00:40:08 +00:00
Daniel Dunbar 832fc4a098 Fix NON_ANSI_COMPILE_FLAGS setting, for MSVC.
llvm-svn: 102811
2010-05-01 00:06:42 +00:00
Ted Kremenek bc1416dcad Add null check in CFGBuilder::VisitStmt() to make CFG construction
more resilient to bad code.

llvm-svn: 102793
2010-04-30 22:25:53 +00:00
Daniel Dunbar d5a2a073a0 Rename 'CIndex' to 'libclang', since it has basically become our stable public
(C) API, and will likely grow further in this direction in the future.

llvm-svn: 102779
2010-04-30 21:51:10 +00:00
Ted Kremenek b802192a7e Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when a
fatal error has occurred.

llvm-svn: 102778
2010-04-30 21:49:25 +00:00
Douglas Gregor fabf95d066 After substituting a template argument for a non-type template
parameter with pointer-to-member type, we may have to perform a
qualification conversion, since the pointee type of the parameter
might be more qualified than the pointee type of the argument we form
from the declaration. Fixes PR6986.

llvm-svn: 102777
2010-04-30 21:46:38 +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
Douglas Gregor 0be628ff64 Fix a thinko that caused us not to compute __builtin_offset as a
constant expression in C. 

llvm-svn: 102762
2010-04-30 20:35:01 +00:00
Douglas Gregor 0925fbc3fd Teach clang_getLocation() to cope with a NULL file argument.
llvm-svn: 102748
2010-04-30 19:45:53 +00:00
Anders Carlsson d6c5391cd9 Remove an unnecessary parameter from EmitClassCopyAssignment.
llvm-svn: 102747
2010-04-30 19:45:28 +00:00
Douglas Gregor 14cf752486 Clean up our handling of local instantiation scopes, which keep track
of the mapping from local declarations to their instantiated
counterparts during template instantiation. Previously, we tried to do
some unholy merging of local instantiation scopes that involved
storing a single hash table along with an "undo" list on the
side... which was ugly, and never handled function parameters
properly.

Now, we just keep separate hash tables for each local instantiation
scope, and "combining" two scopes means that we'll look in each of the
combined hash tables. The combined scope stack is rarely deep, and
this makes it easy to avoid the "undo" issues we were hitting. Also,
I've simplified the logic for function parameters: if we're declaring
a function and we need the function parameters to live longer, we just
push them back into the local instantiation scope where we need them. 

Fixes PR6990.

llvm-svn: 102732
2010-04-30 18:55:50 +00:00
Daniel Dunbar 9f84c7b600 Move include installation steps to better location, inside each include dir instead of at the top-level.
Also, don't set NO_INSTALL=1 for c-index-test.

llvm-svn: 102724
2010-04-30 17:59:38 +00:00
David Chisnall d6a6af6a53 Fixed incorrect type of alloca (GNU runtime).
llvm-svn: 102711
2010-04-30 13:36:12 +00:00
Abramo Bagnara 5009937f47 Add calling convention related attributes to related declaration. Mark attributes invalid on type related checking so to add them to declarations only when everything is ok.
llvm-svn: 102710
2010-04-30 13:10:51 +00:00