[cfe-commits] r81405 - /cfe/trunk/lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Wed Sep 9 16:58:30 PDT 2009
Author: dgregor
Date: Wed Sep 9 18:58:28 2009
New Revision: 81405
URL: http://llvm.org/viewvc/llvm-project?rev=81405&view=rev
Log:
Don't bother to perform any initialization for a variable declaration
of class type whose default constructor is trivial. Should un-break
testing on x86_64-pc-linux-gnu.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=81405&r1=81404&r2=81405&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Sep 9 18:58:28 2009
@@ -3283,6 +3283,8 @@
// thereof), the object shall be default-initialized; if the
// object is of const-qualified type, the underlying class type
// shall have a user-declared default constructor.
+ //
+ // FIXME: Diagnose the "user-declared default constructor" bit.
if (getLangOptions().CPlusPlus) {
QualType InitType = Type;
if (const ArrayType *Array = Context.getAsArrayType(Type))
@@ -3303,12 +3305,18 @@
IK_Default,
ConstructorArgs);
- if (!Constructor ||
- InitializeVarWithConstructor(Var, Constructor, InitType,
- move_arg(ConstructorArgs)))
+ // FIXME: Location info for the variable initialization?
+ if (!Constructor)
Var->setInvalidDecl();
- else
+ else {
+ // FIXME: Cope with initialization of arrays
+ if (!Constructor->isTrivial() &&
+ InitializeVarWithConstructor(Var, Constructor, InitType,
+ move_arg(ConstructorArgs)))
+ Var->setInvalidDecl();
+
FinalizeVarWithDestructor(Var, InitType);
+ }
}
}
}
More information about the cfe-commits
mailing list