forked from OSchip/llvm-project
The old logic would add non-struct and non C++ struct variables to the local
scope. Now we only add C++ struct with non-trivial destructor variables to the local scope. llvm-svn: 115269
This commit is contained in:
parent
f51de67640
commit
ea360a3b1a
|
@ -566,13 +566,12 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
|
|||
// Check if type is a C++ class with non-trivial destructor.
|
||||
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);
|
||||
Scope->addVar(VD);
|
||||
ScopePos = Scope->begin();
|
||||
if (!CD->hasTrivialDestructor()) {
|
||||
// Add the variable to scope
|
||||
Scope = createOrReuseLocalScope(Scope);
|
||||
Scope->addVar(VD);
|
||||
ScopePos = Scope->begin();
|
||||
}
|
||||
return Scope;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue