summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorMarcin Swiderski <marcin.sfider@gmail.com>2010-10-01 01:46:52 +0000
committerMarcin Swiderski <marcin.sfider@gmail.com>2010-10-01 01:46:52 +0000
commit3546b1aea1d64292b11ba18cdb9c9adb3b2dc15a (patch)
tree4332a6f95be11cd664742219a60d87f10afb82ae /clang/lib/Analysis
parent6d5ee0c7f9fc642fcff4690729925b5841b1c869 (diff)
downloadbcm5719-llvm-3546b1aea1d64292b11ba18cdb9c9adb3b2dc15a.tar.gz
bcm5719-llvm-3546b1aea1d64292b11ba18cdb9c9adb3b2dc15a.zip
Added generating CFGAutomaticObjDtors for exception variable in catch statement.
llvm-svn: 115266
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index ac49ca52ca4..a60c3a6b01c 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -2154,6 +2154,18 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
// CXXCatchStmt are treated like labels, so they are the first statement in a
// block.
+ // Save local scope position because in case of exception variable ScopePos
+ // won't be restored when traversing AST.
+ SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos);
+
+ // Create local scope for possible exception variable.
+ // Store scope position. Add implicit destructor.
+ if (VarDecl* VD = CS->getExceptionDecl()) {
+ LocalScope::const_iterator BeginScopePos = ScopePos;
+ addLocalScopeForVarDecl(VD);
+ addAutomaticObjDtors(ScopePos, BeginScopePos, CS);
+ }
+
if (CS->getHandlerBlock())
addStmt(CS->getHandlerBlock());
OpenPOWER on IntegriCloud