[PATCH] D18236: DebugInfo: Add ability to not emit DW_AT_vtable_elem_location for virtual functions.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 11:49:59 PDT 2016

pcc added a comment.

Duncan wrote:

> Judicious use of `CHECK-SAME: , ...` will let you cherry-pick the interesting fields.


Comment at: lib/IR/DIBuilder.cpp:698
@@ -697,3 +697,3 @@
                     LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
-                    ScopeLine, nullptr, 0, 0, Flags, isOptimized, TParams, Decl,
-                    MDTuple::getTemporary(VMContext, None).release());
+                    ScopeLine, nullptr, 0, -1u, Flags, isOptimized, TParams,
+                    Decl, MDTuple::getTemporary(VMContext, None).release());
dblaikie wrote:
> Is zero not sufficient in this spot (& the other below) - since we still have it conditional on virtuality anyway?
Almost, but the IR writer output is not conditional on virtuality, so for example if a client used `DIBuilder::createFunction` to create a subprogram the IR writer's output for that subprogram would include a zero virtualIndex. Not a major point, but it does make the IR writer output a little easier to match against.

Comment at: test/Assembler/disubprogram.ll:34
@@ -33,3 +33,3 @@
-!10 = !{i32 1, !"Debug Info Version", i32 3}
-!llvm.module.flags = !{!10}
+; CHECK: !10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1, file: !2, line: 7, type: !3, isLocal: true, isDefinition: true, scopeLine: 8, containingType: !4, virtuality: DW_VIRTUALITY_pure_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: true, templateParams: !5, declaration: !8, variables: !6)
+!10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
dblaikie wrote:
> What's this test testing? I can't quite see what's new/unique/interesting about it.
This is testing the changed functionality in the IR writer.

Comment at: test/DebugInfo/Generic/virtual-index.ll:46
@@ +45,3 @@
+; CHECK: DW_TAG_subprogram [
+; CHECK: DW_AT_vtable_elem_location [DW_FORM_exprloc]  (<0x2> 10 00 )
dblaikie wrote:
> Given the verbosity of the IR, we usually put all the CHECK lines up above the IR (& include the C++ source that the IR is derived/generate from for illustrative purposes in a comment above the CHECK lines)


More information about the llvm-commits mailing list