diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-06-19 10:37:09 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-06-19 10:37:09 -0700 |
| commit | 91d796da81aade1669abb90b72d4013e5480fb2d (patch) | |
| tree | af1fffcf4cc3ad7368fb9ae2c1b23b34890dbca8 /source/slang/check.cpp | |
| parent | bb9ca29160f5d95f3860504262693ea650d96be5 (diff) | |
Make sure that semantic checks always apply to Slang files
That is, even if hte user specified the `-no-checking` option (or the equivalent via API), we still want/need to apply full semantic checks to Slang code, so that cross-compilation will be possible.
Diffstat (limited to 'source/slang/check.cpp')
| -rw-r--r-- | source/slang/check.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp index 0827641d1..f79df0c40 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -47,6 +47,7 @@ namespace Slang ProgramSyntaxNode * program = nullptr; FunctionSyntaxNode * function = nullptr; CompileOptions const* options = nullptr; + TranslationUnitOptions const* translationUnitOptions = nullptr; CompileRequest* request = nullptr; // lexical outer statements @@ -55,14 +56,17 @@ namespace Slang SemanticsVisitor( DiagnosticSink * pErr, CompileOptions const& options, + TranslationUnitOptions const& translationUnitOptions, CompileRequest* request) : SyntaxVisitor(pErr) , options(&options) + , translationUnitOptions(&translationUnitOptions) , request(request) { } CompileOptions const& getOptions() { return *options; } + TranslationUnitOptions const& getTranslationUnitOptions() { return *translationUnitOptions; } public: // Translate Types @@ -965,7 +969,7 @@ namespace Slang // expressions without a type, and we need to ignore them. if( !fromExpr->Type.type ) { - if(getOptions().flags & SLANG_COMPILE_FLAG_NO_CHECKING ) + if(getTranslationUnitOptions().compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING ) return fromExpr; } @@ -977,7 +981,7 @@ namespace Slang fromExpr.Ptr(), nullptr)) { - if(!(getOptions().flags & SLANG_COMPILE_FLAG_NO_CHECKING)) + if(!(getTranslationUnitOptions().compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING)) { getSink()->diagnose(fromExpr->Position, Diagnostics::typeMismatch, toType, fromExpr->Type); } @@ -4963,11 +4967,12 @@ namespace Slang }; SyntaxVisitor* CreateSemanticsVisitor( - DiagnosticSink* err, - CompileOptions const& options, - CompileRequest* request) + DiagnosticSink* err, + CompileOptions const& options, + TranslationUnitOptions const& translationUnitOptions, + CompileRequest* request) { - return new SemanticsVisitor(err, options, request); + return new SemanticsVisitor(err, options, translationUnitOptions, request); } // |
