Skip to content

Commit c45f825

Browse files
tcorringhamtex3d
andauthored
Update tools/clang/lib/CodeGen/CGHLSLMS.cpp
Adopting code suggested in review - there can only be one concrete base so the sort step isn't required. Co-authored-by: Tex Riddell <[email protected]>
1 parent a2df420 commit c45f825

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

tools/clang/lib/CodeGen/CGHLSLMS.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,24 +2570,15 @@ bool CGMSHLSLRuntime::FindDispatchGridSemantic(const CXXRecordDecl *RD,
25702570
CharUnits Offset) {
25712571
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
25722572

2573-
// Collect any bases.
2574-
SmallVector<const CXXRecordDecl *, 4> Bases;
2573+
// Check (non-virtual) bases
25752574
for (const CXXBaseSpecifier &Base : RD->bases()) {
2576-
if (!Base.getType()->isDependentType())
2577-
Bases.push_back(Base.getType()->getAsCXXRecordDecl());
2578-
}
2579-
2580-
// Sort bases by offset.
2581-
std::stable_sort(Bases.begin(), Bases.end(),
2582-
[&](const CXXRecordDecl *L, const CXXRecordDecl *R) {
2583-
return Layout.getBaseClassOffset(L) <
2584-
Layout.getBaseClassOffset(R);
2585-
});
2586-
2587-
// Check bases in order
2588-
for (const CXXRecordDecl *Base : Bases) {
2589-
CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base);
2590-
if (FindDispatchGridSemantic(Base, SDGRec, BaseOffset))
2575+
DXASSERT(!Base.getType()->isDependentType(),
2576+
"Node Record with dependent base class not caught by Sema");
2577+
if (Base.isVirtual() || Base.getType()->isDependentType())
2578+
continue;
2579+
CXXRecordDecl *BaseDecl = Base.getType()->getAsCXXRecordDecl();
2580+
CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(BaseDecl);
2581+
if (FindDispatchGridSemantic(BaseDecl, SDGRec, BaseOffset))
25912582
return true;
25922583
}
25932584

0 commit comments

Comments
 (0)