summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-06-19 11:09:23 -0700
committerGitHub <noreply@github.com>2017-06-19 11:09:23 -0700
commit838e8331da24744948539c12d2a8edcd9c594ee5 (patch)
treeaf1fffcf4cc3ad7368fb9ae2c1b23b34890dbca8 /source/slang/slang.cpp
parentbb9ca29160f5d95f3860504262693ea650d96be5 (diff)
parent91d796da81aade1669abb90b72d4013e5480fb2d (diff)
Merge pull request #30 from tfoleyNV/slang-checking-fix
Make sure that semantic checks always apply to Slang files
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 5ec530592..d86825766 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -246,6 +246,7 @@ struct CompileRequest
parseSourceFile(
translationUnitSyntax.Ptr(),
options,
+ translationUnitOptions,
tokens,
mResult.GetErrorWriter(),
sourceFilePath,
@@ -279,6 +280,7 @@ struct CompileRequest
RefPtr<SyntaxVisitor> visitor = CreateSemanticsVisitor(
mResult.GetErrorWriter(),
options,
+ translationUnit.options,
this);
checkTranslationUnit(translationUnit, visitor);
@@ -287,14 +289,9 @@ struct CompileRequest
void checkCollectionOfTranslationUnits(
RefPtr<CollectionOfTranslationUnits> collectionOfTranslationUnits)
{
- RefPtr<SyntaxVisitor> visitor = CreateSemanticsVisitor(
- mResult.GetErrorWriter(),
- Options,
- this);
-
for( auto& translationUnit : collectionOfTranslationUnits->translationUnits )
{
- checkTranslationUnit(translationUnit, visitor);
+ checkTranslationUnit(translationUnit, Options);
}
}
@@ -322,6 +319,21 @@ struct CompileRequest
int executeCompilerDriverActions()
{
+ // Do some cleanup on settings specified by user.
+ // In particular, we want to propagate flags from the overall request down to
+ // each translation unit.
+ for( auto& translationUnitOptions : Options.translationUnits )
+ {
+ translationUnitOptions.compileFlags |= Options.compileFlags;
+
+ // However, the "no checking" flag shouldn't be applied to
+ // any translation unit that is native Slang code.
+ if( translationUnitOptions.sourceLanguage == SourceLanguage::Slang )
+ {
+ translationUnitOptions.compileFlags &= SLANG_COMPILE_FLAG_NO_CHECKING;
+ }
+ }
+
// If we are being asked to do pass-through, then we need to do that here...
if (Options.passThrough != PassThroughMode::None)
{
@@ -727,7 +739,7 @@ SLANG_API void spSetCompileFlags(
SlangCompileRequest* request,
SlangCompileFlags flags)
{
- REQ(request)->Options.flags = flags;
+ REQ(request)->Options.compileFlags = flags;
}
SLANG_API void spSetCodeGenTarget(