[clang] Revert "[DebugInfo] Add flag to only emit referenced member functions" (PR #93767)
Mehdi Amini via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 21:48:15 PDT 2024
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/93767
Reverts llvm/llvm-project#87018
MacOS and Windows bots are broken.
>From a35c320e18ba2abad17eab0ed162c4115601a828 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 29 May 2024 22:47:35 -0600
Subject: [PATCH] Revert "[DebugInfo] Add flag to only emit referenced member
functions (#87018)"
This reverts commit bfabc958c7c0d7ddc15f23383d9da836e8c6093f.
---
clang/include/clang/Basic/DebugOptions.def | 2 --
clang/include/clang/Driver/Options.td | 4 ----
clang/lib/CodeGen/CGDebugInfo.cpp | 2 +-
clang/lib/Driver/ToolChains/Clang.cpp | 15 ---------------
.../CodeGenCXX/debug-info-incomplete-types.cpp | 12 ------------
clang/test/Driver/debug-options.c | 8 --------
6 files changed, 1 insertion(+), 42 deletions(-)
delete mode 100644 clang/test/CodeGenCXX/debug-info-incomplete-types.cpp
diff --git a/clang/include/clang/Basic/DebugOptions.def b/clang/include/clang/Basic/DebugOptions.def
index bc96d5dfdf890..b94f6aef9ac60 100644
--- a/clang/include/clang/Basic/DebugOptions.def
+++ b/clang/include/clang/Basic/DebugOptions.def
@@ -68,8 +68,6 @@ BENIGN_DEBUGOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
///< inline line tables.
DEBUGOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
-DEBUGOPT(DebugOmitUnreferencedMethods, 1, 0) ///< Omit unreferenced member
- ///< functions in type debug info.
/// Control the Assignment Tracking debug info feature.
BENIGN_ENUM_DEBUGOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2,
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index f64d7c60783e9..4119e69c85540 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4345,10 +4345,6 @@ defm strict_dwarf : BoolOption<"g", "strict-dwarf",
"the specified version, avoiding features from later versions.">,
NegFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>,
Group<g_flags_Group>;
-defm omit_unreferenced_methods : BoolGOption<"omit-unreferenced-methods",
- CodeGenOpts<"DebugOmitUnreferencedMethods">, DefaultFalse,
- NegFlag<SetFalse>,
- PosFlag<SetTrue, [], [CC1Option]>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>;
defm column_info : BoolOption<"g", "column-info",
CodeGenOpts<"DebugColumnInfo">, DefaultTrue,
NegFlag<SetFalse, [], [ClangOption, CC1Option]>,
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 5f6f911c7a6d6..9d7107abf8a6f 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2836,7 +2836,7 @@ CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
// Collect data fields (including static variables and any initializers).
CollectRecordFields(RD, DefUnit, EltTys, FwdDecl);
- if (CXXDecl && !CGM.getCodeGenOpts().DebugOmitUnreferencedMethods)
+ if (CXXDecl)
CollectCXXMemberFunctions(CXXDecl, DefUnit, EltTys, FwdDecl);
LexicalBlockStack.pop_back();
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4e1c52462e584..97e451cfe2acb 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -45,7 +45,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Config/llvm-config.h"
-#include "llvm/Frontend/Debug/Options.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CodeGen.h"
@@ -4643,7 +4642,6 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
Args.addOptInFlag(CmdArgs, options::OPT_fforce_dwarf_frame,
options::OPT_fno_force_dwarf_frame);
- bool EnableTypeUnits = false;
if (Args.hasFlag(options::OPT_fdebug_types_section,
options::OPT_fno_debug_types_section, false)) {
if (!(T.isOSBinFormatELF() || T.isOSBinFormatWasm())) {
@@ -4654,24 +4652,11 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
} else if (checkDebugInfoOption(
Args.getLastArg(options::OPT_fdebug_types_section), Args, D,
TC)) {
- EnableTypeUnits = true;
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-generate-type-units");
}
}
- if (const Arg *A =
- Args.getLastArg(options::OPT_gomit_unreferenced_methods,
- options::OPT_gno_omit_unreferenced_methods))
- (void)checkDebugInfoOption(A, Args, D, TC);
- if (Args.hasFlag(options::OPT_gomit_unreferenced_methods,
- options::OPT_gno_omit_unreferenced_methods, false) &&
- (DebugInfoKind == llvm::codegenoptions::DebugInfoConstructor ||
- DebugInfoKind == llvm::codegenoptions::LimitedDebugInfo) &&
- !EnableTypeUnits) {
- CmdArgs.push_back("-gomit-unreferenced-methods");
- }
-
// To avoid join/split of directory+filename, the integrated assembler prefers
// the directory form of .file on all DWARF versions. GNU as doesn't allow the
// form before DWARF v5.
diff --git a/clang/test/CodeGenCXX/debug-info-incomplete-types.cpp b/clang/test/CodeGenCXX/debug-info-incomplete-types.cpp
deleted file mode 100644
index 0bf59233b4e2e..0000000000000
--- a/clang/test/CodeGenCXX/debug-info-incomplete-types.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -debug-info-kind=limited -gomit-unreferenced-methods %s -emit-llvm -o - | FileCheck %s
-
-struct t1 {
- void f1();
- void f2();
-};
-
-void t1::f1() { }
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1"
-// CHECK-SAME: elements: [[ELEMENTS:![0-9]+]]
-// CHECK: [[ELEMENTS]] = !{}
diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index b09238d7b6bb6..7d061410a229f 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -242,11 +242,6 @@
// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
// RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
//
-// RUN: %clang -### -c -gomit-unreferenced-methods %s 2>&1 | FileCheck -check-prefix=INCTYPES %s
-// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s
-// RUN: %clang -### -c -gomit-unreferenced-methods -fdebug-types-section %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s
-// RUN: %clang -### -c -gomit-unreferenced-methods -fstandalone-debug %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s
-//
// RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
// RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
//
@@ -386,9 +381,6 @@
// RNGBSE: -fdebug-ranges-base-address
// NORNGBSE-NOT: -fdebug-ranges-base-address
//
-// INCTYPES: -gomit-unreferenced-methods
-// NOINCTYPES-NOT: -gomit-unreferenced-methods
-//
// GARANGE-DAG: -generate-arange-section
//
// FDTS: "-mllvm" "-generate-type-units"
More information about the cfe-commits
mailing list