summaryrefslogtreecommitdiffstats
path: root/source/slang/diagnostics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/diagnostics.cpp')
-rw-r--r--source/slang/diagnostics.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/slang/diagnostics.cpp b/source/slang/diagnostics.cpp
index 00205fed3..4edea57a2 100644
--- a/source/slang/diagnostics.cpp
+++ b/source/slang/diagnostics.cpp
@@ -240,12 +240,18 @@ static void formatDiagnostic(
if (sourceView && (sink->flags & DiagnosticSink::Flag::VerbosePath))
{
- auto actualLoc = sourceView->getHumaneLoc(diagnostic.loc, SourceLocType::Actual);
- // Look up the full path
- SourceFile* sourceFile = sourceView->getSourceFile();
- actualLoc.pathInfo.foundPath = sourceFile->calcVerbosePath();
+ auto actualHumaneLoc = sourceView->getHumaneLoc(diagnostic.loc, SourceLocType::Actual);
- formatDiagnostic(actualLoc, diagnostic, sb);
+ // Look up the path verbosely (will get the canonical path if necessary)
+ actualHumaneLoc.pathInfo.foundPath = sourceView->getSourceFile()->calcVerbosePath();
+
+ // Only output if it's actually different
+ if (actualHumaneLoc.pathInfo.foundPath != humaneLoc.pathInfo.foundPath ||
+ actualHumaneLoc.line != humaneLoc.line ||
+ actualHumaneLoc.column != humaneLoc.column)
+ {
+ formatDiagnostic(actualHumaneLoc, diagnostic, sb);
+ }
}
}