summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/SourceManager.h
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
commit62221b17c90457df9ca0ff20bb54d634e8951def (patch)
treef238d595e59ffcf67ab18861aa918c8431a92c7a /include/clang/Basic/SourceManager.h
parent1a03b262d0f07d4a3091b0a9b7310100d9bd0aa9 (diff)
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r--include/clang/Basic/SourceManager.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index db6bfd2ad3..5717816ff9 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -1187,7 +1187,8 @@ public:
/// presumed location cannot be calculate (e.g., because \p Loc is invalid
/// or the file containing \p Loc has changed on disk), returns an invalid
/// presumed location.
- PresumedLoc getPresumedLoc(SourceLocation Loc) const;
+ PresumedLoc getPresumedLoc(SourceLocation Loc,
+ bool UseLineDirectives = true) const;
/// \brief Returns true if both SourceLocations correspond to the same file.
bool isFromSameFile(SourceLocation Loc1, SourceLocation Loc2) const {
@@ -1423,7 +1424,8 @@ public:
/// Get a presumed location suitable for displaying in a diagnostic message,
/// taking into account macro arguments and expansions.
- PresumedLoc getPresumedLocForDisplay(SourceLocation Loc) const {
+ PresumedLoc getPresumedLocForDisplay(SourceLocation Loc,
+ bool UseLineDirectives = true) const{
// This is a condensed form of the algorithm used by emitCaretDiagnostic to
// walk to the top of the macro call stack.
while (Loc.isMacroID()) {
@@ -1431,7 +1433,7 @@ public:
Loc = getImmediateMacroCallerLoc(Loc);
}
- return getPresumedLoc(Loc);
+ return getPresumedLoc(Loc, UseLineDirectives);
}
/// Look through spelling locations for a macro argument expansion, and if