dblaikie added inline comments.

================
Comment at: clang/test/CodeGenCXX/debug-info-static-member.cpp:144-147
+// For some reason, const_va is not emitted when the target is MS.
+// NOT-MS: !DIDerivedType(tag: DW_TAG_member, name: "const_va",
+// NOT-MS-SAME:           line: [[@LINE-3]]
+// NOT-MS-SAME:           extraData: i32 42
----------------
akhuang wrote:
> rnk wrote:
> > dblaikie wrote:
> > > Bug or feature? If it's a bug, probably should at least make this comment 
> > > a "FIXME"
> > Feature. The easiest way to understand it is to hallucinate the C++17 
> > `inline` keyword on MSVC static const integer data members with inline 
> > initializers. This metadata is probably emitted in MS mode, but it probably 
> > comes later on.
> Oh, ok. I don't think the metadata for `const_va` is emitted anywhere in MS 
> mode though. I guess it should be.
Not quite sure I follow - even though it's "inline" and thus the actual storage 
for the variable isn't emitted here (because it's just emitted anywhere it's 
needed, so the definition can be ignored)... 

Oh, because the definition is the only root holding the type alive in this file 
- yeah, if the definition is ignored, the type won't be emitted, etc. Fair 
enough. Test might be fixed to be more portable by making the type referenced 
otherwise (eg: declaring a variable that is a pointer to this type, maybe)

Oh, but right... yeah, the virtual dtor is there specifically to test the case 
where there is no type definition.

As to "const_va is not emitted anywhere in MS mode" - I'd have expected it to 
be emitted if the type definition is emitted:
```
!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "x", file: !3, 
line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !7, identifier: 
"_ZTS1x")
!7 = !{!8}
!8 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !6, file: !3, line: 
1, baseType: !9, flags: DIFlagStaticMember, extraData: i32 42)
```
Something like that. But, yeah, if you use a type to hold some constants but 
never emit the type definition anywhere - then you'd never get the static 
member, I suppose.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89072

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to