aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Swiderski <marcin.sfider@gmail.com>2010-10-01 00:31:22 +0000
committerMarcin Swiderski <marcin.sfider@gmail.com>2010-10-01 00:31:22 +0000
commit63426e5df054d04226a5456d17d26212d8eff30e (patch)
treed3a74e912d606c5f7b054a6de881658a132300be
parent2f8c898c4215c77602426ff09c86ea0059bb3553 (diff)
Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked type does not have to represent C++ class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115254 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/CFG.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index a4e24f8b9f..33e0ff94c2 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -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);