summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtDumper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/StmtDumper.cpp')
-rw-r--r--clang/lib/AST/StmtDumper.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp
index c3ce92de60b..1ee3efab0a2 100644
--- a/clang/lib/AST/StmtDumper.cpp
+++ b/clang/lib/AST/StmtDumper.cpp
@@ -152,21 +152,22 @@ namespace {
//===----------------------------------------------------------------------===//
void StmtDumper::DumpLocation(SourceLocation Loc) {
- SourceLocation PhysLoc = SM->getPhysicalLoc(Loc);
+ SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
// The general format we print out is filename:line:col, but we drop pieces
// that haven't changed since the last loc printed.
- const char *Filename = SM->getSourceName(PhysLoc);
- unsigned LineNo = SM->getLineNumber(PhysLoc);
+ const char *Filename = SM->getSourceName(SpellingLoc);
+ unsigned LineNo = SM->getLineNumber(SpellingLoc);
+ unsigned ColNo = SM->getColumnNumber(SpellingLoc);
if (strcmp(Filename, LastLocFilename) != 0) {
- fprintf(stderr, "%s:%u:%u", Filename, LineNo, SM->getColumnNumber(PhysLoc));
+ fprintf(stderr, "%s:%u:%u", Filename, LineNo, ColNo);
LastLocFilename = Filename;
LastLocLine = LineNo;
} else if (LineNo != LastLocLine) {
- fprintf(stderr, "line:%u:%u", LineNo, SM->getColumnNumber(PhysLoc));
+ fprintf(stderr, "line:%u:%u", LineNo, ColNo);
LastLocLine = LineNo;
} else {
- fprintf(stderr, "col:%u", SM->getColumnNumber(PhysLoc));
+ fprintf(stderr, "col:%u", ColNo);
}
}
OpenPOWER on IntegriCloud