From 11c547d1e94fa620f527c3590174e6e25ab21883 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 31 Jan 2019 10:14:26 -0500 Subject: Feature/as refactor (#817) * Made dynamicCast a free function. * Replace As with as or dynamicCast depending on if it is a type. * Fix problem with using non smart pointer cast. * Removed legacy asXXXX methods. * Remove As from Type. * Removed As from Qual type -> made coercable into Type*, such that can just use free 'as'. * Remove left over QualType::As() impl. * Remove As from SyntaxNodeBase. * Made as for instructions implemented by dynamicCast. * Replace As on DeclRef. Use the global as<> to do the cast. * Add const safe versions of dynamicCast and as for IRInst --- source/slang/ir-legalize-types.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/slang/ir-legalize-types.cpp') diff --git a/source/slang/ir-legalize-types.cpp b/source/slang/ir-legalize-types.cpp index 141799a06..eb22da967 100644 --- a/source/slang/ir-legalize-types.cpp +++ b/source/slang/ir-legalize-types.cpp @@ -71,7 +71,7 @@ LegalVal LegalVal::implicitDeref(LegalVal const& val) LegalVal LegalVal::getImplicitDeref() { SLANG_ASSERT(flavor == Flavor::implicitDeref); - return obj.As()->val; + return as(obj)->val; } @@ -1017,7 +1017,7 @@ static LegalVal legalizeInst( RefPtr findVarLayout(IRInst* value) { if (auto layoutDecoration = value->findDecoration()) - return layoutDecoration->getLayout()->dynamicCast(); + return dynamicCast(layoutDecoration->getLayout()); return nullptr; } -- cgit v1.2.3