summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-09-06 17:11:52 +0000
committerTed Kremenek <kremenek@apple.com>2007-09-06 17:11:52 +0000
commit73c18e0362922ac6785ca8d2526fa9784a0f0c93 (patch)
tree8a0a15131c893972e3b4d04884dd14951641d6a9
parenta6d5d2a6a0ee80b00985e9232a89d6e537cceff8 (diff)
downloadbcm5719-llvm-73c18e0362922ac6785ca8d2526fa9784a0f0c93.tar.gz
bcm5719-llvm-73c18e0362922ac6785ca8d2526fa9784a0f0c93.zip
Added LabelLoc to GotoStmt to record the source location of the label token
in the actual GotoStmt. Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt to compute its extent. llvm-svn: 41745
-rw-r--r--clang/Sema/SemaStmt.cpp2
-rw-r--r--clang/include/clang/AST/Stmt.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index 2924370df3a..9cca2c24f02 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -510,7 +510,7 @@ Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
if (LabelDecl == 0)
LabelDecl = new LabelStmt(LabelLoc, LabelII, 0);
- return new GotoStmt(LabelDecl, GotoLoc);
+ return new GotoStmt(LabelDecl, GotoLoc, LabelLoc);
}
Action::StmtResult
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index b0dca78648f..b2703f46472 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -524,14 +524,15 @@ public:
class GotoStmt : public Stmt {
LabelStmt *Label;
SourceLocation GotoLoc;
+ SourceLocation LabelLoc;
public:
- GotoStmt(LabelStmt *label, SourceLocation GL) : Stmt(GotoStmtClass),
- Label(label), GotoLoc(GL) {}
+ GotoStmt(LabelStmt *label, SourceLocation GL, SourceLocation LL)
+ : Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
LabelStmt *getLabel() const { return Label; }
virtual SourceRange getSourceRange() const {
- return SourceRange(GotoLoc, Label->getLocEnd());
+ return SourceRange(GotoLoc, LabelLoc);
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == GotoStmtClass;
OpenPOWER on IntegriCloud