[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-05 Thread Amy Huang via Phabricator via cfe-commits
akhuang marked an inline comment as done and an inline comment as not done.
akhuang added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

akhuang wrote:
> rnk wrote:
> > aprantl wrote:
> > > dblaikie wrote:
> > > > rnk wrote:
> > > > > @dblaikie @aprantl, does this seem like a reasonable flag to add, or 
> > > > > should we mark record forward decls as trivial/nontrivial instead?
> > > > Currently we only have a trivial/nontrivial flag that goes one way, 
> > > > right? (ie: true/false, not three state true/false/unknown)
> > > > 
> > > > That would present a problem for forward declarations - because for a 
> > > > true forward decl you can't know if it's trivial/non-trivial for 
> > > > passing, right? so that'd present a subtle difference between 
> > > > trivial/non-trivial on a decl (where it might be trivial/unknown) and 
> > > > on a def (where it's trivial/non-trivial), yes?
> > > Should this perhaps be a DI_SPFLAG instead?
> > It's true that there is an ambiguity between known trivial, known 
> > non-trivial, and forward declared, unknown triviality. Amy's solution to 
> > this problem was to mark forward declarations as nontrivial, which matches 
> > the logic MSVC uses to set CxxReturnUdt, but might not be the right thing 
> > for other consumers.
> Alternatively, I guess we can FlagNonTrivial to FlagTrivial, and then we can 
> mark all the unknown things with cxxreturnudt.
maybe this doesn't work because then it would also mark C structs with 
cxxreturnudt.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-05 Thread Amy Huang via Phabricator via cfe-commits
akhuang marked an inline comment as done.
akhuang added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

rnk wrote:
> aprantl wrote:
> > dblaikie wrote:
> > > rnk wrote:
> > > > @dblaikie @aprantl, does this seem like a reasonable flag to add, or 
> > > > should we mark record forward decls as trivial/nontrivial instead?
> > > Currently we only have a trivial/nontrivial flag that goes one way, 
> > > right? (ie: true/false, not three state true/false/unknown)
> > > 
> > > That would present a problem for forward declarations - because for a 
> > > true forward decl you can't know if it's trivial/non-trivial for passing, 
> > > right? so that'd present a subtle difference between trivial/non-trivial 
> > > on a decl (where it might be trivial/unknown) and on a def (where it's 
> > > trivial/non-trivial), yes?
> > Should this perhaps be a DI_SPFLAG instead?
> It's true that there is an ambiguity between known trivial, known 
> non-trivial, and forward declared, unknown triviality. Amy's solution to this 
> problem was to mark forward declarations as nontrivial, which matches the 
> logic MSVC uses to set CxxReturnUdt, but might not be the right thing for 
> other consumers.
Alternatively, I guess we can FlagNonTrivial to FlagTrivial, and then we can 
mark all the unknown things with cxxreturnudt.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-04 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

aprantl wrote:
> dblaikie wrote:
> > rnk wrote:
> > > @dblaikie @aprantl, does this seem like a reasonable flag to add, or 
> > > should we mark record forward decls as trivial/nontrivial instead?
> > Currently we only have a trivial/nontrivial flag that goes one way, right? 
> > (ie: true/false, not three state true/false/unknown)
> > 
> > That would present a problem for forward declarations - because for a true 
> > forward decl you can't know if it's trivial/non-trivial for passing, right? 
> > so that'd present a subtle difference between trivial/non-trivial on a decl 
> > (where it might be trivial/unknown) and on a def (where it's 
> > trivial/non-trivial), yes?
> Should this perhaps be a DI_SPFLAG instead?
It's true that there is an ambiguity between known trivial, known non-trivial, 
and forward declared, unknown triviality. Amy's solution to this problem was to 
mark forward declarations as nontrivial, which matches the logic MSVC uses to 
set CxxReturnUdt, but might not be the right thing for other consumers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-04 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

dblaikie wrote:
> rnk wrote:
> > @dblaikie @aprantl, does this seem like a reasonable flag to add, or should 
> > we mark record forward decls as trivial/nontrivial instead?
> Currently we only have a trivial/nontrivial flag that goes one way, right? 
> (ie: true/false, not three state true/false/unknown)
> 
> That would present a problem for forward declarations - because for a true 
> forward decl you can't know if it's trivial/non-trivial for passing, right? 
> so that'd present a subtle difference between trivial/non-trivial on a decl 
> (where it might be trivial/unknown) and on a def (where it's 
> trivial/non-trivial), yes?
Should this perhaps be a DI_SPFLAG instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-04 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

rnk wrote:
> @dblaikie @aprantl, does this seem like a reasonable flag to add, or should 
> we mark record forward decls as trivial/nontrivial instead?
Currently we only have a trivial/nontrivial flag that goes one way, right? (ie: 
true/false, not three state true/false/unknown)

That would present a problem for forward declarations - because for a true 
forward decl you can't know if it's trivial/non-trivial for passing, right? so 
that'd present a subtle difference between trivial/non-trivial on a decl (where 
it might be trivial/unknown) and on a def (where it's trivial/non-trivial), yes?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b3b21f02588: [DebugInfo] Fix for adding returns cxx 
udt option to functions in CodeView. (authored by akhuang).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -4,7 +4,6 @@
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +31,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +57,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +69,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +82,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +100,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +119,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +136,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C2Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -153,11 +156,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C2Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF3:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 248025.
akhuang added a comment.

remove tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -4,7 +4,6 @@
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +31,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +57,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +69,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +82,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +100,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +119,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +136,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C2Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -153,11 +156,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C2Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF3:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C2Class ({{.*}})
-; CHECK: ThisType: C2Class* 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.

lgtm, but please remove the clang test update from this patch, since it 
shouldn't pass yet.




Comment at: clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp:1
+// RUN: %clang_cc1 -emit-llvm -gcodeview -debug-info-kind=limited %s -o - | 
FileCheck %s
+// Test for NonTrivial flags in debug info.

This test shouldn't be part of the LLVM-only change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang marked an inline comment as done.
akhuang added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:989
+  llvm::DINode::DIFlags Flags = llvm::DINode::FlagFwdDecl;
+  if (const CXXRecordDecl *CXXRD = dyn_cast(RD))
+if (!CXXRD->hasDefinition() ||

rnk wrote:
> I think this code block needs a comment about the behavior we are trying to 
> implement. It could be made CodeView-specific, but I don't see a strong 
> reason not to set these flags when emitting DWARF.
Yep, will add a comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 248001.
akhuang added a comment.

Splitting the forward declaration flag into a different review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -1,10 +1,8 @@
-; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
-; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
+; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
 ;
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +30,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +56,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +68,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +81,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +99,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +118,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +135,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C2Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 248003.
akhuang added a comment.

add back line in test that accidentally got deleted


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -1,10 +1,10 @@
-; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
-; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
+; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
+; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | \
+; RUN:   llvm-readobj - --codeview | FileCheck %s
 ;
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +32,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +58,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +70,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +83,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +101,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +120,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +137,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I think we should commit the change to clang separately from the first one you 
made to LLVM to handle method types. Setting flags on forward declarations is 
something I'd like to get additional input on before landing.




Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:989
+  llvm::DINode::DIFlags Flags = llvm::DINode::FlagFwdDecl;
+  if (const CXXRecordDecl *CXXRD = dyn_cast(RD))
+if (!CXXRD->hasDefinition() ||

I think this code block needs a comment about the behavior we are trying to 
implement. It could be made CodeView-specific, but I don't see a strong reason 
not to set these flags when emitting DWARF.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:990
+  if (const CXXRecordDecl *CXXRD = dyn_cast(RD))
+if (!CXXRD->hasDefinition() ||
+(CXXRD->hasDefinition() && !CXXRD->isTrivial()))

So, we're marking forward declarations here as nontrivial to match MSVC, but we 
don't really know if they will end up being trivial or not. I guess that's fine.



Comment at: clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp:2
+// RUN: %clang_cc1 -emit-llvm -gcodeview -debug-info-kind=limited %s -o - | 
FileCheck %s
+// Test for CxxReturnUdt flags in debug info.
+

Please add a C-only test like this:
```
struct Incomplete;
struct Incomplete (*func_ptr)() = 0;
```
We shouldn't mark this struct as nontrivial, for example. The code you wrote is 
correct, but I wanted to test this corner case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment.

In D75215#1901961 , @rnk wrote:

> BTW, I am curious to know if this helps V8 PDB size. IIRC you said there were 
> some PDBs in Chrome that have this problem a lot.


I think I just noticed that the PDB size increased after enabling constructor 
type homing.

**size of v8.dll.pdb**
-debug-info-kind=limited:175M
-debug-info-kind=constructor: 185M
-debug-info-kind=constructor + this patch: 169M


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-03 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 247937.
akhuang added a comment.

update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -1,10 +1,8 @@
-; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
-; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
+; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
 ;
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +30,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +56,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +68,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +81,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +99,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +118,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +135,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C2Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -153,11 +155,11 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-02 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 247774.
akhuang added a comment.

Add FlagNonTrivial to fwd declared records in CGDebugInfo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-flag-nontrivial.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -1,10 +1,8 @@
-; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
-; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
+; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
 ;
 ; Command to generate function-options.ll
 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
 ;
-;
 ; #define DEFINE_FUNCTION(T) \
 ;   T Func_##T(T ) { return arg; }
 ;
@@ -32,7 +30,11 @@
 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
-; class FClass { static int x; };
+; class FClass {
+;   static int x;
+;   AClass Member_AClass(AClass &);
+;   BClass Member_BClass(BClass &);
+; };
 ; DEFINE_FUNCTION(FClass); // Expect FO = None
 ; 
 ; struct AStruct {};
@@ -54,7 +56,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +68,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -79,11 +81,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (BClass&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF1:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: BClass ({{.*}})
-; CHECK: ThisType: BClass* const ({{.*}})
+; CHECK: ThisType: BClass* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x2)
 ; CHECK:   Constructor (0x2)
@@ -97,17 +99,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Private (0x1)
-; CHECK:   Type: void BClass::() ([[MF1]])
+; CHECK:   Type: void BClass::() ([[CTOR_B]])
 ; CHECK:   Name: BClass
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C1Class ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -116,11 +118,11 @@
 ; CHECK: NumParameters: 1
 ; CHECK: ArgListType: (C1Class&) ({{.*}})
 ; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
+; CHECK:   MemberFunction ([[CTOR_C1:.*]]) {
 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
 ; CHECK: ReturnType: void (0x3)
 ; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
+; CHECK: ThisType: C1Class* {{.*}}
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
@@ -133,17 +135,17 @@
 ; CHECK: OneMethod {
 ; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
 ; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
+; CHECK:   Type: void C1Class::() ([[CTOR_C1]])
 ; CHECK:   Name: C1Class
 ; CHECK: }
 ; CHECK:   }
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
+; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
 ; CHECK: Name: Func_C1Class
 ; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
+; CHECK:   Procedure ([[SP_C2:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: C2Class ({{.*}})
 ; CHECK: 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-02 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment.

In D75215#1899224 , @rnk wrote:

> Now that I've gone this far... maybe we should just say `isNonTrivial() || 
> isFwdDecl()` -> mark it CxxReturnUdt. Something like that.


I just tried this but apparently it ends up marking things as CxxReturnUdt when 
the struct is trivial but not required to be complete--

So it seems like adding the NonTrivial flag to undefined forward declared 
functions would work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-03-02 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

BTW, I am curious to know if this helps V8 PDB size. IIRC you said there were 
some PDBs in Chrome that have this problem a lot.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-02-28 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm!

So, presumably we still do the wrong thing in the non-method type cases. I came 
up with this, where we differ with MSVC:

  struct NonTrivial {
NonTrivial();
NonTrivial(const NonTrivial );
~NonTrivial();
int x;
  };
  struct Foo {
NonTrivial (*fp)(NonTrivial );
  };
  Foo gv;

MSVC marks the LF_PROCEDURE with the flag, but clang doesn't.

It looks like it NonTrivial is incomplete (we have a fwd decl DICompositeType), 
MSVC just marks it with CxxReturnUdt:

  struct NonTrivial;
  struct Foo {
NonTrivial (*fp)(NonTrivial );
  };
  Foo gv;
  
  $ cl -c t.cpp -Z7  && llvm-pdbutil dump -types t.obj | grep -A3 PROCEDU
  Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28315 for x64
  Copyright (C) Microsoft Corporation.  All rights reserved.
  
  t.cpp
  0x1003 | LF_PROCEDURE [size = 16]
   return type = 0x1000, # args = 1, param list = 0x1002
   calling conv = cdecl, options = returns cxx udt

Now that I've gone this far... maybe we should just say `isNonTrivial() || 
isFwdDecl()` -> mark it CxxReturnUdt. Something like that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-02-27 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 247104.
akhuang added a comment.

Just change CodeViewDebug to add CxxReturnUdt to all methods that return a 
record type,
which appears to be consistent with what msvc does and avoids emitting two 
versions of
the method in the pdb file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -33,7 +33,15 @@
 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
 ;
 ; class FClass { static int x; };
-; DEFINE_FUNCTION(FClass); // Expect FO = None
+; DEFINE_FUNCTION(FClass); // Expect: FO = None
+;
+; class GClass;
+; class HClass {
+;   AClass Member_AClass(AClass &); // Expect: FO = CxxReturnUdt
+;   BClass Member_BClass(BClass &); // Expect: FO = CxxReturnUdt
+;   GClass Member_GClass(GClass &); // Expect: FO = CxxReturnUdt
+; }
+; DEFINE_FUNCTION(HClass);
 ; 
 ; struct AStruct {};
 ; DEFINE_FUNCTION(AStruct); // Expect FO = None
@@ -229,6 +237,66 @@
 ; CHECK: FunctionType: FClass (FClass&) ([[SP6]])
 ; CHECK: Name: Func_FClass
 ; CHECK:   }
+; CHECK:   MemberFunction ([[MF_A:.*]]) {
+; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
+; CHECK: ReturnType: AClass ({{.*}})
+; CHECK: ClassType: HClass ({{.*}})
+; CHECK: ThisType: HClass* const ({{.*}})
+; CHECK: CallingConvention: NearC (0x0)
+; CHECK: FunctionOptions [ (0x1)
+; CHECK:   CxxReturnUdt (0x1)
+; CHECK: ]
+; CHECK: NumParameters: 1
+; CHECK: ArgListType: (AClass&) ({{.*}})
+; CHECK: ThisAdjustment: 0
+; CHECK:   }
+; CHECK:   MemberFunction ([[MF_B:.*]]) {
+; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
+; CHECK: ReturnType: BClass ({{.*}})
+; CHECK: ClassType: HClass ({{.*}})
+; CHECK: ThisType: HClass* const ({{.*}})
+; CHECK: CallingConvention: NearC (0x0)
+; CHECK: FunctionOptions [ (0x1)
+; CHECK:   CxxReturnUdt (0x1)
+; CHECK: ]
+; CHECK: NumParameters: 1
+; CHECK: ArgListType: (BClass&) ({{.*}})
+; CHECK: ThisAdjustment: 0
+; CHECK:   }
+; CHECK:   MemberFunction ([[MF_G:.*]]) {
+; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
+; CHECK: ReturnType: GClass ({{.*}})
+; CHECK: ClassType: HClass ({{.*}})
+; CHECK: ThisType: HClass* const ({{.*}})
+; CHECK: CallingConvention: NearC (0x0)
+; CHECK: FunctionOptions [ (0x1)
+; CHECK:   CxxReturnUdt (0x1)
+; CHECK: ]
+; CHECK: NumParameters: 1
+; CHECK: ArgListType: (GClass&) ({{.*}})
+; CHECK: ThisAdjustment: 0
+; CHECK:   }
+; CHECK:   FieldList (0x1043) {
+; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
+; CHECK: OneMethod {
+; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
+; CHECK:   AccessSpecifier: Private (0x1)
+; CHECK:   Type: AClass HClass::(AClass&) ([[MF_A]])
+; CHECK:   Name: Member_AClass
+; CHECK: }
+; CHECK: OneMethod {
+; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
+; CHECK:   AccessSpecifier: Private (0x1)
+; CHECK:   Type: BClass HClass::(BClass&) ([[MF_B]])
+; CHECK:   Name: Member_BClass
+; CHECK: }
+; CHECK: OneMethod {
+; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
+; CHECK:   AccessSpecifier: Private (0x1)
+; CHECK:   Type: GClass HClass::(GClass&) ([[MF_G]])
+; CHECK:   Name: Member_GClass
+; CHECK: }
+; CHECK:   }
 ; CHECK:   Procedure ([[SP7:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AStruct ({{.*}})
@@ -335,11 +403,10 @@
 ; CHECK:   }
 ; CHECK: ]
 
-
 ; ModuleID = 'function-options.cpp'
 source_filename = "function-options.cpp"
-target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc19.15.26729"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.23.28106"
 
 %class.AClass = type { i8 }
 %class.BClass = type { i8 }
@@ -347,6 +414,7 @@
 %class.C2Class = type { i8 }
 %class.DClass = type { i8 }
 %class.FClass = type { i8 }
+%class.HClass = type { i8 }
 %struct.AStruct = type { i8 }
 %struct.BStruct = type { i8 }
 %union.AUnion = type { i8 }
@@ -358,228 +426,278 @@
   %retval = alloca %class.AClass, align 1
   %arg.addr = alloca %class.AClass*, align 8
   store %class.AClass* %arg, %class.AClass** %arg.addr, align 8
-  call void @llvm.dbg.declare(metadata %class.AClass** %arg.addr, metadata !14, metadata !DIExpression()), !dbg !15
-  %0 = load %class.AClass*, %class.AClass** %arg.addr, align 8, !dbg !15
-  %coerce.dive = getelementptr inbounds %class.AClass, %class.AClass* %retval, i32 0, i32 0, !dbg !15
-  %1 = load i8, i8* %coerce.dive, align 1, !dbg !15
-  ret 

[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-02-26 Thread Amy Huang via Phabricator via cfe-commits
akhuang marked an inline comment as done.
akhuang added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:992
   getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,
   llvm::DINode::FlagFwdDecl, Identifier);
   if (CGM.getCodeGenOpts().DebugFwdTemplateParams)

rnk wrote:
> One alternative would be to add `llvm::DINode::FlagNonTrivial` here if the 
> type is complete and not trivial.
> 
> There is the case where the the compiler has to emit a method type when the 
> class has been forward declared, and that could still lead to duplicate 
> records. For example:
> ```
> class Returned;
> class Foo {
>   Foo();
>   Returned bar();
> };
> Foo::Foo() {}
> ```
> In this example, clang will have to describe the method type of Foo::bar, but 
> it will not have access to Returned. I think in practice this won't come up, 
> because Foo::bar will be defined in the same file as the constructor.
I suppose this would be a lot simpler. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-02-26 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:992
   getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,
   llvm::DINode::FlagFwdDecl, Identifier);
   if (CGM.getCodeGenOpts().DebugFwdTemplateParams)

One alternative would be to add `llvm::DINode::FlagNonTrivial` here if the type 
is complete and not trivial.

There is the case where the the compiler has to emit a method type when the 
class has been forward declared, and that could still lead to duplicate 
records. For example:
```
class Returned;
class Foo {
  Foo();
  Returned bar();
};
Foo::Foo() {}
```
In this example, clang will have to describe the method type of Foo::bar, but 
it will not have access to Returned. I think in practice this won't come up, 
because Foo::bar will be defined in the same file as the constructor.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), CxxReturnUdt)
 

@dblaikie @aprantl, does this seem like a reasonable flag to add, or should we 
mark record forward decls as trivial/nontrivial instead?



Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:407
 static bool isNonTrivial(const DICompositeType *DCTy) {
   return ((DCTy->getFlags() & DINode::FlagNonTrivial) == 
DINode::FlagNonTrivial);
 }

Should we assert here that the composite type is not a forward decl, assuming 
we stick with the CxxReturn flag?



Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:420
   // DISubroutineType is unnamed. Use DISubprogram's i.e. SPName in comparison.
   if (ClassTy && isNonTrivial(ClassTy) && SPName == ClassTy->getName()) {
 FO |= FunctionOptions::Constructor;

We also use isNonTrivial here, but I think if we are emitting a method type, it 
means the class must not be a forward declaration?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75215



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


[PATCH] D75215: [DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

2020-02-26 Thread Amy Huang via Phabricator via cfe-commits
akhuang created this revision.
akhuang added reviewers: rnk, asmith.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

This change checks for the return type in the frontend and adds a flag
to the DISubroutineType to indicate that the option should be added in
CodeViewDebug.

Previously function types sometimes appeared twice in the PDB: once with
"returns cxx udt" and once without.
See https://bugs.llvm.org/show_bug.cgi?id=44785.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75215

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-return-udt.cpp
  llvm/include/llvm/IR/DebugInfoFlags.def
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-options.ll

Index: llvm/test/DebugInfo/COFF/function-options.ll
===
--- llvm/test/DebugInfo/COFF/function-options.ll
+++ llvm/test/DebugInfo/COFF/function-options.ll
@@ -17,24 +17,12 @@
 ; };
 ; DEFINE_FUNCTION(BClass); // Expect: FO = CxxReturnUdt
 ;
-; class C1Class {
-; public:
-;   C1Class() = default; // Note: Clang generates one defaulted ctor (FO = None) while MSVC doesn't.
+; class CClass {
+;   AClass Member_AClass(AClass &); // Expect: FO = CxxReturnUdt
+;   BClass Member_BClass(BClass &); // Expect: FO = CxxReturnUdt
 ; };
-; DEFINE_FUNCTION(C1Class); // Expect: FO = None
+; DEFINE_FUNCTION(CClass);
 ;
-; class C2Class { // Note: MSVC-specific dtor, i.e. __vecDelDtor won't be verified in this case.
-; public:
-;   ~C2Class() {} // Expect ~C2Class: FO = None
-; };
-; DEFINE_FUNCTION(C2Class); // Expect: FO = CxxReturnUdt
-;
-; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
-; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
-;
-; class FClass { static int x; };
-; DEFINE_FUNCTION(FClass); // Expect FO = None
-; 
 ; struct AStruct {};
 ; DEFINE_FUNCTION(AStruct); // Expect FO = None
 ;
@@ -54,7 +42,7 @@
 ; CHECK: CodeViewTypes [
 ; CHECK:   Section: .debug$T ({{.*}})
 ; CHECK:   Magic: 0x4
-; CHECK:   Procedure ([[SP1:.*]]) {
+; CHECK:   Procedure ([[SP_A:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: AClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -66,10 +54,10 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: AClass (AClass&) ([[SP1]])
+; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
 ; CHECK: Name: Func_AClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP2:.*]]) {
+; CHECK:   Procedure ([[SP_B:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
 ; CHECK: ReturnType: BClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
@@ -104,132 +92,66 @@
 ; CHECK:   FuncId ({{.*}}) {
 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
 ; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: BClass (BClass&) ([[SP2]])
+; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
 ; CHECK: Name: Func_BClass
 ; CHECK:   }
-; CHECK:   Procedure ([[SP3:.*]]) {
+; CHECK:   Procedure ([[SP_C:.*]]) {
 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
-; CHECK: ReturnType: C1Class ({{.*}})
+; CHECK: ReturnType: CClass ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x0)
 ; CHECK: ]
 ; CHECK: NumParameters: 1
-; CHECK: ArgListType: (C1Class&) ({{.*}})
-; CHECK:   }
-; CHECK:   MemberFunction ([[MF2:.*]]) {
-; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
-; CHECK: ReturnType: void (0x3)
-; CHECK: ClassType: C1Class ({{.*}})
-; CHECK: ThisType: C1Class* const ({{.*}})
-; CHECK: CallingConvention: NearC (0x0)
-; CHECK: FunctionOptions [ (0x0)
-; CHECK: ]
-; CHECK: NumParameters: 0
-; CHECK: ArgListType: () ({{.*}})
-; CHECK: ThisAdjustment: 0
-; CHECK:   }
-; CHECK:   FieldList ({{.*}}) {
-; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
-; CHECK: OneMethod {
-; CHECK:   TypeLeafKind: LF_ONEMETHOD (0x1511)
-; CHECK:   AccessSpecifier: Public (0x3)
-; CHECK:   Type: void C1Class::() ([[MF2]])
-; CHECK:   Name: C1Class
-; CHECK: }
-; CHECK:   }
-; CHECK:   FuncId ({{.*}}) {
-; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
-; CHECK: ParentScope: 0x0
-; CHECK: FunctionType: C1Class (C1Class&) ([[SP3]])
-; CHECK: Name: Func_C1Class
-; CHECK:   }
-; CHECK:   Procedure ([[SP4:.*]]) {
-; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
-; CHECK: ReturnType: C2Class ({{.*}})
+; CHECK: ArgListType: (CClass&) (0x1016)
+; CHECK:  }
+; CHECK:   MemberFunction ([[MF_A:.*]]) {
+; CHECK: TypeLeafKind: LF_MFUNCTION ({{.*}})
+; CHECK: ReturnType: AClass ({{.*}})
+; CHECK: ClassType: CClass ({{.*}})
+; CHECK: ThisType: CClass* const ({{.*}})
 ; CHECK: CallingConvention: NearC (0x0)
 ; CHECK: FunctionOptions [ (0x1)
 ;