Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked type does not have to represent C++ class.

llvm-svn: 115254
This commit is contained in:
Marcin Swiderski 2010-10-01 00:31:22 +00:00
parent ef1fb2d1d1
commit e84cb97997
1 changed files with 4 additions and 3 deletions

View File

@ -564,9 +564,10 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
}
// Check if type is a C++ class with non-trivial destructor.
const RecordType* RT = QT.getTypePtr()->getAs<RecordType>();
if (!RT || cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor())
return Scope;
if (const RecordType* RT = QT.getTypePtr()->getAs<RecordType>())
if (const CXXRecordDecl* CD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
if (CD->hasTrivialDestructor())
return Scope;
// Add the variable to scope
Scope = createOrReuseLocalScope(Scope);