diff options
author | Amy Huang <akhuang@google.com> | 2020-02-04 13:20:13 -0800 |
---|---|---|
committer | Amy Huang <akhuang@google.com> | 2020-03-03 14:00:08 -0800 |
commit | 5b3b21f0258899d03f6299fba6b4c78d7e730353 (patch) | |
tree | e84ddc2f2b8c5bd6221fd0a63ab3ae1d97a2ec81 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | ab16ef17e838377e914a18fcec0fa78375833c36 (diff) | |
download | llvm-5b3b21f0258899d03f6299fba6b4c78d7e730353.zip llvm-5b3b21f0258899d03f6299fba6b4c78d7e730353.tar.gz llvm-5b3b21f0258899d03f6299fba6b4c78d7e730353.tar.bz2 |
[DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.
Summary:
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.
Reviewers: rnk, asmith
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D75215
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 45fe3cf..6dc6fde 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -418,10 +418,11 @@ getFunctionOptions(const DISubroutineType *Ty, ReturnTy = TypeArray[0]; } - if (auto *ReturnDCTy = dyn_cast_or_null<DICompositeType>(ReturnTy)) { - if (isNonTrivial(ReturnDCTy)) + // Add CxxReturnUdt option to functions that return nontrivial record types + // or methods that return record types. + if (auto *ReturnDCTy = dyn_cast_or_null<DICompositeType>(ReturnTy)) + if (isNonTrivial(ReturnDCTy) || ClassTy) FO |= FunctionOptions::CxxReturnUdt; - } // DISubroutineType is unnamed. Use DISubprogram's i.e. SPName in comparison. if (ClassTy && isNonTrivial(ClassTy) && SPName == ClassTy->getName()) { |