Mark dtors for parameter variables and eliminate some redundant type munging.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95079 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3798aaa..ea1f2f2 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3575,8 +3575,8 @@
QualType InitType = VDecl->getType();
while (const ArrayType *Array = Context.getAsArrayType(InitType))
InitType = Context.getBaseElementType(Array);
- if (InitType->isRecordType())
- FinalizeVarWithDestructor(VDecl, InitType);
+ if (const RecordType *Record = InitType->getAs<RecordType>())
+ FinalizeVarWithDestructor(VDecl, Record);
}
return;
@@ -3667,7 +3667,7 @@
else {
Var->setInit(Context,
MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
- FinalizeVarWithDestructor(Var, InitType);
+ FinalizeVarWithDestructor(Var, InitType->getAs<RecordType>());
}
} else {
Var->setInvalidDecl();