From a005007c2e9132788c92aa5a9c5fed2cb90f7841 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 22 Jan 2019 16:15:15 -0500 Subject: * Fix comment on VerbosePath flag (#790) * Only output a 'verbose path' if it's different from the already output nominal path --- source/slang/diagnostics.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source/slang/diagnostics.cpp') 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); + } } } -- cgit v1.2.3