Commit 5b3b21f0 authored by Amy Huang's avatar Amy Huang
Browse files

[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
parent ab16ef17
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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()) {
+272 −195

File changed.

Preview size limit exceeded, changes collapsed.