[clang] [HLSL] Fix debug info generation for RWBuffer types (PR #119041)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 9 13:20:46 PST 2024
================
@@ -2021,28 +2021,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
// ThisPtr may be null if the member function has an explicit 'this'
// parameter.
if (!ThisPtr.isNull()) {
- const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl();
- if (isa<ClassTemplateSpecializationDecl>(RD)) {
----------------
joaosaffran wrote:
Well, this is a consequence of the `this` fix, the same done in DXC. After applying the fix the code becomes:
```c++
if (isa<ClassTemplateSpecializationDecl>(RD)) {
// HLSL Change Begin - This is a reference.
llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
// HLSL Change End - This is a reference.
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
// TODO: This and the artificial type below are misleading, the
// types aren't artificial the argument is, but the current
// metadata doesn't represent that.
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
Elts.push_back(ThisPtrType);
} else {
llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
Elts.push_back(ThisPtrType);
}
```
Removing the comments, if and else blocks become the same code, so I just removed the branching
https://github.com/llvm/llvm-project/pull/119041
More information about the cfe-commits
mailing list