summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-04 02:00:59 +0000
committerChris Lattner <sabre@nondot.org>2009-02-04 02:00:59 +0000
commitc1219ff7ccdb36ff003a95f38467ddad0d527b91 (patch)
tree6d99e1669472dece70e4865664a67adc7b59dea8
parentd429392285eaf0095aeb54700b1fd35fd7ef9560 (diff)
downloadbcm5719-llvm-c1219ff7ccdb36ff003a95f38467ddad0d527b91.tar.gz
bcm5719-llvm-c1219ff7ccdb36ff003a95f38467ddad0d527b91.zip
add the difference in the line marker phys line number and the
query point to the returned presumed location. We now produce: foo.h:92:2: warning: #warning blarg! #warning blarg! ^ foo.h:93:2: warning: #warning blarg! #warning blarg! ^ foo.h:94:2: warning: #warning blarg! #warning blarg! ^ for: #line 92 "foo.h" #warning blarg! #warning blarg! #warning blarg! blarg indeed! llvm-svn: 63710
-rw-r--r--clang/lib/Basic/SourceManager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 34e7049894e..99837410401 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -697,10 +697,18 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc) const {
// See if there is a #line directive before this. If so, get it.
if (const LineEntry *Entry =
LineTable->FindNearestLineEntry(LocInfo.first.ID, LocInfo.second)) {
- LineNo = Entry->LineNo;
-
+ // If the LineEntry indicates a filename, use it.
if (Entry->FilenameID != -1)
Filename = LineTable->getFilename(Entry->FilenameID);
+
+ // Use the line number specified by the LineEntry. This line number may
+ // be multiple lines down from the line entry. Add the difference in
+ // physical line numbers from the query point and the line marker to the
+ // total.
+ unsigned MarkerLineNo = getLineNumber(LocInfo.first, Entry->FileOffset);
+ LineNo = Entry->LineNo + (LineNo-MarkerLineNo-1);
+
+
}
}
OpenPOWER on IntegriCloud