summaryrefslogtreecommitdiffstats
path: root/source/slang/diagnostics.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-01-22 16:15:15 -0500
committerGitHub <noreply@github.com>2019-01-22 16:15:15 -0500
commita005007c2e9132788c92aa5a9c5fed2cb90f7841 (patch)
treee91c13298980e02eeae4b11ba58fbc33d346de33 /source/slang/diagnostics.cpp
parentbd815f02d846a50e16dab67e6512db2a6215c41f (diff)
* Fix comment on VerbosePath flag (#790)
* Only output a 'verbose path' if it's different from the already output nominal path
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);
+ }
}
}