From 0d206996cd68b9f08ae1b4d9da6f16293984302c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 4 Feb 2019 12:11:18 -0500 Subject: Feature/casting tidyup (#822) * Use 'is' over 'as' where appropriate. * dynamic_cast -> dynamicCast * Replace 'dynamicCast' with 'as' where has no change in behavior/ambiguity. * Replace dynamicCast with as where doesn't change behavior/non ambiguous. --- source/slang/legalize-types.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/slang/legalize-types.cpp') diff --git a/source/slang/legalize-types.cpp b/source/slang/legalize-types.cpp index 30590c02d..3accad448 100644 --- a/source/slang/legalize-types.cpp +++ b/source/slang/legalize-types.cpp @@ -109,7 +109,7 @@ ModuleDecl* findModuleForDecl( { for (auto dd = decl; dd; dd = dd->ParentDecl) { - if (auto moduleDecl = dynamic_cast(dd)) + if (auto moduleDecl = as(dd)) return moduleDecl; } return nullptr; @@ -945,7 +945,7 @@ RefPtr getDerefTypeLayout( if (!typeLayout) return nullptr; - if (auto parameterGroupTypeLayout = dynamic_cast(typeLayout)) + if (auto parameterGroupTypeLayout = as(typeLayout)) { return parameterGroupTypeLayout->offsetElementTypeLayout; } @@ -962,13 +962,13 @@ RefPtr getFieldLayout( for(;;) { - if(auto arrayTypeLayout = dynamic_cast(typeLayout)) + if(auto arrayTypeLayout = as(typeLayout)) { typeLayout = arrayTypeLayout->elementTypeLayout; } - else if(auto parameterGroupTypeLayotu = dynamic_cast(typeLayout)) + else if(auto parameterGroupTypeLayout = as(typeLayout)) { - typeLayout = parameterGroupTypeLayotu->offsetElementTypeLayout; + typeLayout = parameterGroupTypeLayout->offsetElementTypeLayout; } else { @@ -977,7 +977,7 @@ RefPtr getFieldLayout( } - if (auto structTypeLayout = dynamic_cast(typeLayout)) + if (auto structTypeLayout = as(typeLayout)) { for(auto ff : structTypeLayout->fields) { -- cgit v1.2.3