diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-04-27 12:36:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-26 21:36:59 -0700 |
| commit | 3acbe8145c60f4d1e7a180b4602a94269a489df5 (patch) | |
| tree | 8031e7ca897260ac3ab6d2a920864f3114bc8668 /source/slang/slang-reflection-api.cpp | |
| parent | a3da31c189a1cc9bdf85a42ac359b8c2777f3550 (diff) | |
Fix most of the disabled warnings on gcc/clang (#2839)
Diffstat (limited to 'source/slang/slang-reflection-api.cpp')
| -rw-r--r-- | source/slang/slang-reflection-api.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index e3e9de2cd..5d35c7eef 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -90,6 +90,7 @@ static inline ProgramLayout* convert(SlangReflection* program) return (ProgramLayout*) program; } +[[maybe_unused]] static inline SlangReflection* convert(ProgramLayout* program) { return (SlangReflection*) program; @@ -311,27 +312,27 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType) // TODO(tfoley: Don't emit the same type more than once... - if (auto basicType = as<BasicExpressionType>(type)) + if (const auto basicType = as<BasicExpressionType>(type)) { return SLANG_TYPE_KIND_SCALAR; } - else if (auto vectorType = as<VectorExpressionType>(type)) + else if (const auto vectorType = as<VectorExpressionType>(type)) { return SLANG_TYPE_KIND_VECTOR; } - else if (auto matrixType = as<MatrixExpressionType>(type)) + else if (const auto matrixType = as<MatrixExpressionType>(type)) { return SLANG_TYPE_KIND_MATRIX; } - else if (auto parameterBlockType = as<ParameterBlockType>(type)) + else if (const auto parameterBlockType = as<ParameterBlockType>(type)) { return SLANG_TYPE_KIND_PARAMETER_BLOCK; } - else if (auto constantBufferType = as<ConstantBufferType>(type)) + else if (const auto constantBufferType = as<ConstantBufferType>(type)) { return SLANG_TYPE_KIND_CONSTANT_BUFFER; } - else if( auto streamOutputType = as<HLSLStreamOutputType>(type) ) + else if( const auto streamOutputType = as<HLSLStreamOutputType>(type) ) { return SLANG_TYPE_KIND_OUTPUT_STREAM; } @@ -347,15 +348,15 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType) { return SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER; } - else if (auto samplerStateType = as<SamplerStateType>(type)) + else if (const auto samplerStateType = as<SamplerStateType>(type)) { return SLANG_TYPE_KIND_SAMPLER_STATE; } - else if (auto textureType = as<TextureTypeBase>(type)) + else if (const auto textureType = as<TextureTypeBase>(type)) { return SLANG_TYPE_KIND_RESOURCE; } - else if (auto feedbackType = as<FeedbackType>(type)) + else if (const auto feedbackType = as<FeedbackType>(type)) { return SLANG_TYPE_KIND_FEEDBACK; } @@ -376,7 +377,7 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType) CASE(UntypedBufferResourceType); #undef CASE - else if (auto arrayType = as<ArrayExpressionType>(type)) + else if (const auto arrayType = as<ArrayExpressionType>(type)) { return SLANG_TYPE_KIND_ARRAY; } @@ -401,11 +402,11 @@ SLANG_API SlangTypeKind spReflectionType_GetKind(SlangReflectionType* inType) return SLANG_TYPE_KIND_STRUCT; } } - else if( auto specializedType = as<ExistentialSpecializedType>(type) ) + else if( const auto specializedType = as<ExistentialSpecializedType>(type) ) { return SLANG_TYPE_KIND_SPECIALIZED; } - else if (auto errorType = as<ErrorType>(type)) + else if (const auto errorType = as<ErrorType>(type)) { // This means we saw a type we didn't understand in the user's code return SLANG_TYPE_KIND_NONE; @@ -510,11 +511,11 @@ SLANG_API unsigned int spReflectionType_GetRowCount(SlangReflectionType* inType) { return (unsigned int) getIntVal(matrixType->getRowCount()); } - else if(auto vectorType = as<VectorExpressionType>(type)) + else if(const auto vectorType = as<VectorExpressionType>(type)) { return 1; } - else if( auto basicType = as<BasicExpressionType>(type) ) + else if( const auto basicType = as<BasicExpressionType>(type) ) { return 1; } @@ -535,7 +536,7 @@ SLANG_API unsigned int spReflectionType_GetColumnCount(SlangReflectionType* inTy { return (unsigned int) getIntVal(vectorType->elementCount); } - else if( auto basicType = as<BasicExpressionType>(type) ) + else if( const auto basicType = as<BasicExpressionType>(type) ) { return 1; } @@ -1238,7 +1239,7 @@ namespace Slang SlangBindingType _calcResourceBindingType( Type* type) { - if(auto combinedTextureSamplerType = as<TextureSamplerType>(type)) + if(const auto combinedTextureSamplerType = as<TextureSamplerType>(type)) { return SLANG_BINDING_TYPE_COMBINED_TEXTURE_SAMPLER; } @@ -1260,7 +1261,7 @@ namespace Slang return SlangBindingType(SLANG_BINDING_TYPE_TYPED_BUFFER | mutableFlag); } } - else if( auto structuredBufferType = as<HLSLStructuredBufferTypeBase>(type) ) + else if( const auto structuredBufferType = as<HLSLStructuredBufferTypeBase>(type) ) { if( as<HLSLStructuredBufferType>(type) ) { @@ -1275,7 +1276,7 @@ namespace Slang { return SLANG_BINDING_TYPE_RAY_TRACING_ACCELERATION_STRUCTURE; } - else if( auto untypedBufferType = as<UntypedBufferResourceType>(type) ) + else if( const auto untypedBufferType = as<UntypedBufferResourceType>(type) ) { if( as<HLSLByteAddressBufferType>(type) ) { @@ -1928,7 +1929,7 @@ namespace Slang m_extendedInfo->m_bindingRanges.add(bindingRange); // For `StructuredBuffer` fields, we also make sure to report it as a sub-object range. - if (auto structuredBufferTypeLayout = as<StructuredBufferTypeLayout>(typeLayout)) + if (const auto structuredBufferTypeLayout = as<StructuredBufferTypeLayout>(typeLayout)) { TypeLayout::ExtendedInfo::SubObjectRangeInfo subObjectRange; subObjectRange.bindingRangeIndex = bindingRangeIndex; |
