Skip to content

Commit 4c95fa8

Browse files
committed
self-review: use else if
1 parent c59e666 commit 4c95fa8

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,9 +1116,8 @@ bool SemaHLSL::handleRootSignatureDecl(HLSLRootSignatureDecl *D,
11161116
Info.Space = Descriptor->Space;
11171117
Info.Visibility = Descriptor->Visibility;
11181118
Infos.push_back(Info);
1119-
}
1120-
if (const auto *Constants =
1121-
std::get_if<llvm::hlsl::rootsig::RootConstants>(&Elem)) {
1119+
} else if (const auto *Constants =
1120+
std::get_if<llvm::hlsl::rootsig::RootConstants>(&Elem)) {
11221121
RangeInfo Info;
11231122
Info.LowerBound = Constants->Reg.Number;
11241123
Info.UpperBound = Info.LowerBound; // use inclusive ranges []
@@ -1127,9 +1126,8 @@ bool SemaHLSL::handleRootSignatureDecl(HLSLRootSignatureDecl *D,
11271126
Info.Space = Constants->Space;
11281127
Info.Visibility = Constants->Visibility;
11291128
Infos.push_back(Info);
1130-
}
1131-
if (const auto *Sampler =
1132-
std::get_if<llvm::hlsl::rootsig::StaticSampler>(&Elem)) {
1129+
} else if (const auto *Sampler =
1130+
std::get_if<llvm::hlsl::rootsig::StaticSampler>(&Elem)) {
11331131
RangeInfo Info;
11341132
Info.LowerBound = Sampler->Reg.Number;
11351133
Info.UpperBound = Info.LowerBound; // use inclusive ranges []
@@ -1138,9 +1136,9 @@ bool SemaHLSL::handleRootSignatureDecl(HLSLRootSignatureDecl *D,
11381136
Info.Space = Sampler->Space;
11391137
Info.Visibility = Sampler->Visibility;
11401138
Infos.push_back(Info);
1141-
}
1142-
if (const auto *Clause =
1143-
std::get_if<llvm::hlsl::rootsig::DescriptorTableClause>(&Elem)) {
1139+
} else if (const auto *Clause =
1140+
std::get_if<llvm::hlsl::rootsig::DescriptorTableClause>(
1141+
&Elem)) {
11441142
RangeInfo Info;
11451143
Info.LowerBound = Clause->Reg.Number;
11461144
assert(0 < Clause->NumDescriptors && "Verified as part of TODO(#129940)");
@@ -1153,9 +1151,8 @@ bool SemaHLSL::handleRootSignatureDecl(HLSLRootSignatureDecl *D,
11531151
Info.Space = Clause->Space;
11541152
// Note: Clause does not hold the visibility this will need to
11551153
Infos.push_back(Info);
1156-
}
1157-
if (const auto *Table =
1158-
std::get_if<llvm::hlsl::rootsig::DescriptorTable>(&Elem)) {
1154+
} else if (const auto *Table =
1155+
std::get_if<llvm::hlsl::rootsig::DescriptorTable>(&Elem)) {
11591156
// Table holds the Visibility of all owned Clauses in Table, so iterate
11601157
// owned Clauses and update their corresponding RangeInfo
11611158
assert(Table->NumClauses <= Infos.size() && "RootElement");

0 commit comments

Comments
 (0)