diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-18 20:01:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-18 20:01:55 +0000 |
commit | ea29a3a0d6948c4a51a261d19ec1a585d2a9c779 (patch) | |
tree | 3cfbecbe69e2f6791678916917fad8555fc4a21e /lib/Sema/SemaStmt.cpp | |
parent | a9768b72bb5ea061c9f10d6aa51b3be3241f3ec2 (diff) |
refactor some code, adding a new getLabelMap() accessor method
so that clients can't poke the function-local one when they really
want the current block label. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index a34fc2410e..a5b188696a 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -152,7 +152,7 @@ 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. - LabelStmt *&LabelDecl = CurBlock ? CurBlock->LabelMap[II] : LabelMap[II]; + LabelStmt *&LabelDecl = getLabelMap()[II]; // If not forward referenced or defined already, just create a new LabelStmt. if (LabelDecl == 0) @@ -656,8 +656,7 @@ Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, return StmtError(Diag(GotoLoc, diag::err_goto_in_block)); // Look up the record for this label identifier. - LabelStmt *&LabelDecl = CurBlock ? CurBlock->LabelMap[LabelII] : - LabelMap[LabelII]; + LabelStmt *&LabelDecl = getLabelMap()[LabelII]; // If we haven't seen this label yet, create a forward reference. if (LabelDecl == 0) |