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
This commit is contained in:
parent
a6d5d2a6a0
commit
73c18e0362
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue