summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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