Anders Carlsson [Mon, 29 Mar 2010 01:28:05 +0000 (01:28 +0000)]
Make sure to sort the vtable thunks by their vtable index :) With this we now pass the test from http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor successfully.
Anders Carlsson [Sun, 28 Mar 2010 20:34:31 +0000 (20:34 +0000)]
More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.
Douglas Gregor [Sun, 28 Mar 2010 02:42:43 +0000 (02:42 +0000)]
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.
John McCall [Sat, 27 Mar 2010 06:55:49 +0000 (06:55 +0000)]
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. :)
John McCall [Sat, 27 Mar 2010 00:47:27 +0000 (00:47 +0000)]
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.
Douglas Gregor [Fri, 26 Mar 2010 22:43:07 +0000 (22:43 +0000)]
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.
Daniel Dunbar [Fri, 26 Mar 2010 22:41:03 +0000 (22:41 +0000)]
Driver/Darwin: Support CCC_ENABLE_NEW_DARWIN_TOOLCHAIN as an environment
override to enable use of the DarwinClang tool chain on all platforms (not just
ARM).
John McCall [Fri, 26 Mar 2010 21:56:38 +0000 (21:56 +0000)]
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.
Douglas Gregor [Fri, 26 Mar 2010 20:59:55 +0000 (20:59 +0000)]
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.
Douglas Gregor [Fri, 26 Mar 2010 20:35:59 +0000 (20:35 +0000)]
Eliminate the non-InitializedEntity PerformCopyInitialization() and
re-route its only caller to the newer
PerformCopyInitialization(). We're down to one remaining caller of
Sema::CheckReferenceInit.
Douglas Gregor [Fri, 26 Mar 2010 05:50:28 +0000 (05:50 +0000)]
When deducing an integral template argument for a non-type template
parameter, keep the integral value exactly as it was in the source
code rather than trying to convert it to the type of the non-type
template parameter (which may still be dependent!). The value will
then be converted to the appropriate type once we check the resulting
template arguments. Fixes PR6707.
Douglas Gregor [Fri, 26 Mar 2010 02:38:37 +0000 (02:38 +0000)]
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.
Douglas Gregor [Thu, 25 Mar 2010 22:21:04 +0000 (22:21 +0000)]
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:100: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;
^
Douglas Gregor [Thu, 25 Mar 2010 22:17:48 +0000 (22:17 +0000)]
Teach the diagnostic engine to provide more detailed information about
how to handle a diagnostic during template argument deduction, which
may be "substitution failure", "suppress", or "report". This keeps us
from, e.g., emitting warnings while performing template argument
deduction.
John McCall [Thu, 25 Mar 2010 22:08:03 +0000 (22:08 +0000)]
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.
John McCall [Thu, 25 Mar 2010 21:39:55 +0000 (21:39 +0000)]
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.
John McCall [Thu, 25 Mar 2010 21:28:06 +0000 (21:28 +0000)]
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.
Daniel Dunbar [Thu, 25 Mar 2010 17:13:09 +0000 (17:13 +0000)]
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.
Douglas Gregor [Thu, 25 Mar 2010 15:38:42 +0000 (15:38 +0000)]
Improve our handling of local instantiation scopes in two related ways:
- When substituting template arguments as part of template argument
deduction, introduce a new local instantiation scope.
- When substituting into a function prototype type, introduce a new
"temporary" local instantiation scope that merges with its outer
scope but also keeps track of any additions it makes, removing
them when we exit that scope.
Fixes PR6700, where we were getting too much mixing of local
instantiation scopes due to template argument deduction that
substituted results into function types.
Anders Carlsson [Thu, 25 Mar 2010 15:26:28 +0000 (15:26 +0000)]
When -fdump-vtable-layouts is specified, construction vtable initializers will be generated using the new vtable layout code. (The code is still not completely in place but this is a huge step forward).
John McCall [Thu, 25 Mar 2010 06:39:04 +0000 (06:39 +0000)]
Properly instantiate friend class template declarations and link them into
the redeclaration chain. Recommitted from r99477 with a fix: we need to
merge in default template arguments from previous declarations.
Bob Wilson [Thu, 25 Mar 2010 04:40:43 +0000 (04:40 +0000)]
Revert 99477 since it appears to be breaking the clang-x86_64-darwin10-fnt
buildbot. The tramp3d test fails.
--- Reverse-merging r99477 into '.':
U test/SemaTemplate/friend-template.cpp
U test/CXX/temp/temp.decls/temp.friend/p1.cpp
U lib/Sema/SemaTemplateInstantiateDecl.cpp
U lib/Sema/SemaAccess.cpp
Ted Kremenek [Thu, 25 Mar 2010 03:59:12 +0000 (03:59 +0000)]
Fix two bugs in format-string checking:
(1) Do not assume the data arguments start after the format string
(2) Do not use the fact that a function is variadic to treat it like a va_list printf function