Skip to content

Commit 56cb554

Browse files
[NFC] Updating Debug Info generation for 'this' (#119445)
This is PR is updating the debug info generation for `this`. This is required to fix the generation of debug information for HLSL RWBuffer type. This was required from another PR: https://github.com/llvm/llvm-project/pull/119041/files Co-authored-by: Joao Saffran <[email protected]>
1 parent ad32576 commit 56cb554

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,28 +2021,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
20212021
// ThisPtr may be null if the member function has an explicit 'this'
20222022
// parameter.
20232023
if (!ThisPtr.isNull()) {
2024-
const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl();
2025-
if (isa<ClassTemplateSpecializationDecl>(RD)) {
2026-
// Create pointer type directly in this case.
2027-
const PointerType *ThisPtrTy = cast<PointerType>(ThisPtr);
2028-
uint64_t Size = CGM.getContext().getTypeSize(ThisPtrTy);
2029-
auto Align = getTypeAlignIfRequired(ThisPtrTy, CGM.getContext());
2030-
llvm::DIType *PointeeType =
2031-
getOrCreateType(ThisPtrTy->getPointeeType(), Unit);
2032-
llvm::DIType *ThisPtrType =
2033-
DBuilder.createPointerType(PointeeType, Size, Align);
2034-
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
2035-
// TODO: This and the artificial type below are misleading, the
2036-
// types aren't artificial the argument is, but the current
2037-
// metadata doesn't represent that.
2038-
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
2039-
Elts.push_back(ThisPtrType);
2040-
} else {
2041-
llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
2042-
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
2043-
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
2044-
Elts.push_back(ThisPtrType);
2045-
}
2024+
llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
2025+
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
2026+
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
2027+
Elts.push_back(ThisPtrType);
20462028
}
20472029

20482030
// Copy rest of the arguments.

0 commit comments

Comments
 (0)