[clang] 05777ab - Temporarily Revert "[DebugInfo] Move constructor homing case in shouldOmitDefinition."
Eric Christopher via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 21:53:41 PDT 2020
Author: Eric Christopher
Date: 2020-08-24T21:51:31-07:00
New Revision: 05777ab941063192b9ccb1775358a83a2700ccc1
URL: https://github.com/llvm/llvm-project/commit/05777ab941063192b9ccb1775358a83a2700ccc1
DIFF: https://github.com/llvm/llvm-project/commit/05777ab941063192b9ccb1775358a83a2700ccc1.diff
LOG: Temporarily Revert "[DebugInfo] Move constructor homing case in shouldOmitDefinition."
as it's causing test failures.
This reverts commit 589ce5f7050dd83fd3f7dbc182ea0fb051ece994.
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c2929d027a1b..e3442ecd4bd5 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2260,25 +2260,6 @@ static bool hasExplicitMemberDefinition(CXXRecordDecl::method_iterator I,
return false;
}
-static bool canUseCtorHoming(const CXXRecordDecl *RD) {
- // Constructor homing can be used for classes that have at least one
- // constructor and have no trivial or constexpr constructors.
- // Skip this optimization if the class or any of its methods are marked
- // dllimport.
- if (RD->isLambda() || RD->hasConstexprNonCopyMoveConstructor() ||
- isClassOrMethodDLLImport(RD))
- return false;
-
- if (RD->ctors().empty())
- return false;
-
- for (const auto *Ctor : RD->ctors())
- if (Ctor->isTrivial() && !Ctor->isCopyOrMoveConstructor())
- return false;
-
- return true;
-}
-
static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
bool DebugTypeExtRefs, const RecordDecl *RD,
const LangOptions &LangOpts) {
@@ -2313,6 +2294,23 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
!isClassOrMethodDLLImport(CXXDecl))
return true;
+ // In constructor debug mode, only emit debug info for a class when its
+ // constructor is emitted. Skip this optimization if the class or any of
+ // its methods are marked dllimport.
+ //
+ // This applies to classes that don't have any trivial constructors and have
+ // at least one constructor.
+ if (DebugKind == codegenoptions::DebugInfoConstructor &&
+ !CXXDecl->isLambda() && !CXXDecl->hasConstexprNonCopyMoveConstructor() &&
+ !isClassOrMethodDLLImport(CXXDecl)) {
+ if (CXXDecl->ctors().empty())
+ return false;
+ for (const auto *Ctor : CXXDecl->ctors())
+ if (Ctor->isTrivial() && !Ctor->isCopyOrMoveConstructor())
+ return false;
+ return true;
+ }
+
TemplateSpecializationKind Spec = TSK_Undeclared;
if (const auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
Spec = SD->getSpecializationKind();
@@ -2322,12 +2320,6 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
CXXDecl->method_end()))
return true;
- // In constructor homing mode, only emit complete debug info for a class
- // when its constructor is emitted.
- if ((DebugKind != codegenoptions::DebugInfoConstructor) &&
- canUseCtorHoming(CXXDecl))
- return true;
-
return false;
}
diff --git a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
index ff0457e94404..4e41c4092bf4 100644
--- a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
@@ -1,7 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %
-
-// Make sure this still works with constructor homing.
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=constructor %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s
// Run again with -gline-tables-only or -gline-directives-only and verify we don't crash. We won't output
// type info at all.
More information about the cfe-commits
mailing list