aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/SourceMgr.cpp
diff options
context:
space:
mode:
authorArtem Chikin <achikin@apple.com>2024-05-14 10:53:53 -0400
committerGitHub <noreply@github.com>2024-05-14 07:53:53 -0700
commita4accdfe0c9415ad1bd3dac7dda8cb8bbcd1be2f (patch)
tree2f4f5e631beaee9dc6b62a468e49cd3b31963a81 /llvm/lib/Support/SourceMgr.cpp
parent8070b2defa6df1f1a3f3d4ed4989047b0e1bb639 (diff)
downloadllvm-a4accdfe0c9415ad1bd3dac7dda8cb8bbcd1be2f.zip
llvm-a4accdfe0c9415ad1bd3dac7dda8cb8bbcd1be2f.tar.gz
llvm-a4accdfe0c9415ad1bd3dac7dda8cb8bbcd1be2f.tar.bz2
[Support] Add option to print SMDiagnostic into a buffer without the filename and location info (#92050)
Diffstat (limited to 'llvm/lib/Support/SourceMgr.cpp')
-rw-r--r--llvm/lib/Support/SourceMgr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp
index ebeff87..6eaa878 100644
--- a/llvm/lib/Support/SourceMgr.cpp
+++ b/llvm/lib/Support/SourceMgr.cpp
@@ -482,7 +482,7 @@ static void printSourceLine(raw_ostream &S, StringRef LineContents) {
static bool isNonASCII(char c) { return c & 0x80; }
void SMDiagnostic::print(const char *ProgName, raw_ostream &OS, bool ShowColors,
- bool ShowKindLabel) const {
+ bool ShowKindLabel, bool ShowLocation) const {
ColorMode Mode = ShowColors ? ColorMode::Auto : ColorMode::Disable;
{
@@ -491,7 +491,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &OS, bool ShowColors,
if (ProgName && ProgName[0])
S << ProgName << ": ";
- if (!Filename.empty()) {
+ if (ShowLocation && !Filename.empty()) {
if (Filename == "-")
S << "<stdin>";
else