diff options
author | Charalampos Mitrodimas <charmitro@gmail.com> | 2023-06-05 17:43:33 +0000 |
---|---|---|
committer | Christopher Di Bella <cjdb@google.com> | 2023-06-05 18:07:18 +0000 |
commit | 91be60b34715bfe930dd1c56414c62a63cdaaa9c (patch) | |
tree | 153fc7673551974eab669657eff9e4ff11fd5404 /clang/lib/Frontend/TextDiagnostic.cpp | |
parent | 798c5ba770d30520a7cd6f431068ade2bda5a9f1 (diff) | |
download | llvm-91be60b34715bfe930dd1c56414c62a63cdaaa9c.zip llvm-91be60b34715bfe930dd1c56414c62a63cdaaa9c.tar.gz llvm-91be60b34715bfe930dd1c56414c62a63cdaaa9c.tar.bz2 |
Respect "-fdiagnostics-absolute-paths" on emit include location
This commit fixes "TextDiagnostic::emitIncludeLocation" when compiling
with "-fdiagnostics-absolute-paths" flag enabled by emitting the absolute
path of the included file.
Fixes #63026
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D151833
Diffstat (limited to 'clang/lib/Frontend/TextDiagnostic.cpp')
-rw-r--r-- | clang/lib/Frontend/TextDiagnostic.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index 01d2b10..3cdf86f 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -868,10 +868,11 @@ void TextDiagnostic::emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc, } void TextDiagnostic::emitIncludeLocation(FullSourceLoc Loc, PresumedLoc PLoc) { - if (DiagOpts->ShowLocation && PLoc.isValid()) - OS << "In file included from " << PLoc.getFilename() << ':' - << PLoc.getLine() << ":\n"; - else + if (DiagOpts->ShowLocation && PLoc.isValid()) { + OS << "In file included from "; + emitFilename(PLoc.getFilename(), Loc.getManager()); + OS << ':' << PLoc.getLine() << ":\n"; + } else OS << "In included file:\n"; } |