Douglas Gregor [Tue, 9 Feb 2010 07:26:29 +0000 (07:26 +0000)]
Migrate the mish-mash of declaration checks in
Sema::ActOnUninitializedDecl over to InitializationSequence (with
default initialization), eliminating redundancy. More importantly, we
now check that a const definition in C++ has an initilizer, which was
an #if 0'd code for many, many months. A few other tweaks were needed
to get everything working again:
- Fix all of the places in the testsuite where we defined const
objects without initializers (now that we diagnose this issue)
- Teach instantiation of static data members to find the previous
declaration, so that we build proper redeclaration
chains. Previously, we had the redeclaration chain but built it
too late to be useful, because...
- Teach instantiation of static data member definitions not to try
to check an initializer if a previous declaration already had an
initializer. This makes sure that we don't complain about static
const data members with in-class initializers and out-of-line
definitions.
- Move all of the incomplete-type checking logic out of
Sema::FinalizeDeclaratorGroup; it makes more sense in
ActOnUnitializedDecl.
There may still be a few places where we can improve these
diagnostics. I'll address that as a separate commit.
Daniel Dunbar [Tue, 9 Feb 2010 02:48:28 +0000 (02:48 +0000)]
IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
Douglas Gregor [Tue, 9 Feb 2010 00:37:32 +0000 (00:37 +0000)]
Implement a specific diagnostic when a class template partial
specialization does not use any of its template parameters, then
recover far more gracefully. Fixes PR6181.
Douglas Gregor [Mon, 8 Feb 2010 23:41:45 +0000 (23:41 +0000)]
When substituting a declaration non-type template argument for a
non-type template parameter that has reference type, augment the
qualifiers of the non-type template argument with those of the
referenced type. Fixes PR6250.
John McCall [Mon, 8 Feb 2010 23:07:23 +0000 (23:07 +0000)]
Thread a source location into the template-argument deduction routines. There
may be some other places that could take advantage of this new information,
but I haven't really looked yet.
Douglas Gregor [Mon, 8 Feb 2010 22:59:26 +0000 (22:59 +0000)]
Eliminate a pointer of storage in each ObjCInterfaceType and
ObjCObjectPointerType AST node by allocating the list of protocols
after the type node itself. No functionality change.
Merge block/function pointer types with objc's __weak
attribute properly and avoid bogus warning. This is
an objective-c fix only. objective-c++ follows different code
pass and requires separate fix (which will come at a later time).
Fixes radar 7214820.
Douglas Gregor [Mon, 8 Feb 2010 21:09:39 +0000 (21:09 +0000)]
Implement basic importing and merging of variable declarations within
the AST importer. This doesn't actually do anything (yet), because we
don't have driver logic for merging ASTs.
Sebastian Redl [Mon, 8 Feb 2010 19:35:18 +0000 (19:35 +0000)]
When placing an annotation token over an existing annotation token, make sure that the new token's range extends to the end of the old token. Assert that in AnnotateCachedTokens. Fixes PR6248.
Require a complete type before examining base classes during template argument
deduction. This requires refactoring the deduction to have access to the Sema
object instead of merely the ASTContext. Still leaves something to be desired
due to poor source location.
Anders Carlsson [Sat, 6 Feb 2010 19:50:17 +0000 (19:50 +0000)]
If a constructor throws an exception we need to execute the destructors for all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite.
John McCall [Sat, 6 Feb 2010 10:23:53 +0000 (10:23 +0000)]
Use a substituted type when determining how to substitute in non-type template
params. Don't insert addrof operations when matching against a pointer;
array/function conversions should take care of this for us, assuming the
argument type-checked in the first place. Add a fixme where we seem to be
using a less-restrictive reference type than we should.
Douglas Gregor [Sat, 6 Feb 2010 05:15:45 +0000 (05:15 +0000)]
Switch CodeGen's "is this variable declaration a definition?" logic
over to VarDecl::isThisDeclarationADefinition(), which handles
variables declared with linkage specifications better (among other
things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat
functional.
Ted Kremenek [Sat, 6 Feb 2010 03:57:59 +0000 (03:57 +0000)]
Fix regression in RegionStore (from BasicStore) where static variables were not treated as being implicitly initialized to 0 (and instead were getting symbolicated).
John McCall [Sat, 6 Feb 2010 01:07:37 +0000 (01:07 +0000)]
Per discussion, remove the explicit restriction on static const data members with
out-of-line initializers as integer constant expressions. Fixes PR6206.
Douglas Gregor [Fri, 5 Feb 2010 22:49:09 +0000 (22:49 +0000)]
Fix a bogus assertion after adjusting the type of a substituted
non-type template argument for a non-type template parameter of
pointer type. Fixes PR6244.
Douglas Gregor [Fri, 5 Feb 2010 22:40:03 +0000 (22:40 +0000)]
Cope with finding the "instantiated" declaration when we are
type-checking within a template definition. In this case, the
"instantiated" declaration is just the declaration itself, found
within the current instantiation. Fixes PR6239.
John McCall [Fri, 5 Feb 2010 21:31:56 +0000 (21:31 +0000)]
Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
Ted Kremenek [Fri, 5 Feb 2010 21:28:51 +0000 (21:28 +0000)]
Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do
anything when Sema has issued an error. This matches the behavior in
RewriteObjC::HandleTranslationUnit().
Douglas Gregor [Fri, 5 Feb 2010 19:54:12 +0000 (19:54 +0000)]
Fix two issues with the substitution of template template parameters
when instantiating the declaration of a member template:
- Only check if the have a template template argument at a specific position
when we already know that we have template arguments at that level;
otherwise, we're substituting for a level-reduced template template
parameter.
- When trying to find an instantiated declaration for a template
template parameter, look into the instantiated scope. This was a
typo, where we had two checks for TemplateTypeParmDecl, one of
which should have been a TemplateTemplateParmDecl.
With these changes, tramp3d-v4 passes -fsyntax-only.