Skip to content

Commit dfaebdb

Browse files
committed
Revert 10fdd09 [clang][DebugInfo] Emit DW_AT_object_pointer on : :SPIRV
1 parent 3f38a6a commit dfaebdb

File tree

7 files changed

+27
-39
lines changed

7 files changed

+27
-39
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,29 +2067,20 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType(
20672067
// First element is always return type. For 'void' functions it is NULL.
20682068
Elts.push_back(Args[0]);
20692069

2070-
const bool HasExplicitObjectParameter = ThisPtr.isNull();
2071-
2072-
// "this" pointer is always first argument. For explicit "this"
2073-
// parameters, it will already be in Args[1].
2074-
if (!HasExplicitObjectParameter) {
2070+
// "this" pointer is always first argument.
2071+
// ThisPtr may be null if the member function has an explicit 'this'
2072+
// parameter.
2073+
if (!ThisPtr.isNull()) {
20752074
llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit);
20762075
TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType);
2077-
ThisPtrType =
2078-
DBuilder.createObjectPointerType(ThisPtrType, /*Implicit=*/true);
2076+
ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType);
20792077
Elts.push_back(ThisPtrType);
20802078
}
20812079

20822080
// Copy rest of the arguments.
20832081
for (unsigned i = 1, e = Args.size(); i != e; ++i)
20842082
Elts.push_back(Args[i]);
20852083

2086-
// Attach FlagObjectPointer to the explicit "this" parameter.
2087-
if (HasExplicitObjectParameter) {
2088-
assert(Elts.size() >= 2 && Args.size() >= 2 &&
2089-
"Expected at least return type and object parameter.");
2090-
Elts[1] = DBuilder.createObjectPointerType(Args[1], /*Implicit=*/false);
2091-
}
2092-
20932084
llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
20942085

20952086
return DBuilder.createSubroutineType(EltTypeArray, OriginalFunc->getFlags(),
@@ -5508,7 +5499,7 @@ llvm::DIType *CGDebugInfo::CreateSelfType(const QualType &QualTy,
55085499
llvm::DIType *CachedTy = getTypeOrNull(QualTy);
55095500
if (CachedTy)
55105501
Ty = CachedTy;
5511-
return DBuilder.createObjectPointerType(Ty, /*Implicit=*/true);
5502+
return DBuilder.createObjectPointerType(Ty);
55125503
}
55135504

55145505
void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(

clang/test/CodeGenCXX/debug-info-object-pointer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
66
// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer
77
//
8+
// // FIXME: DIFlagObjectPointer not attached to the explicit object
9+
// // argument in the subprogram declaration.
810
// CHECK: !DISubprogram(name: "explicit_this",
911
// flags: DIFlagPrototyped
10-
//
11-
// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type
12-
// CHECK-SAME: flags: DIFlagObjectPointer)
12+
// CHECK-NOT: DIFlagObjectPointer
13+
// CHECK-NOT: DIFlagArtificial
1314
//
1415
// CHECK: !DILocalVariable(name: "this", arg: 1
1516
// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer

llvm/include/llvm-c/DebugInfo.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -876,16 +876,13 @@ LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
876876
LLVMMetadataRef Ty);
877877

878878
/**
879-
* Create a uniqued DIType* clone with FlagObjectPointer. If \c Implicit
880-
* is true, then also set FlagArtificial.
879+
* Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
881880
* \param Builder The DIBuilder.
882881
* \param Type The underlying type to which this pointer points.
883-
* \param Implicit Indicates whether this pointer was implicitly generated
884-
* (i.e., not spelled out in source).
885882
*/
886-
LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
887-
LLVMMetadataRef Type,
888-
LLVMBool Implicit);
883+
LLVMMetadataRef
884+
LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
885+
LLVMMetadataRef Type);
889886

890887
/**
891888
* Create debugging information entry for a qualified

llvm/include/llvm/IR/DIBuilder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,9 @@ namespace llvm {
681681
/// Create a uniqued clone of \p Ty with FlagArtificial set.
682682
static DIType *createArtificialType(DIType *Ty);
683683

684-
/// Create a uniqued clone of \p Ty with FlagObjectPointer set.
685-
/// If \p Implicit is true, also set FlagArtificial.
686-
static DIType *createObjectPointerType(DIType *Ty, bool Implicit);
684+
/// Create a uniqued clone of \p Ty with FlagObjectPointer and
685+
/// FlagArtificial set.
686+
static DIType *createObjectPointerType(DIType *Ty);
687687

688688
/// Create a permanent forward-declared type.
689689
DICompositeType *createForwardDecl(unsigned Tag, StringRef Name,

llvm/lib/IR/DIBuilder.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,11 @@ DIType *DIBuilder::createArtificialType(DIType *Ty) {
650650
return createTypeWithFlags(Ty, DINode::FlagArtificial);
651651
}
652652

653-
DIType *DIBuilder::createObjectPointerType(DIType *Ty, bool Implicit) {
653+
DIType *DIBuilder::createObjectPointerType(DIType *Ty) {
654654
// FIXME: Restrict this to the nodes where it's valid.
655655
if (Ty->isObjectPointer())
656656
return Ty;
657-
DINode::DIFlags Flags = DINode::FlagObjectPointer;
658-
659-
if (Implicit)
660-
Flags |= DINode::FlagArtificial;
661-
657+
DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
662658
return createTypeWithFlags(Ty, Flags);
663659
}
664660

llvm/lib/IR/DebugInfo.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,11 +1472,10 @@ LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
14721472
PropertyAttributes, unwrapDI<DIType>(Ty)));
14731473
}
14741474

1475-
LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
1476-
LLVMMetadataRef Type,
1477-
LLVMBool Implicit) {
1478-
return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI<DIType>(Type),
1479-
Implicit));
1475+
LLVMMetadataRef
1476+
LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
1477+
LLVMMetadataRef Type) {
1478+
return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI<DIType>(Type)));
14801479
}
14811480

14821481
LLVMMetadataRef

revert_patches.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ Ron and Vigneshwar
2424
revert: breaks rocBLAS build
2525
d57230c7 [AMDGPU][MC] Disallow op_sel in some VOP3P dot instructions (#100485)
2626
---
27+
revert : spirv build breaks
28+
10fdd09c3bda [clang][DebugInfo] Emit DW_AT_object_pointer on function declarations with explicit `this` (#122928)
29+
Ron and Alex
30+
---

0 commit comments

Comments
 (0)