From 49ed6b60d662906f290578f802f80b0ead1a2b9d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 12 Dec 2018 08:57:48 -0500 Subject: Running tests in slang-test process (#740) * First pass at having an interface to write text to that can be replaced. Simplifed and made more rigerous the interface used to write formatted strings. * Added AppContext to simplify setting up and parsing around of streams. * Added more simplified way to get the std error/out from AppContext. * Work in progress using dll for tools to speed up testing. * First pass at ISlangWriter interface. * Added support for writing VaArgs. Added NullWriter. * Use ISlangWriter for output. * Use ISlangWriter for output - replacing OutputCallback. Make IRDump go to ISlangWriter * SlangWriterTargetType -> SlangWriterChannel Improvements around AppContext * Shared library working with slang-reflection-test. * Dll testing working for render-test. * Include va_list definintion from header. * Fix errors from clang. * Fix typo for linux. * Added -usexes option * Fix typo. * Fix arguments problem on linux. * Fix typo for linux. * Add windows tool shared library projects. * Fix warning from x86 win build. Fix signed warning from slang-test/main.cpp * First attempt at getting premake to work on travis, and run tests. * Try moving build out into script. * Invoke bash scripts so they don't have to be executable. * Drive configuration/tests from env parameters set by travis * Try using source to run travis tests. * Remove the build.linux directory - but doing so will overwrite Makefile. * Made -fno-delete-null-pointer-checks gcc only. * Try to fix warning from -fno-delete-null-pointer-checks * Turn of warnings for unknown switches. * Try to make premake choose the correct tooling. * Disabled missing braces warning. * Disable -Wundefined-var-template on clang. * -Wunused-function disabled for clang. * Fix typo due to SlangBool. * Remove this nullptr tests. * "-Wno-unused-private-field" for clang. * Added "-Wno-undefined-bool-conversion" * Add DominatorList::end fix. * Split scripts into travis_build.sh travis_test.sh * Fix gcc/clang template pre-declaration issue around QualType. * Fix premake to build such that pthread correctly links with slang-glslang --- source/slang/check.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'source/slang/check.cpp') diff --git a/source/slang/check.cpp b/source/slang/check.cpp index 21e3b894b..4f914ee1f 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -1006,6 +1006,15 @@ namespace Slang } } + if (!type) + { + if (outProperType) + { + *outProperType = nullptr; + } + return false; + } + if (auto genericDeclRefType = type->As()) { // We are using a reference to a generic declaration as a concrete @@ -1034,7 +1043,7 @@ namespace Slang } // TODO: this is one place where syntax should get cloned! - if(outProperType) + if (outProperType) args.Add(typeParam->initType.exp); } else if (auto valParam = member.As()) @@ -1050,7 +1059,7 @@ namespace Slang } // TODO: this is one place where syntax should get cloned! - if(outProperType) + if (outProperType) args.Add(valParam->initExpr); } else @@ -1065,15 +1074,13 @@ namespace Slang } return true; } - else + + // default case: we expect this to already be a proper type + if (outProperType) { - // default case: we expect this to already be a proper type - if (outProperType) - { - *outProperType = type; - } - return true; + *outProperType = type; } + return true; } @@ -1147,7 +1154,7 @@ namespace Slang { // TODO: we may want other cases here... - if (auto errorType = expr->type->As()) + if (auto errorType = expr->type.As()) return true; return false; @@ -7229,7 +7236,7 @@ namespace Slang // for anything applicable. AddDeclRefOverloadCandidates(LookupResultItem(declRefExpr->declRef), context); } - else if (auto funcType = funcExprType->As()) + else if (auto funcType = funcExprType.As()) { // TODO(tfoley): deprecate this path... AddFuncOverloadCandidate(funcType, context); @@ -7250,7 +7257,7 @@ namespace Slang AddOverloadCandidates(item, context); } } - else if (auto typeType = funcExprType->As()) + else if (auto typeType = funcExprType.As()) { // If none of the above cases matched, but we are // looking at a type, then I suppose we have -- cgit v1.2.3