summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-22 09:43:05 -0700
committerGitHub <noreply@github.com>2022-08-22 09:43:05 -0700
commit393185196ed65a9eeaf9502edbf3dcce87337d81 (patch)
tree91c9fa14ddb21d15e6cedf83f7aa6b649e99db86 /source/compiler-core
parent15055d20c143cb398bd3e269541eebf24777390a (diff)
Support compile-time constant int val in the form of polynomials. (#2372)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-diagnostic-sink.cpp11
1 files changed, 7 insertions, 4 deletions
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;