summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-preprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-preprocessor.cpp')
-rw-r--r--source/slang/slang-preprocessor.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/slang/slang-preprocessor.cpp b/source/slang/slang-preprocessor.cpp
index b29fa2716..a0e80473d 100644
--- a/source/slang/slang-preprocessor.cpp
+++ b/source/slang/slang-preprocessor.cpp
@@ -4878,9 +4878,14 @@ TokenList preprocessSource(
desc.contentAssistInfo = &linkage->contentAssistInfo.preprocessorInfo;
}
- preprocessor::WarningStateTracker* wst =
- new preprocessor::WarningStateTracker(desc.sourceManager);
- desc.sink->setSourceWarningStateTracker(wst);
+ // Only create a new WarningStateTracker if the sink doesn't already have one.
+ // This ensures pragma warning states are preserved across included files.
+ if (!desc.sink->getSourceWarningStateTracker())
+ {
+ preprocessor::WarningStateTracker* wst =
+ new preprocessor::WarningStateTracker(desc.sourceManager);
+ desc.sink->setSourceWarningStateTracker(wst);
+ }
return preprocessSource(file, desc, outDetectedLanguage, outLanguageVersion);
}