summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/diagnostics.cpp16
-rw-r--r--source/slang/diagnostics.h2
2 files changed, 12 insertions, 6 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);
+ }
}
}
diff --git a/source/slang/diagnostics.h b/source/slang/diagnostics.h
index fed492bc7..e3aba32e6 100644
--- a/source/slang/diagnostics.h
+++ b/source/slang/diagnostics.h
@@ -145,7 +145,7 @@ namespace Slang
{
enum Enum: uint32_t
{
- VerbosePath = 0x1, ///< Will try and display a
+ VerbosePath = 0x1, ///< Will display a more verbose path (if available) - such as a canonical or absolute path
};
};
typedef uint32_t Flags;