aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-03-13 15:38:40 +0000
committerSteve Naroff <snaroff@apple.com>2009-03-13 15:38:40 +0000
commitcaaacecb2b64e6d2e402533baffda4cb540f4145 (patch)
treee7a2837c8d3b6aa2df6b1ecaa00f2f809e0c64f5 /lib/Sema/SemaStmt.cpp
parent610e81d6b7248ce4be4be2252b03a5d4052c9835 (diff)
Remove ActiveScope (revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741).
Will replace with something better today... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 32d295772c..f8e225540b 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -169,19 +169,12 @@ Action::OwningStmtResult
Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
SourceLocation ColonLoc, StmtArg subStmt) {
Stmt *SubStmt = static_cast<Stmt*>(subStmt.release());
-
// Look up the record for this label identifier.
- Scope::LabelMapTy::iterator I = ActiveScope->LabelMap.find(II);
+ LabelStmt *&LabelDecl = LabelMap[II];
- LabelStmt *LabelDecl;
-
// If not forward referenced or defined already, just create a new LabelStmt.
- if (I == ActiveScope->LabelMap.end()) {
- LabelDecl = new (Context) LabelStmt(IdentLoc, II, SubStmt);
- ActiveScope->LabelMap.insert(std::make_pair(II, LabelDecl));
- return Owned(LabelDecl);
- } else
- LabelDecl = static_cast<LabelStmt *>(I->second);
+ if (LabelDecl == 0)
+ return Owned(LabelDecl = new (Context) LabelStmt(IdentLoc, II, SubStmt));
assert(LabelDecl->getID() == II && "Label mismatch!");
@@ -683,16 +676,11 @@ Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
return StmtError(Diag(GotoLoc, diag::err_goto_in_block));
// Look up the record for this label identifier.
- Scope::LabelMapTy::iterator I = ActiveScope->LabelMap.find(LabelII);
+ LabelStmt *&LabelDecl = LabelMap[LabelII];
- LabelStmt *LabelDecl;
-
- // If not forward referenced or defined already, just create a new LabelStmt.
- if (I == ActiveScope->LabelMap.end()) {
+ // If we haven't seen this label yet, create a forward reference.
+ if (LabelDecl == 0)
LabelDecl = new (Context) LabelStmt(LabelLoc, LabelII, 0);
- ActiveScope->LabelMap.insert(std::make_pair(LabelII, LabelDecl));
- } else
- LabelDecl = static_cast<LabelStmt *>(I->second);
return Owned(new (Context) GotoStmt(LabelDecl, GotoLoc, LabelLoc));
}