[PATCH] D87062: [DebugInfo] Add size to class declarations in debug info.

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 11:04:09 PDT 2020


akhuang updated this revision to Diff 289768.
akhuang added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87062

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-class.cpp


Index: clang/test/CodeGenCXX/debug-info-class.cpp
===================================================================
--- clang/test/CodeGenCXX/debug-info-class.cpp
+++ clang/test/CodeGenCXX/debug-info-class.cpp
@@ -136,7 +136,7 @@
 // CHECK: [[C_DTOR]] = !DISubprogram(name: "~C"
 
 // CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D"
-// CHECK-NOT:              size:
+// CHECK-SAME:             size:
 // CHECK-SAME:             DIFlagFwdDecl
 // CHECK-NOT:              identifier:
 // CHECK-SAME:             ){{$}}
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1031,6 +1031,10 @@
   uint64_t Size = 0;
   uint32_t Align = 0;
 
+  const RecordDecl *D = RD->getDefinition();
+  if (D && D->isCompleteDefinition())
+    Size = CGM.getContext().getTypeSize(Ty);
+
   llvm::DINode::DIFlags Flags = llvm::DINode::FlagFwdDecl;
 
   // Add flag to nontrivial forward declarations. To be consistent with MSVC,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87062.289768.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200903/41ac5011/attachment.bin>


More information about the llvm-commits mailing list