Граф коммитов

21553 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor e7089b0c6f When computing the template arguments for the instantiation of a
friend function template, be sure to adjust the computed template
argument lists based on the location of the definition of the function
template: it's possible that the definition we're instantiating with
and the template declaration that we found when creating the
specialization are in different contexts, which meant that we would
end up using the wrong template arguments for instantiation.

Fixes PR7013; all Boost.DynamicBitset tests now pass.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 23:29:10 +00:00
John McCall e65ce966b6 Just bail out immediately when emitting an unreachable function-local static
variable.  Surprisingly, this does seem to be the right way to solve this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102961 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:39:56 +00:00
Fariborz Jahanian a36f3ed3f1 Test for my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:06:59 +00:00
Fariborz Jahanian d8d3441911 For the sake of Objective-c++ overload resolution,
treat argument types of objective-c pointer types
which only differ in their protocol qualifiers as
the same type (radar 7925668).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:06:18 +00:00
Douglas Gregor f7d72f5a4a When instantiating a function-local variable definition, introduce the
mapping from the declaration in the template to the instantiated
declaration before transforming the initializer, in case some crazy
lunatic decides to use a variable in its own initializer. Fixes PR7016.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:22:41 +00:00
Ted Kremenek da5a428bf3 Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since they don't go in
the DeclContext for the translation unit.  This is to workaround a fundamental issue in how
ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:16:35 +00:00
Douglas Gregor e174bd05ca If we're generating code to create a pointer-to-member function
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102942 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:00:27 +00:00
Douglas Gregor 324b54d3f6 Diagnose unused exception parameters under a different warning group
(-Wunused-exception-parameter) than normal variables, since it's more
common to name and then ignore an exception parameter. This warning is
neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 18:51:14 +00:00
Douglas Gregor 4d9e7388cc Complain when we try to initialize an object of Objective-C class type
(which is ill-formed) with an initializer list. Also, change the
fallback from an assertion to a generic error message, which is far
friendlier. Fixes <rdar://problem/7730948>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 18:24:37 +00:00
Douglas Gregor 8fc6d236b8 It's okay to reference an enum in a template definition, even though
it's ill-formed to form an enum template. Fixes <rdar://problem/7933063>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 17:48:54 +00:00
Anders Carlsson 32897fd3bd When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 16:05:06 +00:00
Douglas Gregor 7362258bb8 Try to unbreak clang-i686-darawin10 builder
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:51:04 +00:00
Fariborz Jahanian 738698d9d2 Do not issue warning on unimplemented property in the class, if it
conforms to a protocol as one of its super classes does. This is because
conforming super class will implement the property. This implements 
new warning rules for unimplemented properties (radar 7884086).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:49:20 +00:00
Anders Carlsson 6cfb1ca37b Get rid of virt.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:49:15 +00:00
Anders Carlsson 48c950137e The array form of 'new' can never have initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:45:23 +00:00
Douglas Gregor 62b71f489e When creating the declaration reference for implicit copy-construction
of a base class, give it real source-location information. Fixes PR7017.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:43:53 +00:00
Douglas Gregor ae374759fc When declaring a namespace alias, ignore previous declarations that
aren't in scope. Fixes PR7014.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:37:31 +00:00
Douglas Gregor 6920cdce29 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:32:18 +00:00
Douglas Gregor fe60f84c4f When a class contains a non-empty anonymous union or struct, mark is
as non-empty. Fixes PR7021.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:18:25 +00:00
Anders Carlsson e99bdb6969 Don't build an aggregate constructor loop when the constructor is trivial.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102912 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:09:17 +00:00
Anders Carlsson 33d73fa9db Add test case that I forgot to check in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 14:22:40 +00:00
Benjamin Kramer d566381800 Replace a char*/size pair with stringref.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 13:08:54 +00:00
Anders Carlsson 28e9483a19 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 02:07:56 +00:00
Anders Carlsson 0d7c583a4b Don't copy or initialize empty classes. Fixes PR7012.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 01:20:20 +00:00
Anders Carlsson 3855a07db0 Store the entire base subobject in SubVTTIndices.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 00:55:11 +00:00
Anders Carlsson 43373963ac Remove OldGetAddressOfBaseClass - bye bye ambiguities.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 00:32:27 +00:00
Anders Carlsson 8246cc7f85 Get rid of the last caller of OldGetAddressOfBaseClass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102888 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 00:29:58 +00:00
Anders Carlsson 4235840554 More work towards getting rid of OldGetAddressOfBaseClass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102887 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 00:07:07 +00:00
Anders Carlsson 77fae58f6d Get rid of a call to GetAddressOfDirectBaseInCompleteClass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102886 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:57:15 +00:00
Anders Carlsson c11bb21910 Have getSubVTTIndex take a BaseSubobject instead of just a base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:53:25 +00:00
Anders Carlsson fcaeef2ae0 Change CXXConstructExpr::Create to take a ConstructionKind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:53:04 +00:00
Anders Carlsson 314e622d20 Pass ForVirtualBase all the way to GetVTTParameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:33:10 +00:00
Anders Carlsson 8e6404ca28 Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:29:11 +00:00
Anders Carlsson 155ed4a233 Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:20:53 +00:00
Anders Carlsson 24eb78e38a Pass the construction kind down to EmitCXXConstructorCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:01:10 +00:00
Anders Carlsson 72e96fd181 Add an enum to CXXConstructExpr so we can determine if the construction expression constructs a non-virtual or virtual base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 22:54:08 +00:00
Anders Carlsson 82929316cc Remove another unused function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 18:13:35 +00:00
Anders Carlsson 05dd1f6292 Remove an unused function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 18:12:22 +00:00
Benjamin Kramer 81bf3b3566 CodeGen: Shrink RValue. 4 words -> 2 words.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102863 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 14:59:10 +00:00
David Chisnall 4b02afcb45 As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 13:41:58 +00:00
Douglas Gregor 06a9f3680d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 20:49:11 +00:00
Chris Lattner 4c50b697bb fix a broken link, diagnostickinds.td was fissioned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 17:35:19 +00:00
Anders Carlsson bfe7e91c12 Simplify EmitCopyCtorCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102849 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 17:07:40 +00:00
Anders Carlsson 43db20e955 Simplify EmitClassAggrMemberwiseCopy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 17:02:18 +00:00
Douglas Gregor e2e69ef80a Bump default template instantiation depth to 1024, as required by C++0x
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102847 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 16:59:21 +00:00
Anders Carlsson f62756f45b Clean up EmitClassMemberwiseCopy further.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 16:54:05 +00:00
Anders Carlsson 1d1d1185b4 Get rid of a parameter from EmitClassMemberwiseCopy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 16:49:43 +00:00
Anders Carlsson 59b7f1538d When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 16:39:01 +00:00
Douglas Gregor 39957dce3d 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102840 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 15:04:51 +00:00
David Chisnall 63e742bed9 Attach message send metadata to the lookup as well as to the call (GNU runtime).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 12:56:56 +00:00