shchenz created this revision. shchenz added reviewers: dblaikie, aprantl, probinson, jsji, Esme, echristo, PowerPC. shchenz added a project: debug-info. shchenz requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
As discussed in D99250 <https://reviews.llvm.org/D99250> , we added a new tuning debugger DBX(D99400 <https://reviews.llvm.org/D99400>) to add some debug info customizations for DBX on AIX. This is part of the customizations, not generating DWARF infos not matching the DWARF version. This is for DW_TAG_rvalue_reference_type tag. Now for DBX, we only generate this tag when DWARF version is 4 or higher. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D100630 Files: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp Index: clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp =================================================================== --- clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp +++ clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp @@ -1,4 +1,8 @@ // RUN: %clang_cc1 -std=c++11 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -dwarf-version=4 -debugger-tuning=dbx -emit-llvm -debug-info-kind=limited \ +// RUN: -triple x86_64-apple-darwin %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -dwarf-version=3 -debugger-tuning=dbx -emit-llvm -debug-info-kind=limited \ +// RUN: -triple x86_64-apple-darwin %s -o - | FileCheck %s --check-prefix=NORVALUE extern "C" { extern int printf(const char * format, ...); @@ -10,3 +14,4 @@ // CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]], size: 64) // CHECK: ![[INT]] = !DIBasicType(name: "int" +// NORVALUE: !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT:[0-9]+]], size: 64) Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -2989,8 +2989,13 @@ llvm::DIType *CGDebugInfo::CreateType(const RValueReferenceType *Ty, llvm::DIFile *Unit) { - return CreatePointerLikeType(llvm::dwarf::DW_TAG_rvalue_reference_type, Ty, - Ty->getPointeeType(), Unit); + llvm::dwarf::Tag Tag = llvm::dwarf::DW_TAG_rvalue_reference_type; + // For DBX, we generate DWARF 4 tag at DWARF version no less than 4. + if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::DBX && + CGM.getCodeGenOpts().DwarfVersion < 4) + Tag = llvm::dwarf::DW_TAG_reference_type; + + return CreatePointerLikeType(Tag, Ty, Ty->getPointeeType(), Unit); } llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
Index: clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp =================================================================== --- clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp +++ clang/test/CodeGenCXX/debug-info-rvalue-ref.cpp @@ -1,4 +1,8 @@ // RUN: %clang_cc1 -std=c++11 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -dwarf-version=4 -debugger-tuning=dbx -emit-llvm -debug-info-kind=limited \ +// RUN: -triple x86_64-apple-darwin %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -dwarf-version=3 -debugger-tuning=dbx -emit-llvm -debug-info-kind=limited \ +// RUN: -triple x86_64-apple-darwin %s -o - | FileCheck %s --check-prefix=NORVALUE extern "C" { extern int printf(const char * format, ...); @@ -10,3 +14,4 @@ // CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]], size: 64) // CHECK: ![[INT]] = !DIBasicType(name: "int" +// NORVALUE: !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT:[0-9]+]], size: 64) Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -2989,8 +2989,13 @@ llvm::DIType *CGDebugInfo::CreateType(const RValueReferenceType *Ty, llvm::DIFile *Unit) { - return CreatePointerLikeType(llvm::dwarf::DW_TAG_rvalue_reference_type, Ty, - Ty->getPointeeType(), Unit); + llvm::dwarf::Tag Tag = llvm::dwarf::DW_TAG_rvalue_reference_type; + // For DBX, we generate DWARF 4 tag at DWARF version no less than 4. + if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::DBX && + CGM.getCodeGenOpts().DwarfVersion < 4) + Tag = llvm::dwarf::DW_TAG_reference_type; + + return CreatePointerLikeType(Tag, Ty, Ty->getPointeeType(), Unit); } llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits