mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 13:35:38 +08:00
DebugInfo: Fully integrate ctor type homing into 'limited' debug info
Simplify debug info back to just "limited" or "full" by rolling the ctor type homing fully into the "limited" debug info. Also fix a bug I found along the way that was causing ctor type homing to kick in even when something could be vtable homed (where vtable homing is stronger/more effective than ctor homing) - fixing at the same time as it keeps the tests (that were testing only "limited non ctor" homing and now test ctor homing) passing.
This commit is contained in:
@@ -2672,19 +2672,6 @@ 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.
|
||||
|
||||
@@ -468,7 +468,7 @@ public:
|
||||
|
||||
/// Check if type and variable info should be emitted.
|
||||
bool hasReducedDebugInfo() const {
|
||||
return getDebugInfo() >= codegenoptions::DebugInfoConstructor;
|
||||
return getDebugInfo() >= codegenoptions::LimitedDebugInfo;
|
||||
}
|
||||
|
||||
/// Check if maybe unused type info should be emitted.
|
||||
|
||||
@@ -34,12 +34,6 @@ 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
|
||||
|
||||
@@ -5234,11 +5234,6 @@ 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 {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#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"
|
||||
@@ -586,7 +587,6 @@ 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::DebugInfoConstructor)
|
||||
if (DebugKind == codegenoptions::LimitedDebugInfo)
|
||||
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::DebugInfoConstructor) &&
|
||||
if ((DebugKind == codegenoptions::LimitedDebugInfo) &&
|
||||
canUseCtorHoming(CXXDecl))
|
||||
return true;
|
||||
|
||||
@@ -3349,7 +3349,7 @@ void CGDebugInfo::completeTemplateDefinition(
|
||||
}
|
||||
|
||||
void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) {
|
||||
if (DebugKind <= codegenoptions::DebugLineTablesOnly)
|
||||
if (DebugKind <= codegenoptions::DebugLineTablesOnly || D.isDynamicClass())
|
||||
return;
|
||||
|
||||
completeClassData(&D);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#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"
|
||||
@@ -525,7 +526,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::DebugInfoConstructor;
|
||||
return codegenoptions::LimitedDebugInfo;
|
||||
}
|
||||
|
||||
static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) {
|
||||
@@ -1086,9 +1087,6 @@ 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;
|
||||
@@ -2670,7 +2668,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
|
||||
CmdArgs.push_back(Value.data());
|
||||
} else {
|
||||
RenderDebugEnablingArgs(Args, CmdArgs,
|
||||
codegenoptions::DebugInfoConstructor,
|
||||
codegenoptions::LimitedDebugInfo,
|
||||
DwarfVersion, llvm::DebuggerKind::Default);
|
||||
}
|
||||
} else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
|
||||
@@ -4096,7 +4094,7 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D,
|
||||
}
|
||||
}
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
|
||||
DebugInfoKind = codegenoptions::DebugInfoConstructor;
|
||||
DebugInfoKind = codegenoptions::LimitedDebugInfo;
|
||||
|
||||
// If the last option explicitly specified a debug-info level, use it.
|
||||
if (checkDebugInfoOption(A, Args, D, TC) &&
|
||||
@@ -4218,7 +4216,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::DebugInfoConstructor;
|
||||
DebugInfoKind = codegenoptions::LimitedDebugInfo;
|
||||
CmdArgs.push_back("-dwarf-ext-refs");
|
||||
CmdArgs.push_back("-fmodule-format=obj");
|
||||
}
|
||||
@@ -4239,8 +4237,7 @@ 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 ||
|
||||
DebugInfoKind == codegenoptions::DebugInfoConstructor) {
|
||||
if (DebugInfoKind == codegenoptions::LimitedDebugInfo) {
|
||||
if (Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types,
|
||||
options::OPT_feliminate_unused_debug_types, false))
|
||||
DebugInfoKind = codegenoptions::UnusedTypeInfo;
|
||||
@@ -5438,7 +5435,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::DebugInfoConstructor)
|
||||
if (DebugInfoKind >= codegenoptions::LimitedDebugInfo)
|
||||
CmdArgs.push_back("-fjmc");
|
||||
else
|
||||
D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "-fjmc"
|
||||
@@ -7561,7 +7558,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::DebugInfoConstructor;
|
||||
*DebugInfoKind = codegenoptions::LimitedDebugInfo;
|
||||
else
|
||||
*DebugInfoKind = codegenoptions::DebugLineTablesOnly;
|
||||
} else {
|
||||
@@ -7573,7 +7570,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::DebugInfoConstructor)
|
||||
if (*EmitCodeView && *DebugInfoKind >= codegenoptions::LimitedDebugInfo)
|
||||
CmdArgs.push_back("-fjmc");
|
||||
else
|
||||
D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "/JMC"
|
||||
@@ -7898,7 +7895,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::DebugInfoConstructor
|
||||
DebugInfoKind = (WantDebug ? codegenoptions::LimitedDebugInfo
|
||||
: codegenoptions::NoDebugInfo);
|
||||
|
||||
addDebugPrefixMapArg(getToolChain().getDriver(), getToolChain(), Args,
|
||||
|
||||
@@ -1360,9 +1360,6 @@ void CompilerInvocation::GenerateCodeGenArgs(
|
||||
case codegenoptions::DebugDirectivesOnly:
|
||||
DebugInfoVal = "line-directives-only";
|
||||
break;
|
||||
case codegenoptions::DebugInfoConstructor:
|
||||
DebugInfoVal = "constructor";
|
||||
break;
|
||||
case codegenoptions::LimitedDebugInfo:
|
||||
DebugInfoVal = "limited";
|
||||
break;
|
||||
@@ -1637,7 +1634,6 @@ 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)
|
||||
@@ -1649,18 +1645,6 @@ 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(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=constructor %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
|
||||
|
||||
enum nsresult {};
|
||||
|
||||
|
||||
@@ -32,14 +32,13 @@ struct D {
|
||||
};
|
||||
|
||||
struct E {
|
||||
E();
|
||||
virtual ~E();
|
||||
virtual void func() {
|
||||
}
|
||||
};
|
||||
|
||||
struct F {
|
||||
struct inner {
|
||||
struct F_inner {
|
||||
};
|
||||
static const int i = 2;
|
||||
virtual ~F();
|
||||
@@ -47,7 +46,7 @@ struct F {
|
||||
|
||||
struct G {
|
||||
virtual void func();
|
||||
struct inner {
|
||||
struct G_inner {
|
||||
int j;
|
||||
};
|
||||
};
|
||||
@@ -83,7 +82,7 @@ void f1() {
|
||||
x.func();
|
||||
E y;
|
||||
int i = F::i;
|
||||
F::inner z;
|
||||
F::F_inner z;
|
||||
K k;
|
||||
k.func();
|
||||
L l;
|
||||
@@ -92,7 +91,7 @@ void f1() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
B b;
|
||||
G::inner c_i;
|
||||
G::G_inner c_i;
|
||||
if (argc) {
|
||||
A a;
|
||||
}
|
||||
@@ -116,11 +115,13 @@ 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"
|
||||
@@ -173,10 +174,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: "inner",{{.*}} line: 50
|
||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G_inner",
|
||||
// CHECK-NOT: DIFlagFwdDecl
|
||||
// CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]]
|
||||
// CHECK-SAME: identifier: "_ZTSN1G5innerE"
|
||||
// CHECK-SAME: identifier: "_ZTSN1G7G_innerE"
|
||||
|
||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G"
|
||||
// CHECK-SAME: DIFlagFwdDecl
|
||||
@@ -186,8 +187,6 @@ 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: 100,
|
||||
// CHECK: ![[RETLOC]] = !DILocation(line: 99,
|
||||
// CHECK: ![[EXCEPTLOC]] = !DILocation(line: 99,
|
||||
// CHECK: ![[RETLOC]] = !DILocation(line: 98,
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// 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;
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %clang_cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue
|
||||
struct A {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// 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
|
||||
|
||||
@@ -12,7 +12,7 @@ int D::d(int x) {
|
||||
}();
|
||||
}
|
||||
|
||||
// CHECK: ![[D:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D",
|
||||
// CHECK: ![[D:[0-9]+]] = !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
|
||||
|
||||
@@ -174,5 +174,7 @@ int main(void) {
|
||||
// CHECK: ret void
|
||||
// CHECK: }
|
||||
|
||||
// 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)
|
||||
// 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)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// 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.
|
||||
// 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
|
||||
|
||||
#if SETATTR
|
||||
#define STANDALONEDEBUGATTR __attribute__((standalone_debug))
|
||||
|
||||
@@ -540,11 +540,11 @@
|
||||
|
||||
// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
|
||||
// Zi: "-gcodeview"
|
||||
// Zi: "-debug-info-kind=constructor"
|
||||
// Zi: "-debug-info-kind=limited"
|
||||
|
||||
// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
|
||||
// Z7: "-gcodeview"
|
||||
// Z7: "-debug-info-kind=constructor"
|
||||
// Z7: "-debug-info-kind=limited"
|
||||
|
||||
// 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=constructor"
|
||||
// Z7_gdwarf: "-debug-info-kind=limited"
|
||||
// Z7_gdwarf: "-dwarf-version=
|
||||
|
||||
// RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
|
||||
|
||||
@@ -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=constructor"
|
||||
// CHECK-WITH-G: "-debug-info-kind=limited"
|
||||
// CHECK-WITH-G: "-dwarf-version=5"
|
||||
// CHECK-WITH-G-DWARF2: "-dwarf-version=2"
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
// HAS_DEBUG-NOT: warning: debug
|
||||
// HAS_DEBUG: "-fcuda-is-device"
|
||||
// HAS_DEBUG-SAME: "-debug-info-kind={{constructor|line-tables-only}}"
|
||||
// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
|
||||
// HAS_DEBUG-SAME: "-dwarf-version=2"
|
||||
// HAS_DEBUG: ptxas
|
||||
// HAS_DEBUG-SAME: "-g"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// RUN: | FileCheck %s
|
||||
//
|
||||
// CHECK: "-cc1as"
|
||||
// CHECK: "-debug-info-kind=constructor"
|
||||
// CHECK: "-debug-info-kind=limited"
|
||||
|
||||
// Check to make sure clang with -g on a .s file gets passed -dwarf-debug-producer.
|
||||
// rdar://12955296
|
||||
|
||||
@@ -313,18 +313,18 @@
|
||||
// GLIO_ONLY_DWARF2: "-dwarf-version=2"
|
||||
//
|
||||
// G_ONLY: "-cc1"
|
||||
// G_ONLY: "-debug-info-kind=constructor"
|
||||
// G_ONLY: "-debug-info-kind=limited"
|
||||
//
|
||||
// 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|constructor}}"
|
||||
// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}"
|
||||
// G_ONLY_DWARF2: "-dwarf-version=2"
|
||||
//
|
||||
// G_STANDALONE: "-cc1"
|
||||
// G_STANDALONE: "-debug-info-kind=standalone"
|
||||
// G_LIMITED: "-cc1"
|
||||
// G_LIMITED: "-debug-info-kind=constructor"
|
||||
// G_LIMITED: "-debug-info-kind=limited"
|
||||
// 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|constructor}}"
|
||||
// GEXTREFS: "-debug-info-kind={{standalone|limited}}"
|
||||
|
||||
// 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={{constructor|line-tables-only|standalone}}"
|
||||
// NO_DEBUG_UNUSED_TYPES: "-debug-info-kind={{limited|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
|
||||
|
||||
@@ -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=constructor" "-dwarf-version=2"
|
||||
// DWARF2: "-debug-info-kind=limited" "-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=constructor" "-dwarf-version=3"
|
||||
// DWARF3: "-debug-info-kind=limited" "-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=constructor" "-dwarf-version=4"
|
||||
// DWARF4: "-debug-info-kind=limited" "-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=constructor" "-dwarf-version=2"
|
||||
// DWARF2XASSEMBLER: "-debug-info-kind=limited" "-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=constructor" "-dwarf-version=2"
|
||||
// DWARF2WA: "-debug-info-kind=limited" "-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
|
||||
|
||||
@@ -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=constructor" "-dwarf-version=2"
|
||||
// G_SPARC: "-debug-info-kind=limited" "-dwarf-version=2"
|
||||
|
||||
// RUN: %clang -### -c %s --target=sparc-myriad-rtems -fuse-init-array 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=USE-INIT-ARRAY %s
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
|
||||
// HAS_DEBUG-NOT: warning: debug
|
||||
// HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda"
|
||||
// HAS_DEBUG-SAME: "-debug-info-kind={{constructor|line-tables-only}}"
|
||||
// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
|
||||
// HAS_DEBUG-SAME: "-dwarf-version=2"
|
||||
// HAS_DEBUG-SAME: "-fopenmp-is-device"
|
||||
// HAS_DEBUG: ptxas
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// INLINE: "-fsplit-dwarf-inlining"
|
||||
// NOINLINE-NOT: "-fsplit-dwarf-inlining"
|
||||
// SPLIT: "-debug-info-kind=constructor"
|
||||
// SPLIT: "-debug-info-kind=limited"
|
||||
// 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=constructor"
|
||||
// NOSPLIT: "-debug-info-kind=limited"
|
||||
// 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=constructor"
|
||||
// SINGLE: "-debug-info-kind=limited"
|
||||
// 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=constructor"
|
||||
// NOPUBNAMES: "-debug-info-kind=limited"
|
||||
// NOPUBNAMES-NOT: "-ggnu-pubnames"
|
||||
// NOPUBNAMES-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo"
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
// 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
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
// REQUIRES: x86_64-linux
|
||||
|
||||
// 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=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=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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
// REQUIRES: x86_64-linux
|
||||
|
||||
// RUN: %clang_cc1 -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -debug-info-kind=limited -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__(
|
||||
|
||||
Reference in New Issue
Block a user