Commit Graph

6814 Commits

Author SHA1 Message Date
Anders Carlsson 83ac312965 Fix a bug where we would incorrectly report an error about initializing two fields in an anonymous struct.
llvm-svn: 99891
2010-03-30 16:19:37 +00:00
Anders Carlsson 9d08fc1cd2 Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.
llvm-svn: 99867
2010-03-30 03:30:08 +00:00
Anders Carlsson 10834b8d56 Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.
llvm-svn: 99864
2010-03-30 02:57:48 +00:00
Anders Carlsson c3a4b12c82 Change a test to FileCheck bitcode instead of assembler.
llvm-svn: 99863
2010-03-30 02:53:30 +00:00
Anders Carlsson 85e64359df Flip the switch and use the new vtable layout code for everything. I've verified that this passes a self-host but I'll let the bots self host as well before removing the now dead code.
llvm-svn: 99861
2010-03-30 02:21:54 +00:00
Anders Carlsson e47380fb19 When collecting virtual bases it's very important to use the canonical type of the base class. Otherwise, we might add the same virtual base class twice if the virtual base is an instantiated template. Fixes PR6251.
llvm-svn: 99829
2010-03-29 19:49:09 +00:00
Chris Lattner bf2803fb20 add support for -MQ flag to quote targets in dependency file,
PR6661, patch by Ori Avtalion!

llvm-svn: 99821
2010-03-29 17:55:58 +00:00
Anders Carlsson eba1a60ef0 Another vtable layout fix, making us match gcc better.
llvm-svn: 99812
2010-03-29 15:08:41 +00:00
Douglas Gregor c48a10d652 Support __attribute__((packed)) (along with other attributes) at the
end of a struct/class/union in C++, from Justin Bogner!

llvm-svn: 99811
2010-03-29 14:42:08 +00:00
Anders Carlsson abb20e6249 Fix a nasty bug in the virtual base computation which would lead to us initializing virtual bases in the wrong order.
llvm-svn: 99806
2010-03-29 05:13:12 +00:00
Douglas Gregor d5cb1ddb2c After performing template argument deduction for a function template,
check deduced non-type template arguments and template template
arguments against the template parameters for which they were deduced,
performing conversions as appropriate so that deduced template
arguments get the same treatment as explicitly-specified template
arguments. This is the bulk of PR6723.

Also keep track of whether deduction of a non-type template argument
came from an array bound (vs. anywhere else). With this information,
we enforce C++ [temp.deduct.type]p17, which requires exact type
matches when deduction deduces a non-type template argument from
something that is not an array bound.

Finally, when in a SFINAE context, translate the "zero sized
arrays are an extension" extension diagnostic into a hard error (for
better standard conformance), which was a minor part of PR6723.

llvm-svn: 99734
2010-03-28 02:42:43 +00:00
Fariborz Jahanian 2e8074bfc3 Further improvement to point to category
whose protocolls methods needs implementation.

llvm-svn: 99730
2010-03-27 21:10:05 +00:00
Anders Carlsson 174376629a Give thunks the same linkage as their original methods.
llvm-svn: 99729
2010-03-27 20:50:27 +00:00
Fariborz Jahanian 97752f7c95 Improve diagnostics on incomplete implementation
of objc classes; including which methods
need be implemented and where they come from.
WIP.

llvm-svn: 99724
2010-03-27 19:02:17 +00:00
John McCall 3dc81f77f6 Accumulate all functions and classes that the effective context is
nested within, and suddenly local classes start working.  Wouldn't be
necessary if I hadn't used local classes in Clang in the first place.
Or, well, wouldn't be necessary yet. :)

llvm-svn: 99709
2010-03-27 06:55:49 +00:00
John McCall 2f88d7d72c Implement method friends in class templates and fix a few related problems.
llvm-svn: 99708
2010-03-27 05:57:59 +00:00
Rafael Espindola 6e281ffdc0 Test for the previous commit.
llvm-svn: 99702
2010-03-27 02:52:40 +00:00
John McCall 39ec71f2e9 When mapping restrict to noalias, look for 'restrict' on the parameter variable
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers).  Fixes PR6695.

llvm-svn: 99688
2010-03-27 00:47:27 +00:00
John McCall 30837102a2 Put function templates instantiated from friend declarations in the correct
lexical context.  This is required for ADL to work properly;  fixes PR6716.

llvm-svn: 99665
2010-03-26 23:10:15 +00:00
Douglas Gregor 4667effa8b Compare namespaces properly when looking for redeclarations of
namespace aliases. Fixes PR6341.

llvm-svn: 99664
2010-03-26 22:59:39 +00:00
Ted Kremenek 0f250e4c5b Fix NoReturnFunctionChecker to properly look at a function's type
when determining if it returns.  Fixes <rdar://problem/7796563>.

llvm-svn: 99663
2010-03-26 22:57:13 +00:00
Douglas Gregor c14922f14a When adding initializers to a constructor, be sure that we are looking
through the bases and fields of the definition of the class in which
the constructor is declared, rather than some other declaration of
that class.

llvm-svn: 99661
2010-03-26 22:43:07 +00:00
John McCall 93cc732ffc Properly account for redeclarations when explicitly instantiating class templates.
What happens here is that we actually turn the first declaration into a
definition, regardless of whether it was actually originally a definition,
and furthermore we do this all after we've instantiated all the declarations.
This exposes a bug in my DefinitionData patch where it was only setting the
DefinitionData for previous declarations, not future declarations.
Fortunately, there's an iterator for that.

llvm-svn: 99657
2010-03-26 21:56:38 +00:00
Douglas Gregor f9edf80c39 When trying to determine whether one operand of a conditional
expression can be converted to the type of another, only apply the
lvalue-to-rvalue conversion to the type of the expression we're
converting, *not* the array-to-pointer or function-to-pointer
conversions. Fixes PR6595.

llvm-svn: 99652
2010-03-26 20:59:55 +00:00
Daniel Dunbar e17606d513 Make sure we don't include mm_malloc.h in this test, it includes errno.h which
we aren't always able to find on Win32.

llvm-svn: 99649
2010-03-26 20:17:23 +00:00
Douglas Gregor 838fcc318a Switch semantic analysis of the conditional operator from using
CheckReferenceInit to using the new initialization sequence code.

llvm-svn: 99647
2010-03-26 20:14:36 +00:00
Daniel Dunbar 16204101df Spell -triple correctly for %clang, not %clang_cc1.
llvm-svn: 99634
2010-03-26 19:02:07 +00:00
Chris Lattner 445a2c7b5c i386-apple-darwin10 implies sse2, this option shouldn't be needed.
llvm-svn: 99627
2010-03-26 17:51:13 +00:00
Chris Lattner 8c5d05a299 fix a case where macro expansion should be disabled, patch by
Abramo Bagnara!

llvm-svn: 99626
2010-03-26 17:49:16 +00:00
Chris Lattner cebeab9f8c merge all the macro disable tests by using filecheck.
llvm-svn: 99625
2010-03-26 17:46:33 +00:00
Chris Lattner 80dbccd1bf fix a bug in paste avoidance which would cause us to accidentally
form a >>=.  Patch by Abramo Bagnara, testcase by me.

llvm-svn: 99624
2010-03-26 17:10:02 +00:00
Chris Lattner 6efe46cced xmmintrin just requires sse2, not sse3.
llvm-svn: 99623
2010-03-26 17:05:16 +00:00
Gabor Greif 7da63a36f1 add a slight variation of test3, where
argument list seems to be different, but in fact
is semantically equivalent; check that we do not error here

llvm-svn: 99617
2010-03-26 08:26:30 +00:00
Nick Lewycky 3cfe6af8b5 Implement new mangling for vectors.
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Douglas Gregor f956b35f98 Do not mark the destructor of a function parameter's type. Fixes PR6709.
llvm-svn: 99615
2010-03-26 06:57:13 +00:00
Douglas Gregor d829eab92b Add tests for PR6707.
llvm-svn: 99613
2010-03-26 05:57:46 +00:00
John McCall e0b2ddb492 Reapply r99596 with a fix: link an instantiated friend function to its
pattern if it has a body.

llvm-svn: 99610
2010-03-26 04:53:08 +00:00
John McCall 1a78217721 Apparently that didn't work. Reverting for now.
llvm-svn: 99601
2010-03-26 02:38:45 +00:00
Douglas Gregor bb3d786213 Reinstate change to non-type template arguments of integral type, so
that we extend/truncate then correct the sign to convert the non-type
template argument to the template parameter's type. Previously, we
reported an error when the non-type template argument was out of
range; now we just warn.

llvm-svn: 99600
2010-03-26 02:38:37 +00:00
John McCall a5beaf6958 Properly instantiate and link in friend function templates.
llvm-svn: 99596
2010-03-26 02:05:14 +00:00
Ted Kremenek c5260901e9 Update test case since c-index-test now works on invalid sources.
llvm-svn: 99595
2010-03-26 01:34:53 +00:00
Douglas Gregor a14cb9fd38 Revert attempted fix for integral template arguments. It seems to have broken tramp3d-v4.
llvm-svn: 99583
2010-03-26 00:39:40 +00:00
Douglas Gregor 63eed63312 Warn when the conversion of an integral non-type template argument to
the type of its corresponding non-type template parameter changes the
value. Previously, we were diagnosing this as an error, which was
wrong. We give reasonably nice warnings like:

test/SemaTemplate/temp_arg_nontype.cpp💯10: warning: non-type template
      argument value '256' truncated to '0' for template parameter of type
      'unsigned char'
Overflow<256> *overflow3; // expected-warning{{non-type template ...
         ^~~
test/SemaTemplate/temp_arg_nontype.cpp:96:24: note: template parameter is
      declared here
template<unsigned char C> struct Overflow;
                       ^

llvm-svn: 99561
2010-03-25 22:21:04 +00:00
John McCall e99d5f3044 When finishing a function definition, leave the function definition *after*
doing all the cleanup tasks and checks.  This gives us the proper context for
checking access to base and member destructors.

llvm-svn: 99559
2010-03-25 22:08:03 +00:00
Fariborz Jahanian f9c4585c80 Fix a code gen. bug involving generation of getter method
from properties of _Complex type. (radar 7351147).

llvm-svn: 99558
2010-03-25 21:56:43 +00:00
Anders Carlsson 151b062fee Don't add address points for virtual primary bases that aren't primary bases in the complete class.
llvm-svn: 99555
2010-03-25 21:45:14 +00:00
John McCall 27e70baa55 Fix a very minor oversight in privileges-elevation: we were only considering
friendship for a derived class if the base class specifier was non-public,
and thus not considering friendship for non-public members of public bases.

llvm-svn: 99554
2010-03-25 21:39:55 +00:00
John McCall e9eaf8e0f8 Handle simple friend-class decls in class templates better by ensuring that
we look for shadow friend decls in the appropriate scope before injecting
a new declaration.

llvm-svn: 99552
2010-03-25 21:28:06 +00:00
Fariborz Jahanian bb4978fbae Check for some code gen. for PR6641 test.
llvm-svn: 99526
2010-03-25 18:05:35 +00:00
Daniel Dunbar 3f540c0d7d Remove support for nand atomic builtins. They are inconsistently implemented in
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.

llvm-svn: 99522
2010-03-25 17:13:09 +00:00