From 393185196ed65a9eeaf9502edbf3dcce87337d81 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 22 Aug 2022 09:43:05 -0700 Subject: Support compile-time constant int val in the form of polynomials. (#2372) Co-authored-by: Yong He --- source/compiler-core/slang-diagnostic-sink.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/compiler-core') diff --git a/source/compiler-core/slang-diagnostic-sink.cpp b/source/compiler-core/slang-diagnostic-sink.cpp index 34a3c4968..85c7792c0 100644 --- a/source/compiler-core/slang-diagnostic-sink.cpp +++ b/source/compiler-core/slang-diagnostic-sink.cpp @@ -405,10 +405,13 @@ static void formatDiagnostic( HumaneSourceLoc humaneLoc; const auto sourceLoc = diagnostic.loc; { - sourceView = sourceManager->findSourceViewRecursively(sourceLoc); - if (sourceView) + if (sourceManager) { - humaneLoc = sourceView->getHumaneLoc(sourceLoc); + sourceView = sourceManager->findSourceViewRecursively(sourceLoc); + if (sourceView) + { + humaneLoc = sourceView->getHumaneLoc(sourceLoc); + } } formatDiagnostic(humaneLoc, diagnostic, sink->getFlags(), sb); @@ -418,7 +421,7 @@ static void formatDiagnostic( while (currentView && currentView->getInitiatingSourceLoc().isValid() && currentView->getSourceFile()->getPathInfo().type == PathInfo::Type::TokenPaste) { - SourceView* initiatingView = sourceManager->findSourceView(currentView->getInitiatingSourceLoc()); + SourceView* initiatingView = sourceManager ? sourceManager->findSourceView(currentView->getInitiatingSourceLoc()) : nullptr; if (initiatingView == nullptr) { break; -- cgit v1.2.3