diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-10-01 02:47:11 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-10-01 02:47:11 +0000 |
commit | 26bc70557cba0da863dfc19bb88f0db6613ec625 (patch) | |
tree | ee94433ea71d79f7aea859fbe2d8afb20b914a69 /lib/Analysis/CFG.cpp | |
parent | 0e97bcbee9d5f7735edecbccfb5031a2f065f286 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115269 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index a60c3a6b01..4cf0264003 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -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; } |