aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-14 23:55:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-14 23:55:25 +0000
commit0b50cb79ada2f361b11571b56350587012d0f1da (patch)
tree47400c99a4c37db7246856c07d2c20f19aa774f1 /clang/lib/Basic/SourceManager.cpp
parenta19a126ee3cdcf304272042a8e29ea841e22e0d4 (diff)
downloadllvm-0b50cb79ada2f361b11571b56350587012d0f1da.zip
llvm-0b50cb79ada2f361b11571b56350587012d0f1da.tar.gz
llvm-0b50cb79ada2f361b11571b56350587012d0f1da.tar.bz2
Add -cc1 option -fno-diagnostics-use-presumed-location, a handy mode for
working with preprocessed testcases. This causes source locations in diagnostics to point at the spelling location instead of the presumed location, while still keeping the semantic effects of the line directives (entering and leaving system-header mode, primarily). llvm-svn: 168004
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index cd0284a..a32e41e 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -1361,7 +1361,8 @@ const char *SourceManager::getBufferName(SourceLocation Loc,
///
/// Note that a presumed location is always given as the expansion point of an
/// expansion location, not at the spelling location.
-PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc) const {
+PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc,
+ bool UseLineDirectives) const {
if (Loc.isInvalid()) return PresumedLoc();
// Presumed locations are always for expansion points.
@@ -1395,7 +1396,7 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc) const {
// If we have #line directives in this file, update and overwrite the physical
// location info if appropriate.
- if (FI.hasLineDirectives()) {
+ if (UseLineDirectives && FI.hasLineDirectives()) {
assert(LineTable && "Can't have linetable entries without a LineTable!");
// See if there is a #line directive before this. If so, get it.
if (const LineEntry *Entry =