diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-04 12:11:18 -0500 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2019-02-04 09:11:18 -0800 |
| commit | 0d206996cd68b9f08ae1b4d9da6f16293984302c (patch) | |
| tree | 023fe84547955b1356a770f407433f45e1fb8048 /source/slang/legalize-types.cpp | |
| parent | 3726194fbe3da234eb30b6371e5b4ab1ea388f93 (diff) | |
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.
Diffstat (limited to 'source/slang/legalize-types.cpp')
| -rw-r--r-- | source/slang/legalize-types.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<ModuleDecl*>(dd)) + if (auto moduleDecl = as<ModuleDecl>(dd)) return moduleDecl; } return nullptr; @@ -945,7 +945,7 @@ RefPtr<TypeLayout> getDerefTypeLayout( if (!typeLayout) return nullptr; - if (auto parameterGroupTypeLayout = dynamic_cast<ParameterGroupTypeLayout*>(typeLayout)) + if (auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout)) { return parameterGroupTypeLayout->offsetElementTypeLayout; } @@ -962,13 +962,13 @@ RefPtr<VarLayout> getFieldLayout( for(;;) { - if(auto arrayTypeLayout = dynamic_cast<ArrayTypeLayout*>(typeLayout)) + if(auto arrayTypeLayout = as<ArrayTypeLayout>(typeLayout)) { typeLayout = arrayTypeLayout->elementTypeLayout; } - else if(auto parameterGroupTypeLayotu = dynamic_cast<ParameterGroupTypeLayout*>(typeLayout)) + else if(auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout)) { - typeLayout = parameterGroupTypeLayotu->offsetElementTypeLayout; + typeLayout = parameterGroupTypeLayout->offsetElementTypeLayout; } else { @@ -977,7 +977,7 @@ RefPtr<VarLayout> getFieldLayout( } - if (auto structTypeLayout = dynamic_cast<StructTypeLayout*>(typeLayout)) + if (auto structTypeLayout = as<StructTypeLayout>(typeLayout)) { for(auto ff : structTypeLayout->fields) { |
