[PATCH] D45123: [CodeView] Emit function options for subprogram and member functions

Hui Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 16:26:23 PDT 2018


Hui added inline comments.


================
Comment at: CodeGen/AsmPrinter/CodeViewDebug.cpp:334
+
+static bool hasVirtualBase(const DICompositeType *DCTy) {
+  for (auto *Element : DCTy->getElements()) {
----------------
rnk wrote:
> This isn't going to work. The frontend is going to need to tag classes with the information you want. Consider this example:
> ```
> struct A {};
> struct B : virtual A {
>   B();
> };
> struct C : B {
>   C();
> };
> C::C() {}
> ```
> 
> Clang will only emit a forward declaration for B, so you won't be able to walk the whole class hierarchy.
Yes. You are right. However it depends on whether Clang would like to emit complete type for B or not. This routine is transparent to incomplete/complete type of UDT.

clang only emts forwarded B.

```
 Struct (0x1001) {
    TypeLeafKind: LF_STRUCTURE (0x1505)
    MemberCount: 0
    Properties [ (0x280)
      ForwardReference (0x80)
      HasUniqueName (0x200)
    ]
    FieldList: 0x0
    DerivedFrom: 0x0
    VShape: 0x0
    SizeOf: 0
    Name: B
    LinkageName: .?AUB@@
  }
```
 MSVC emits both.

```
 Struct (0x1001) {
    TypeLeafKind: LF_STRUCTURE (0x1505)
    MemberCount: 0
    Properties [ (0x280)
      ForwardReference (0x80)
      HasUniqueName (0x200)
    ]
    FieldList: 0x0
    DerivedFrom: 0x0
    VShape: 0x0
    SizeOf: 0
    Name: B
    LinkageName: .?AUB@@
  }

  Struct (0x101A) {
    TypeLeafKind: LF_STRUCTURE (0x1505)
    MemberCount: 6
    Properties [ (0x226)
      HasConstructorOrDestructor (0x2)
      HasOverloadedAssignmentOperator (0x20)
      HasOverloadedOperator (0x4)
      HasUniqueName (0x200)
    ]
    FieldList: <field list> (0x1019)
    DerivedFrom: 0x0
    VShape: 0x0
    SizeOf: 8
    Name: B
    LinkageName: .?AUB@@
  }
```



Repository:
  rL LLVM

https://reviews.llvm.org/D45123





More information about the llvm-commits mailing list