aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-10-01 03:00:16 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-10-01 03:00:16 +0000
commit02acdfaeb3f3805b65e4707e5dff096209adb367 (patch)
tree6f8391f7dd7e6fb07e7d1e539bc3dc4f5df61454
parent26bc70557cba0da863dfc19bb88f0db6613ec625 (diff)
Simplify interface for addLocalScopeForStmt().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115270 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/CFG.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index 4cf0264003..7afdb02cea 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -310,7 +310,7 @@ private:
// Local scopes creation.
LocalScope* createOrReuseLocalScope(LocalScope* Scope);
- LocalScope* addLocalScopeForStmt(Stmt* S, LocalScope* Scope = NULL);
+ void addLocalScopeForStmt(Stmt* S);
LocalScope* addLocalScopeForDeclStmt(DeclStmt* DS, LocalScope* Scope = NULL);
LocalScope* addLocalScopeForVarDecl(VarDecl* VD, LocalScope* Scope = NULL);
@@ -493,11 +493,12 @@ LocalScope* CFGBuilder::createOrReuseLocalScope(LocalScope* Scope) {
}
/// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement
-/// that should create implicit scope (e.g. if/else substatements). Will reuse
-/// Scope if not NULL.
-LocalScope* CFGBuilder::addLocalScopeForStmt(Stmt* S, LocalScope* Scope) {
+/// that should create implicit scope (e.g. if/else substatements).
+void CFGBuilder::addLocalScopeForStmt(Stmt* S) {
if (!BuildOpts.AddImplicitDtors)
- return Scope;
+ return;
+
+ LocalScope *Scope = 0;
// For compound statement we will be creating explicit scope.
if (CompoundStmt* CS = dyn_cast<CompoundStmt>(S)) {
@@ -509,7 +510,7 @@ LocalScope* CFGBuilder::addLocalScopeForStmt(Stmt* S, LocalScope* Scope) {
if (DeclStmt* DS = dyn_cast<DeclStmt>(SI))
Scope = addLocalScopeForDeclStmt(DS, Scope);
}
- return Scope;
+ return;
}
// For any other statement scope will be implicit and as such will be
@@ -517,8 +518,7 @@ LocalScope* CFGBuilder::addLocalScopeForStmt(Stmt* S, LocalScope* Scope) {
if (LabelStmt* LS = dyn_cast<LabelStmt>(S))
S = LS->getSubStmt();
if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
- Scope = addLocalScopeForDeclStmt(DS, Scope);
- return Scope;
+ addLocalScopeForDeclStmt(DS, 0);
}
/// addLocalScopeForDeclStmt - Add LocalScope for declaration statement. Will
@@ -582,7 +582,7 @@ void CFGBuilder::addLocalScopeAndDtors(Stmt* S) {
return;
LocalScope::const_iterator scopeBeginPos = ScopePos;
- addLocalScopeForStmt(S, NULL);
+ addLocalScopeForStmt(S);
addAutomaticObjDtors(ScopePos, scopeBeginPos, S);
}