[PATCH] D100630: [Debug-Info][DBX] DW_TAG_rvalue_reference_type should not be generated when dwarf version is smaller than 4
ChenZheng via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 20 03:12:03 PDT 2021
shchenz updated this revision to Diff 346680.
shchenz added a comment.
1: use the solution in the FE
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100630/new/
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 -gstrict-dwarf -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 -gstrict-dwarf -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;
+ // DW_TAG_rvalue_reference_type was introduced in DWARF 4.
+ if (CGM.getCodeGenOpts().DebugStrictDwarf &&
+ 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100630.346680.patch
Type: text/x-patch
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210520/b386008f/attachment.bin>
More information about the cfe-commits
mailing list