[cfe-commits] r41745 - in /cfe/trunk: Sema/SemaStmt.cpp include/clang/AST/Stmt.h
Ted Kremenek
kremenek at apple.com
Thu Sep 6 10:11:52 PDT 2007
Author: kremenek
Date: Thu Sep 6 12:11:52 2007
New Revision: 41745
URL: http://llvm.org/viewvc/llvm-project?rev=41745&view=rev
Log:
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.
Modified:
cfe/trunk/Sema/SemaStmt.cpp
cfe/trunk/include/clang/AST/Stmt.h
Modified: cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaStmt.cpp?rev=41745&r1=41744&r2=41745&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/Sema/SemaStmt.cpp Thu Sep 6 12:11:52 2007
@@ -510,7 +510,7 @@
if (LabelDecl == 0)
LabelDecl = new LabelStmt(LabelLoc, LabelII, 0);
- return new GotoStmt(LabelDecl, GotoLoc);
+ return new GotoStmt(LabelDecl, GotoLoc, LabelLoc);
}
Action::StmtResult
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=41745&r1=41744&r2=41745&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu Sep 6 12:11:52 2007
@@ -524,14 +524,15 @@
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;
More information about the cfe-commits
mailing list