Author: David Blaikie Date: 2022-06-24T17:07:47Z New Revision: 4821508d4db75a535d02b8938f81fac6de66cc26
URL: https://github.com/llvm/llvm-project/commit/4821508d4db75a535d02b8938f81fac6de66cc26 DIFF: https://github.com/llvm/llvm-project/commit/4821508d4db75a535d02b8938f81fac6de66cc26.diff LOG: Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info" Reverting to simplify some Google-internal rollout issues. Will recommit in a week or two. This reverts commit 517bbc64dbe493644eff8d55fd9566435e930520. Added: clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp Modified: clang/docs/UsersManual.rst clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/Options.td clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/CodeGen/attr-cpuspecific-renaming.cpp clang/test/CodeGen/pr52782-stdcall-func-decl.cpp clang/test/CodeGenCXX/debug-info-class.cpp clang/test/CodeGenCXX/debug-info-limited-ctor.cpp clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp clang/test/CodeGenCXX/debug-lambda-this.cpp clang/test/CodeGenCXX/ibm128-declarations.cpp clang/test/CodeGenCXX/standalone-debug-attribute.cpp clang/test/Driver/cl-options.c clang/test/Driver/clang-g-opts.c clang/test/Driver/cuda-dwarf-2.cu clang/test/Driver/debug-options-as.c clang/test/Driver/debug-options.c clang/test/Driver/integrated-as.s clang/test/Driver/myriad-toolchain.c clang/test/Driver/openmp-offload-gpu.c clang/test/Driver/split-debug.c clang/test/OpenMP/debug_private.c clang/test/OpenMP/debug_task_shared.c clang/test/OpenMP/debug_threadprivate_copyin.c Removed: ################################################################################ diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index ccb5fed1cb370..e12dc72407b13 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -2672,6 +2672,19 @@ below. If multiple flags are present, the last one is used. **-fno-standalone-debug** option can be used to get to turn on the vtable-based optimization described above. +.. option:: -fuse-ctor-homing + + This optimization is similar to the optimizations that are enabled as part + of -fno-standalone-debug. Here, Clang only emits type info for a + non-trivial, non-aggregate C++ class in the modules that contain a + definition of one of its constructors. This relies on the additional + assumption that all classes that are not trivially constructible have a + non-trivial constructor that is used somewhere. The negation, + -fno-use-ctor-homing, ensures that constructor homing is not used. + + This flag is not enabled by default, and needs to be used with -cc1 or + -Xclang. + .. option:: -g Generate complete debug info. diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h index 5f5218c87a605..23d76c308d847 100644 --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -468,7 +468,7 @@ class CodeGenOptions : public CodeGenOptionsBase { /// Check if type and variable info should be emitted. bool hasReducedDebugInfo() const { - return getDebugInfo() >= codegenoptions::LimitedDebugInfo; + return getDebugInfo() >= codegenoptions::DebugInfoConstructor; } /// Check if maybe unused type info should be emitted. diff --git a/clang/include/clang/Basic/DebugInfoOptions.h b/clang/include/clang/Basic/DebugInfoOptions.h index 98210cc3cfa13..a99a2b5903d7e 100644 --- a/clang/include/clang/Basic/DebugInfoOptions.h +++ b/clang/include/clang/Basic/DebugInfoOptions.h @@ -34,6 +34,12 @@ enum DebugInfoKind { /// (-gline-tables-only). DebugLineTablesOnly, + /// Limit generated debug info for classes to reduce size. This emits class + /// type info only where the constructor is emitted, if it is a class that + /// has a constructor. + /// FIXME: Consider combining this with LimitedDebugInfo. + DebugInfoConstructor, + /// Limit generated debug info to reduce size (-fno-standalone-debug). This /// emits forward decls for types that could be replaced with forward decls in /// the source code. For dynamic C++ classes type info is only emitted into diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index e998612d32e2e..81d1d53cea9b1 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5246,6 +5246,11 @@ def mrelocation_model : Separate<["-"], "mrelocation-model">, def fno_math_builtin : Flag<["-"], "fno-math-builtin">, HelpText<"Disable implicit builtin knowledge of math functions">, MarshallingInfoFlag<LangOpts<"NoMathBuiltin">>; +def fno_use_ctor_homing: Flag<["-"], "fno-use-ctor-homing">, + HelpText<"Don't use constructor homing for debug info">; +def fuse_ctor_homing: Flag<["-"], "fuse-ctor-homing">, + HelpText<"Use constructor homing if we are using limited debug info already">; + } // let Flags = [CC1Option, CC1AsOption, NoDriverOption] let Flags = [CC1Option, NoDriverOption] in { diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c9d07cef89dcb..7e9e86763af99 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -27,7 +27,6 @@ #include "clang/AST/RecordLayout.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Basic/CodeGenOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/Version.h" @@ -587,6 +586,7 @@ void CGDebugInfo::CreateCompileUnit() { case codegenoptions::DebugDirectivesOnly: EmissionKind = llvm::DICompileUnit::DebugDirectivesOnly; break; + case codegenoptions::DebugInfoConstructor: case codegenoptions::LimitedDebugInfo: case codegenoptions::FullDebugInfo: case codegenoptions::UnusedTypeInfo: @@ -1861,7 +1861,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction( // In this debug mode, emit type info for a class when its constructor type // info is emitted. - if (DebugKind == codegenoptions::LimitedDebugInfo) + if (DebugKind == codegenoptions::DebugInfoConstructor) if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method)) completeUnusedClass(*CD->getParent()); @@ -2528,7 +2528,7 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, // In constructor homing mode, only emit complete debug info for a class // when its constructor is emitted. - if ((DebugKind == codegenoptions::LimitedDebugInfo) && + if ((DebugKind == codegenoptions::DebugInfoConstructor) && canUseCtorHoming(CXXDecl)) return true; @@ -3349,7 +3349,7 @@ void CGDebugInfo::completeTemplateDefinition( } void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly || D.isDynamicClass()) + if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; completeClassData(&D); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index bcb34d0ffd561..5142b72a160fb 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -26,7 +26,6 @@ #include "clang/Basic/CLWarnings.h" #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Version.h" @@ -526,7 +525,7 @@ static codegenoptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { return codegenoptions::DebugLineTablesOnly; if (A.getOption().matches(options::OPT_gline_directives_only)) return codegenoptions::DebugDirectivesOnly; - return codegenoptions::LimitedDebugInfo; + return codegenoptions::DebugInfoConstructor; } static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) { @@ -1087,6 +1086,9 @@ static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, case codegenoptions::DebugLineTablesOnly: CmdArgs.push_back("-debug-info-kind=line-tables-only"); break; + case codegenoptions::DebugInfoConstructor: + CmdArgs.push_back("-debug-info-kind=constructor"); + break; case codegenoptions::LimitedDebugInfo: CmdArgs.push_back("-debug-info-kind=limited"); break; @@ -2668,7 +2670,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, CmdArgs.push_back(Value.data()); } else { RenderDebugEnablingArgs(Args, CmdArgs, - codegenoptions::LimitedDebugInfo, + codegenoptions::DebugInfoConstructor, DwarfVersion, llvm::DebuggerKind::Default); } } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || @@ -4094,7 +4096,7 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, } } if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::DebugInfoConstructor; // If the last option explicitly specified a debug-info level, use it. if (checkDebugInfoOption(A, Args, D, TC) && @@ -4216,7 +4218,7 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, if (checkDebugInfoOption(A, Args, D, TC)) { if (DebugInfoKind != codegenoptions::DebugLineTablesOnly && DebugInfoKind != codegenoptions::DebugDirectivesOnly) { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::DebugInfoConstructor; CmdArgs.push_back("-dwarf-ext-refs"); CmdArgs.push_back("-fmodule-format=obj"); } @@ -4237,7 +4239,8 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug)) (void)checkDebugInfoOption(A, Args, D, TC); - if (DebugInfoKind == codegenoptions::LimitedDebugInfo) { + if (DebugInfoKind == codegenoptions::LimitedDebugInfo || + DebugInfoKind == codegenoptions::DebugInfoConstructor) { if (Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types, options::OPT_feliminate_unused_debug_types, false)) DebugInfoKind = codegenoptions::UnusedTypeInfo; @@ -5435,7 +5438,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT_fjmc, options::OPT_fno_jmc, false)) { if (TC.getTriple().isOSBinFormatELF()) { - if (DebugInfoKind >= codegenoptions::LimitedDebugInfo) + if (DebugInfoKind >= codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "-fjmc" @@ -7562,7 +7565,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, options::OPT_gline_tables_only)) { *EmitCodeView = true; if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) - *DebugInfoKind = codegenoptions::LimitedDebugInfo; + *DebugInfoKind = codegenoptions::DebugInfoConstructor; else *DebugInfoKind = codegenoptions::DebugLineTablesOnly; } else { @@ -7574,7 +7577,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT__SLASH_JMC, options::OPT__SLASH_JMC_, /*Default=*/false)) { - if (*EmitCodeView && *DebugInfoKind >= codegenoptions::LimitedDebugInfo) + if (*EmitCodeView && *DebugInfoKind >= codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "/JMC" @@ -7899,7 +7902,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, // the guard for source type, however there is a test which asserts // that some assembler invocation receives no -debug-info-kind, // and it's not clear whether that test is just overly restrictive. - DebugInfoKind = (WantDebug ? codegenoptions::LimitedDebugInfo + DebugInfoKind = (WantDebug ? codegenoptions::DebugInfoConstructor : codegenoptions::NoDebugInfo); addDebugPrefixMapArg(getToolChain().getDriver(), getToolChain(), Args, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 0cf5978d8347b..c0eed3ad87485 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1360,6 +1360,9 @@ void CompilerInvocation::GenerateCodeGenArgs( case codegenoptions::DebugDirectivesOnly: DebugInfoVal = "line-directives-only"; break; + case codegenoptions::DebugInfoConstructor: + DebugInfoVal = "constructor"; + break; case codegenoptions::LimitedDebugInfo: DebugInfoVal = "limited"; break; @@ -1634,6 +1637,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, llvm::StringSwitch<unsigned>(A->getValue()) .Case("line-tables-only", codegenoptions::DebugLineTablesOnly) .Case("line-directives-only", codegenoptions::DebugDirectivesOnly) + .Case("constructor", codegenoptions::DebugInfoConstructor) .Case("limited", codegenoptions::LimitedDebugInfo) .Case("standalone", codegenoptions::FullDebugInfo) .Case("unused-types", codegenoptions::UnusedTypeInfo) @@ -1645,6 +1649,18 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.setDebugInfo(static_cast<codegenoptions::DebugInfoKind>(Val)); } + // If -fuse-ctor-homing is set and limited debug info is already on, then use + // constructor homing, and vice versa for -fno-use-ctor-homing. + if (const Arg *A = + Args.getLastArg(OPT_fuse_ctor_homing, OPT_fno_use_ctor_homing)) { + if (A->getOption().matches(OPT_fuse_ctor_homing) && + Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo) + Opts.setDebugInfo(codegenoptions::DebugInfoConstructor); + if (A->getOption().matches(OPT_fno_use_ctor_homing) && + Opts.getDebugInfo() == codegenoptions::DebugInfoConstructor) + Opts.setDebugInfo(codegenoptions::LimitedDebugInfo); + } + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) { auto Split = StringRef(Arg).split('='); Opts.DebugPrefixMap.insert( diff --git a/clang/test/CodeGen/attr-cpuspecific-renaming.cpp b/clang/test/CodeGen/attr-cpuspecific-renaming.cpp index acf2ea83f36fb..4d9086a35c744 100644 --- a/clang/test/CodeGen/attr-cpuspecific-renaming.cpp +++ b/clang/test/CodeGen/attr-cpuspecific-renaming.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,LIN -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-pc -emit-llvm -o - -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,WIN +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,LIN +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-pc -emit-llvm -o - -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,WIN // LIN: @[[S1_NAME:.+]].ifunc = weak_odr ifunc void (%struct.S1*), void (%struct.S1*)* ()* @[[S1_NAME]].resolver // LIN: @[[S2_NAME:.+]].ifunc = weak_odr ifunc void (%struct.S2*), void (%struct.S2*)* ()* @[[S2_NAME]].resolver diff --git a/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp b/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp index 094d386e7a49b..c3c94ece24b2a 100644 --- a/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp +++ b/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s +// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=constructor %s | FileCheck %s enum nsresult {}; diff --git a/clang/test/CodeGenCXX/debug-info-class.cpp b/clang/test/CodeGenCXX/debug-info-class.cpp index 6dbfb005d1982..2ba99d18405b3 100644 --- a/clang/test/CodeGenCXX/debug-info-class.cpp +++ b/clang/test/CodeGenCXX/debug-info-class.cpp @@ -32,13 +32,14 @@ struct D { }; struct E { + E(); virtual ~E(); virtual void func() { } }; struct F { - struct F_inner { + struct inner { }; static const int i = 2; virtual ~F(); @@ -46,7 +47,7 @@ struct F { struct G { virtual void func(); - struct G_inner { + struct inner { int j; }; }; @@ -82,7 +83,7 @@ void f1() { x.func(); E y; int i = F::i; - F::F_inner z; + F::inner z; K k; k.func(); L l; @@ -91,7 +92,7 @@ void f1() { int main(int argc, char **argv) { B b; - G::G_inner c_i; + G::inner c_i; if (argc) { A a; } @@ -115,13 +116,11 @@ int main(int argc, char **argv) { // CHECK-SAME: DIFlagFwdDecl // CHECK-NOT: identifier: // CHECK-SAME: ){{$}} -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A" -// CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" -// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "I" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} +// CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "bar" // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "baz" @@ -174,10 +173,10 @@ int main(int argc, char **argv) { // CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition // CHECK-SAME: declaration: [[L_FUNC_DECL]] -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G_inner", +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 50 // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]] -// CHECK-SAME: identifier: "_ZTSN1G7G_innerE" +// CHECK-SAME: identifier: "_ZTSN1G5innerE" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G" // CHECK-SAME: DIFlagFwdDecl @@ -187,6 +186,8 @@ int main(int argc, char **argv) { // CHECK: [[G_INNER_I]] = !DIDerivedType(tag: DW_TAG_member, name: "j" // CHECK-SAME: baseType: ![[INT]] +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A" +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize" // -// CHECK: ![[EXCEPTLOC]] = !DILocation(line: 99, -// CHECK: ![[RETLOC]] = !DILocation(line: 98, +// CHECK: ![[EXCEPTLOC]] = !DILocation(line: 100, +// CHECK: ![[RETLOC]] = !DILocation(line: 99, diff --git a/clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp b/clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp new file mode 100644 index 0000000000000..4398fa3b532ce --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -debug-info-kind=constructor -emit-llvm %s -o - \ +// RUN: | FileCheck %s -check-prefix=CTOR_HOMING +// RUN: %clang_cc1 -debug-info-kind=limited -fuse-ctor-homing -emit-llvm %s -o - \ +// RUN: | FileCheck %s -check-prefix=CTOR_HOMING +// RUN: %clang_cc1 -debug-info-kind=standalone -fuse-ctor-homing -emit-llvm %s -o - \ +// RUN: | FileCheck %s -check-prefix=FULL_DEBUG +// RUN: %clang_cc1 -debug-info-kind=line-tables-only -fuse-ctor-homing -emit-llvm %s -o - \ +// RUN: | FileCheck %s -check-prefix=NO_DEBUG +// RUN: %clang_cc1 -fuse-ctor-homing -emit-llvm %s -o - \ +// RUN: | FileCheck %s -check-prefix=NO_DEBUG +// +// RUN: %clang_cc1 -debug-info-kind=constructor -fno-use-ctor-homing \ +// RUN: -emit-llvm %s -o - | FileCheck %s -check-prefix=FULL_DEBUG + +// This tests that the -fuse-ctor-homing is only used if limited debug info would have +// been used otherwise. + +// CTOR_HOMING: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}flags: DIFlagFwdDecl +// FULL_DEBUG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue +// NO_DEBUG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "A" +struct A { + A(); +} TestA; diff --git a/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp b/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp index c22d6587e6c70..835e6d4816225 100644 --- a/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp +++ b/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue struct A { diff --git a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp index 4e41c4092bf4e..b756674f54c40 100644 --- a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s +// 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 again with -gline-tables-only or -gline-directives-only and verify we don't crash. We won't output // type info at all. // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s -check-prefix LINES-ONLY diff --git a/clang/test/CodeGenCXX/debug-lambda-this.cpp b/clang/test/CodeGenCXX/debug-lambda-this.cpp index 7368962ac1dfa..eecbac6520ac9 100644 --- a/clang/test/CodeGenCXX/debug-lambda-this.cpp +++ b/clang/test/CodeGenCXX/debug-lambda-this.cpp @@ -12,7 +12,7 @@ int D::d(int x) { }(); } -// CHECK: ![[D:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D", +// CHECK: ![[D:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", // CHECK: ![[POINTER:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[D]], size: 64) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "this", // CHECK-SAME: line: 11 diff --git a/clang/test/CodeGenCXX/ibm128-declarations.cpp b/clang/test/CodeGenCXX/ibm128-declarations.cpp index 0aab887fd62f4..ec06ff1990d12 100644 --- a/clang/test/CodeGenCXX/ibm128-declarations.cpp +++ b/clang/test/CodeGenCXX/ibm128-declarations.cpp @@ -174,7 +174,5 @@ int main(void) { // CHECK: ret void // CHECK: } -// CHECK: [[GF_TYPE:!.*]] = !DIBasicType(name: "__ibm128", size: 128, encoding: DW_ATE_float) -// CHECK: = distinct !DIGlobalVariable(name: "gf", -// CHECK-SAME: type: [[GF_TYPE]], -// CHECK-SAME: isDefinition: true) +// CHECK: !6 = distinct !DIGlobalVariable(name: "gf", scope: !2, file: !7, line: {{[0-9]+}}, type: !8, isLocal: false, isDefinition: true) +// CHECK: !8 = !DIBasicType(name: "__ibm128", size: 128, encoding: DW_ATE_float) diff --git a/clang/test/CodeGenCXX/standalone-debug-attribute.cpp b/clang/test/CodeGenCXX/standalone-debug-attribute.cpp index f7920dcad9f9c..a814e6f425ed6 100644 --- a/clang/test/CodeGenCXX/standalone-debug-attribute.cpp +++ b/clang/test/CodeGenCXX/standalone-debug-attribute.cpp @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=DEBUG -// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=WITHATTR +// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG +// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR +// Use -debug-info-kind=constructor because it includes all the optimizations. #if SETATTR #define STANDALONEDEBUGATTR __attribute__((standalone_debug)) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 939b2e9c178d7..a2e350a0a8355 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -540,11 +540,11 @@ // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" -// Zi: "-debug-info-kind=limited" +// Zi: "-debug-info-kind=constructor" // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s // Z7: "-gcodeview" -// Z7: "-debug-info-kind=limited" +// Z7: "-debug-info-kind=constructor" // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s // ZGMLT: "-gcodeview" @@ -569,7 +569,7 @@ // which made it "win". This test could not detect that bug. // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s // Z7_gdwarf: "-gcodeview" -// Z7_gdwarf: "-debug-info-kind=limited" +// Z7_gdwarf: "-debug-info-kind=constructor" // Z7_gdwarf: "-dwarf-version= // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c index d2e0d440209e1..d982b1070cae1 100644 --- a/clang/test/Driver/clang-g-opts.c +++ b/clang/test/Driver/clang-g-opts.c @@ -31,7 +31,7 @@ // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s // CHECK-WITHOUT-G-NOT: -debug-info-kind -// CHECK-WITH-G: "-debug-info-kind=limited" +// CHECK-WITH-G: "-debug-info-kind=constructor" // CHECK-WITH-G: "-dwarf-version=5" // CHECK-WITH-G-DWARF2: "-dwarf-version=2" diff --git a/clang/test/Driver/cuda-dwarf-2.cu b/clang/test/Driver/cuda-dwarf-2.cu index 6a3dcc39ee6f5..eda9599fe79d4 100644 --- a/clang/test/Driver/cuda-dwarf-2.cu +++ b/clang/test/Driver/cuda-dwarf-2.cu @@ -48,7 +48,7 @@ // HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-fcuda-is-device" -// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}" +// HAS_DEBUG-SAME: "-debug-info-kind={{constructor|line-tables-only}}" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG: ptxas // HAS_DEBUG-SAME: "-g" diff --git a/clang/test/Driver/debug-options-as.c b/clang/test/Driver/debug-options-as.c index 000090062d7d2..87268e8c5deaf 100644 --- a/clang/test/Driver/debug-options-as.c +++ b/clang/test/Driver/debug-options-as.c @@ -23,7 +23,7 @@ // RUN: | FileCheck %s // // CHECK: "-cc1as" -// CHECK: "-debug-info-kind=limited" +// CHECK: "-debug-info-kind=constructor" // Check to make sure clang with -g on a .s file gets passed -dwarf-debug-producer. // rdar://12955296 diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index e946a0bb290d4..04004716aa501 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -313,18 +313,18 @@ // GLIO_ONLY_DWARF2: "-dwarf-version=2" // // G_ONLY: "-cc1" -// G_ONLY: "-debug-info-kind=limited" +// G_ONLY: "-debug-info-kind=constructor" // // These tests assert that "-gline-tables-only" "-g" uses the latter, // but otherwise not caring about the DebugInfoKind. // G_ONLY_DWARF2: "-cc1" -// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}" +// G_ONLY_DWARF2: "-debug-info-kind={{standalone|constructor}}" // G_ONLY_DWARF2: "-dwarf-version=2" // // G_STANDALONE: "-cc1" // G_STANDALONE: "-debug-info-kind=standalone" // G_LIMITED: "-cc1" -// G_LIMITED: "-debug-info-kind=limited" +// G_LIMITED: "-debug-info-kind=constructor" // G_DWARF2: "-dwarf-version=2" // G_DWARF4-DAG: "-dwarf-version=4" // G_DWARF5-DAG: "-dwarf-version=5" @@ -383,7 +383,7 @@ // NOCI-DAG: "-gno-column-info" // // GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" -// GEXTREFS: "-debug-info-kind={{standalone|limited}}" +// GEXTREFS: "-debug-info-kind={{standalone|constructor}}" // RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s // BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind' @@ -414,7 +414,7 @@ // RUN: | FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s // RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s -// NO_DEBUG_UNUSED_TYPES: "-debug-info-kind={{limited|line-tables-only|standalone}}" +// NO_DEBUG_UNUSED_TYPES: "-debug-info-kind={{constructor|line-tables-only|standalone}}" // NO_DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=unused-types" // // RUN: %clang -### -c -gdwarf-5 -gdwarf64 -target x86_64 %s 2>&1 | FileCheck -check-prefix=GDWARF64_ON %s diff --git a/clang/test/Driver/integrated-as.s b/clang/test/Driver/integrated-as.s index 0194a3d5a4382..05999cfe002b5 100644 --- a/clang/test/Driver/integrated-as.s +++ b/clang/test/Driver/integrated-as.s @@ -27,19 +27,19 @@ // XA_INCLUDE2: "-Ifoo_dir" // RUN: %clang -### -target x86_64--- -c -integrated-as %s -gdwarf-4 -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s -// DWARF2: "-debug-info-kind=limited" "-dwarf-version=2" +// DWARF2: "-debug-info-kind=constructor" "-dwarf-version=2" // RUN: %clang -### -target x86_64--- -c -integrated-as %s -gdwarf-3 2>&1 | FileCheck --check-prefix=DWARF3 %s -// DWARF3: "-debug-info-kind=limited" "-dwarf-version=3" +// DWARF3: "-debug-info-kind=constructor" "-dwarf-version=3" // RUN: %clang -### -target x86_64--- -c -integrated-as %s -gdwarf-4 2>&1 | FileCheck --check-prefix=DWARF4 %s -// DWARF4: "-debug-info-kind=limited" "-dwarf-version=4" +// DWARF4: "-debug-info-kind=constructor" "-dwarf-version=4" // RUN: %clang -### -target x86_64--- -c -integrated-as %s -Xassembler -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2XASSEMBLER %s -// DWARF2XASSEMBLER: "-debug-info-kind=limited" "-dwarf-version=2" +// DWARF2XASSEMBLER: "-debug-info-kind=constructor" "-dwarf-version=2" // RUN: %clang -### -target x86_64--- -c -integrated-as %s -Wa,-gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2WA %s -// DWARF2WA: "-debug-info-kind=limited" "-dwarf-version=2" +// DWARF2WA: "-debug-info-kind=constructor" "-dwarf-version=2" // A dwarf version number that driver can't parse is just stuffed in. // RUN: %clang -### -target x86_64--- -c -integrated-as %s -Wa,-gdwarf-huh 2>&1 | FileCheck --check-prefix=BOGODWARF %s diff --git a/clang/test/Driver/myriad-toolchain.c b/clang/test/Driver/myriad-toolchain.c index 4768624381740..f680420804256 100644 --- a/clang/test/Driver/myriad-toolchain.c +++ b/clang/test/Driver/myriad-toolchain.c @@ -83,7 +83,7 @@ // NOSTDLIB-NOT: "-lc" // RUN: %clang -### -c -g %s --target=sparc-myriad 2>&1 | FileCheck -check-prefix=G_SPARC %s -// G_SPARC: "-debug-info-kind=limited" "-dwarf-version=2" +// G_SPARC: "-debug-info-kind=constructor" "-dwarf-version=2" // RUN: %clang -### -c %s --target=sparc-myriad-rtems -fuse-init-array 2>&1 \ // RUN: | FileCheck -check-prefix=USE-INIT-ARRAY %s diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c index 0837cc728e7d5..92020b82cd2ce 100644 --- a/clang/test/Driver/openmp-offload-gpu.c +++ b/clang/test/Driver/openmp-offload-gpu.c @@ -258,7 +258,7 @@ // HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" -// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}" +// HAS_DEBUG-SAME: "-debug-info-kind={{constructor|line-tables-only}}" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-fopenmp-is-device" // HAS_DEBUG: ptxas diff --git a/clang/test/Driver/split-debug.c b/clang/test/Driver/split-debug.c index 00173836bc23d..94db20b554046 100644 --- a/clang/test/Driver/split-debug.c +++ b/clang/test/Driver/split-debug.c @@ -9,7 +9,7 @@ // INLINE: "-fsplit-dwarf-inlining" // NOINLINE-NOT: "-fsplit-dwarf-inlining" -// SPLIT: "-debug-info-kind=limited" +// SPLIT: "-debug-info-kind=constructor" // SPLIT-SAME: "-ggnu-pubnames" // SPLIT-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" @@ -38,14 +38,14 @@ // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT // RUN: %clang -### -c -target x86_64 -gno-split-dwarf -g -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT -// NOSPLIT: "-debug-info-kind=limited" +// NOSPLIT: "-debug-info-kind=constructor" // NOSPLIT-NOT: "-ggnu-pubnames" // NOSPLIT-NOT: "-split-dwarf /// Test -gsplit-dwarf=single. // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g %s 2>&1 | FileCheck %s --check-prefix=SINGLE -// SINGLE: "-debug-info-kind=limited" +// SINGLE: "-debug-info-kind=constructor" // SINGLE: "-split-dwarf-file" "split-debug.o" // SINGLE-NOT: "-split-dwarf-output" @@ -62,7 +62,7 @@ // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g -gno-pubnames %s 2>&1 | FileCheck %s --check-prefixes=NOPUBNAMES // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g -gno-gnu-pubnames %s 2>&1 | FileCheck %s --check-prefixes=NOPUBNAMES -// NOPUBNAMES: "-debug-info-kind=limited" +// NOPUBNAMES: "-debug-info-kind=constructor" // NOPUBNAMES-NOT: "-ggnu-pubnames" // NOPUBNAMES-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" diff --git a/clang/test/OpenMP/debug_private.c b/clang/test/OpenMP/debug_private.c index f5d026bc88427..9aca85b76f473 100644 --- a/clang/test/OpenMP/debug_private.c +++ b/clang/test/OpenMP/debug_private.c @@ -3,6 +3,7 @@ // REQUIRES: x86_64-linux +// RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=line-directives-only -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=line-tables-only -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=limited -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s diff --git a/clang/test/OpenMP/debug_task_shared.c b/clang/test/OpenMP/debug_task_shared.c index 663e5a2b827f4..b05177a835094 100644 --- a/clang/test/OpenMP/debug_task_shared.c +++ b/clang/test/OpenMP/debug_task_shared.c @@ -3,7 +3,8 @@ // REQUIRES: x86_64-linux -// RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=limited -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG +// RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=constructor -DSHARED -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=line-directives-only -DSHARED -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=line-tables-only -DSHARED -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=NEG // RUN: %clang_cc1 -no-opaque-pointers -debug-info-kind=limited -DSHARED -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK diff --git a/clang/test/OpenMP/debug_threadprivate_copyin.c b/clang/test/OpenMP/debug_threadprivate_copyin.c index ca93abe57ece9..bb0b76d5242a4 100644 --- a/clang/test/OpenMP/debug_threadprivate_copyin.c +++ b/clang/test/OpenMP/debug_threadprivate_copyin.c @@ -3,7 +3,7 @@ // REQUIRES: x86_64-linux -// RUN: %clang_cc1 -debug-info-kind=limited -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s // expected-no-diagnostics // CHECK: define internal void @.omp_outlined._debug__( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits