[PATCH] D94735: CGDebugInfo CreatedLimitedType: Drop file/line for RecordType with invalid location

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 22:11:51 PST 2021


MaskRay updated this revision to Diff 316845.
MaskRay retitled this revision from "CGDebugInfo: Drop unneeded line number for CreatedLimitedType" to "CGDebugInfo CreatedLimitedType: Drop file/line for RecordType with invalid location".
MaskRay edited the summary of this revision.
MaskRay added a comment.

Drop DW_AT_decl_file as well


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94735/new/

https://reviews.llvm.org/D94735

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/X86/x86_64-arguments.c


Index: clang/test/CodeGen/X86/x86_64-arguments.c
===================================================================
--- clang/test/CodeGen/X86/x86_64-arguments.c
+++ clang/test/CodeGen/X86/x86_64-arguments.c
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s | \
 // RUN:   FileCheck %s -check-prefix=CHECK -check-prefix=SSE -check-prefix=NO-AVX512
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | \
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s -target-feature +avx | \
 // RUN:   FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=NO-AVX512
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f | \
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s -target-feature +avx512f | \
 // RUN:   FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=AVX512
 #include <stdarg.h>
 
@@ -545,3 +545,6 @@
 // AVX: @f65(<8 x float> %{{[^,)]+}})
 void f65(struct t65 a0) {
 }
+
+/// The synthesized __va_list_tag does not have file/line fields.
+// CHECK: = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__va_list_tag", size:
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3335,9 +3335,9 @@
   RecordDecl *RD = Ty->getDecl();
 
   // Get overall information about the record type for the debug info.
-  llvm::DIFile *DefUnit = getOrCreateFile(RD->getLocation());
-  const unsigned Line =
-      getLineNumber(RD->getLocation().isValid() ? RD->getLocation() : CurLoc);
+  const SourceLocation Loc = RD->getLocation();
+  llvm::DIFile *DefUnit = Loc.isValid() ? getOrCreateFile(Loc) : nullptr;
+  const unsigned Line = getLineNumber(Loc);
   StringRef RDName = getClassName(RD);
 
   llvm::DIScope *RDContext = getDeclContextDescriptor(RD);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94735.316845.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210115/54e96ecb/attachment.bin>


More information about the cfe-commits mailing list