diff options
author | Michał Górny <mgorny@gentoo.org> | 2025-01-18 08:59:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-18 07:59:30 +0000 |
commit | c3a935e3f967f8f22f5db240d145459ee621c1e0 (patch) | |
tree | 1faa8a89b622def4d0c5dd1fa7bad3d3094b06df /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 4aedb970097b7ade93127021206199dbb17a4134 (diff) | |
download | llvm-c3a935e3f967f8f22f5db240d145459ee621c1e0.zip llvm-c3a935e3f967f8f22f5db240d145459ee621c1e0.tar.gz llvm-c3a935e3f967f8f22f5db240d145459ee621c1e0.tar.bz2 |
Revert "[clang][DebugInfo] Emit DW_AT_object_pointer on function declarations with explicit `this`" (#123455)
Reverts llvm/llvm-project#122928
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 6cbcaf0..f88f56c 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2016,15 +2016,13 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( // First element is always return type. For 'void' functions it is NULL. Elts.push_back(Args[0]); - const bool HasExplicitObjectParameter = ThisPtr.isNull(); - - // "this" pointer is always first argument. For explicit "this" - // parameters, it will already be in Args[1]. - if (!HasExplicitObjectParameter) { + // "this" pointer is always first argument. + // ThisPtr may be null if the member function has an explicit 'this' + // parameter. + if (!ThisPtr.isNull()) { llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit); TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType); - ThisPtrType = - DBuilder.createObjectPointerType(ThisPtrType, /*Implicit=*/true); + ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType); Elts.push_back(ThisPtrType); } @@ -2032,13 +2030,6 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( for (unsigned i = 1, e = Args.size(); i != e; ++i) Elts.push_back(Args[i]); - // Attach FlagObjectPointer to the explicit "this" parameter. - if (HasExplicitObjectParameter) { - assert(Elts.size() >= 2 && Args.size() >= 2 && - "Expected at least return type and object parameter."); - Elts[1] = DBuilder.createObjectPointerType(Args[1], /*Implicit=*/false); - } - llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); return DBuilder.createSubroutineType(EltTypeArray, OriginalFunc->getFlags(), @@ -5127,7 +5118,7 @@ llvm::DIType *CGDebugInfo::CreateSelfType(const QualType &QualTy, llvm::DIType *CachedTy = getTypeOrNull(QualTy); if (CachedTy) Ty = CachedTy; - return DBuilder.createObjectPointerType(Ty, /*Implicit=*/true); + return DBuilder.createObjectPointerType(Ty); } void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( |