From 63426e5df054d04226a5456d17d26212d8eff30e Mon Sep 17 00:00:00 2001 From: Marcin Swiderski Date: Fri, 1 Oct 2010 00:31:22 +0000 Subject: [PATCH] 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 --- lib/Analysis/CFG.cpp | 7 ++++--- 1 file 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(); - if (!RT || cast(RT->getDecl())->hasTrivialDestructor()) - return Scope; + if (const RecordType* RT = QT.getTypePtr()->getAs()) + if (const CXXRecordDecl* CD = dyn_cast(RT->getDecl())) + if (CD->hasTrivialDestructor()) + return Scope; // Add the variable to scope Scope = createOrReuseLocalScope(Scope); -- 2.40.0