Skip to content

Commit 04f1ebc

Browse files
committed
misc clean up
1 parent 7339028 commit 04f1ebc

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,10 +1155,9 @@ bool SemaHLSL::handleRootSignatureElements(
11551155
}
11561156
}
11571157

1158-
// Sort as specified
1159-
auto ComparePairs = [](InfoPair A, InfoPair B) { return A.first < B.first; };
1160-
1161-
std::sort(InfoPairs.begin(), InfoPairs.end(), ComparePairs);
1158+
// 2. Sort with the RangeInfo <operator to prepare it for findOverlapping
1159+
std::sort(InfoPairs.begin(), InfoPairs.end(),
1160+
[](InfoPair A, InfoPair B) { return A.first < B.first; });
11621161

11631162
llvm::SmallVector<RangeInfo> Infos;
11641163
for (const InfoPair &Pair : InfoPairs)
@@ -1205,6 +1204,7 @@ bool SemaHLSL::handleRootSignatureElements(
12051204
this->Diag(OElem->getLocation(), diag::note_hlsl_resource_range_here);
12061205
};
12071206

1207+
// 3. Invoke find overlapping ranges
12081208
llvm::SmallVector<OverlappingRanges> Overlaps =
12091209
llvm::hlsl::rootsig::findOverlappingRanges(Infos);
12101210
for (OverlappingRanges Overlap : Overlaps)

llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ struct OverlappingRanges {
137137
/// - RangeInfo will retain the interval, ResourceClass, Space and Visibility
138138
/// - It will also contain an index so that it can be associated to
139139
/// additional diagnostic information
140-
/// 2. Sort the RangeInfo's such that they are grouped together by
141-
/// ResourceClass and Space
140+
/// 2. The user is required to sort the RangeInfo's such that they are grouped
141+
/// together by ResourceClass and Space
142142
/// 3. Iterate through the collected RangeInfos by their groups
143143
/// - For each group we will have a ResourceRange for each visibility
144144
/// - As we iterate through we will:

llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ std::optional<const RangeInfo *> ResourceRange::insert(const RangeInfo &Info) {
245245

246246
llvm::SmallVector<OverlappingRanges>
247247
findOverlappingRanges(ArrayRef<RangeInfo> Infos) {
248-
// 1. The user has provided the corresponding range information
248+
// It is expected that Infos is filled with valid RangeInfos and that
249+
// they are sorted with respect to the RangeInfo <operator
249250
llvm::SmallVector<OverlappingRanges> Overlaps;
250251
using GroupT = std::pair<dxil::ResourceClass, /*Space*/ uint32_t>;
251252

0 commit comments

Comments
 (0)