[DEBUGINFO] Disable unsupported debug info options for NVPTX target.

Summary:
Some targets support only default set of the debug options and do not
support additional debug options, like NVPTX target. Patch introduced
virtual function supportsDebugInfoOptions() that can be overloaded
by the toolchain, checks if the target supports some debug
options and emits warning when an unsupported debug option is
found.

Reviewers: echristo

Subscribers: aprantl, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D49148

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338155 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Bataev 2018-07-27 19:45:14 +00:00
parent ab6efb3942
commit f97144939f
10 changed files with 203 additions and 82 deletions

View File

@ -226,6 +226,9 @@ def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and w
def warn_drv_unsupported_opt_for_target : Warning< def warn_drv_unsupported_opt_for_target : Warning<
"optimization flag '%0' is not supported for target '%1'">, "optimization flag '%0' is not supported for target '%1'">,
InGroup<IgnoredOptimizationArgument>; InGroup<IgnoredOptimizationArgument>;
def warn_drv_unsupported_debug_info_opt_for_target : Warning<
"debug information option '%0' is not supported for target '%1'">,
InGroup<UnsupportedTargetOpt>;
def warn_c_kext : Warning< def warn_c_kext : Warning<
"ignoring -fapple-kext which is valid for C++ and Objective-C++ only">; "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;
def warn_drv_input_file_unused : Warning< def warn_drv_input_file_unused : Warning<

View File

@ -72,6 +72,7 @@ def UnsupportedNan : DiagGroup<"unsupported-nan">;
def UnsupportedAbs : DiagGroup<"unsupported-abs">; def UnsupportedAbs : DiagGroup<"unsupported-abs">;
def UnsupportedCB : DiagGroup<"unsupported-cb">; def UnsupportedCB : DiagGroup<"unsupported-cb">;
def UnsupportedGPOpt : DiagGroup<"unsupported-gpopt">; def UnsupportedGPOpt : DiagGroup<"unsupported-gpopt">;
def UnsupportedTargetOpt : DiagGroup<"unsupported-target-opt">;
def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">; def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
def NullConversion : DiagGroup<"null-conversion">; def NullConversion : DiagGroup<"null-conversion">;
def ImplicitConversionFloatingPointToBool : def ImplicitConversionFloatingPointToBool :

View File

@ -413,6 +413,11 @@ public:
return llvm::DebuggerKind::GDB; return llvm::DebuggerKind::GDB;
} }
/// Does this toolchain supports given debug info option or not.
virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
return true;
}
/// GetExceptionModel - Return the tool chain exception model. /// GetExceptionModel - Return the tool chain exception model.
virtual llvm::ExceptionHandling virtual llvm::ExceptionHandling
GetExceptionModel(const llvm::opt::ArgList &Args) const; GetExceptionModel(const llvm::opt::ArgList &Args) const;

View File

@ -919,34 +919,46 @@ static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs,
} }
} }
static bool checkDebugInfoOption(const Arg *A, const ArgList &Args,
const Driver &D, const ToolChain &TC) {
assert(A && "Expected non-nullptr argument.");
if (TC.supportsDebugInfoOption(A))
return true;
D.Diag(diag::warn_drv_unsupported_debug_info_opt_for_target)
<< A->getAsString(Args) << TC.getTripleString();
return false;
}
static void RenderDebugInfoCompressionArgs(const ArgList &Args, static void RenderDebugInfoCompressionArgs(const ArgList &Args,
ArgStringList &CmdArgs, ArgStringList &CmdArgs,
const Driver &D) { const Driver &D,
const ToolChain &TC) {
const Arg *A = Args.getLastArg(options::OPT_gz, options::OPT_gz_EQ); const Arg *A = Args.getLastArg(options::OPT_gz, options::OPT_gz_EQ);
if (!A) if (!A)
return; return;
if (checkDebugInfoOption(A, Args, D, TC)) {
if (A->getOption().getID() == options::OPT_gz) { if (A->getOption().getID() == options::OPT_gz) {
if (llvm::zlib::isAvailable()) if (llvm::zlib::isAvailable())
CmdArgs.push_back("-compress-debug-sections"); CmdArgs.push_back("-compress-debug-sections");
else else
D.Diag(diag::warn_debug_compression_unavailable); D.Diag(diag::warn_debug_compression_unavailable);
return; return;
} }
StringRef Value = A->getValue(); StringRef Value = A->getValue();
if (Value == "none") { if (Value == "none") {
CmdArgs.push_back("-compress-debug-sections=none"); CmdArgs.push_back("-compress-debug-sections=none");
} else if (Value == "zlib" || Value == "zlib-gnu") { } else if (Value == "zlib" || Value == "zlib-gnu") {
if (llvm::zlib::isAvailable()) { if (llvm::zlib::isAvailable()) {
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString("-compress-debug-sections=" + Twine(Value))); Args.MakeArgString("-compress-debug-sections=" + Twine(Value)));
} else { } else {
D.Diag(diag::warn_debug_compression_unavailable); D.Diag(diag::warn_debug_compression_unavailable);
}
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
} }
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
} }
} }
@ -2867,7 +2879,9 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
codegenoptions::DebugInfoKind &DebugInfoKind, codegenoptions::DebugInfoKind &DebugInfoKind,
const Arg *&SplitDWARFArg) { const Arg *&SplitDWARFArg) {
if (Args.hasFlag(options::OPT_fdebug_info_for_profiling, if (Args.hasFlag(options::OPT_fdebug_info_for_profiling,
options::OPT_fno_debug_info_for_profiling, false)) options::OPT_fno_debug_info_for_profiling, false) &&
checkDebugInfoOption(
Args.getLastArg(options::OPT_fdebug_info_for_profiling), Args, D, TC))
CmdArgs.push_back("-fdebug-info-for-profiling"); CmdArgs.push_back("-fdebug-info-for-profiling");
// The 'g' groups options involve a somewhat intricate sequence of decisions // The 'g' groups options involve a somewhat intricate sequence of decisions
@ -2890,29 +2904,38 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
SplitDWARFArg = Args.getLastArg(options::OPT_gsplit_dwarf); SplitDWARFArg = Args.getLastArg(options::OPT_gsplit_dwarf);
if (SplitDWARFArg && !checkDebugInfoOption(SplitDWARFArg, Args, D, TC)) {
SplitDWARFArg = nullptr;
SplitDWARFInlining = false;
}
if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
// If the last option explicitly specified a debug-info level, use it. if (checkDebugInfoOption(A, Args, D, TC)) {
if (A->getOption().matches(options::OPT_gN_Group)) { // If the last option explicitly specified a debug-info level, use it.
DebugInfoKind = DebugLevelToInfoKind(*A); if (A->getOption().matches(options::OPT_gN_Group)) {
// If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses. DebugInfoKind = DebugLevelToInfoKind(*A);
// But -gsplit-dwarf is not a g_group option, hence we have to check the // If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses.
// order explicitly. If -gsplit-dwarf wins, we fix DebugInfoKind later. // But -gsplit-dwarf is not a g_group option, hence we have to check the
// This gets a bit more complicated if you've disabled inline info in the // order explicitly. If -gsplit-dwarf wins, we fix DebugInfoKind later.
// skeleton CUs (SplitDWARFInlining) - then there's value in composing // This gets a bit more complicated if you've disabled inline info in
// split-dwarf and line-tables-only, so let those compose naturally in // the skeleton CUs (SplitDWARFInlining) - then there's value in
// that case. // composing split-dwarf and line-tables-only, so let those compose
// And if you just turned off debug info, (-gsplit-dwarf -g0) - do that. // naturally in that case. And if you just turned off debug info,
if (SplitDWARFArg) { // (-gsplit-dwarf -g0) - do that.
if (A->getIndex() > SplitDWARFArg->getIndex()) { if (SplitDWARFArg) {
if (DebugInfoKind == codegenoptions::NoDebugInfo || if (A->getIndex() > SplitDWARFArg->getIndex()) {
(DebugInfoKind == codegenoptions::DebugLineTablesOnly && if (DebugInfoKind == codegenoptions::NoDebugInfo ||
SplitDWARFInlining)) (DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
SplitDWARFArg = nullptr; SplitDWARFInlining))
} else if (SplitDWARFInlining) SplitDWARFArg = nullptr;
DebugInfoKind = codegenoptions::NoDebugInfo; } else if (SplitDWARFInlining)
DebugInfoKind = codegenoptions::NoDebugInfo;
}
} else {
// For any other 'g' option, use Limited.
DebugInfoKind = codegenoptions::LimitedDebugInfo;
} }
} else { } else {
// For any other 'g' option, use Limited.
DebugInfoKind = codegenoptions::LimitedDebugInfo; DebugInfoKind = codegenoptions::LimitedDebugInfo;
} }
} }
@ -2920,39 +2943,50 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// If a debugger tuning argument appeared, remember it. // If a debugger tuning argument appeared, remember it.
if (const Arg *A = if (const Arg *A =
Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) { Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) {
if (A->getOption().matches(options::OPT_glldb)) if (checkDebugInfoOption(A, Args, D, TC)) {
DebuggerTuning = llvm::DebuggerKind::LLDB; if (A->getOption().matches(options::OPT_glldb))
else if (A->getOption().matches(options::OPT_gsce)) DebuggerTuning = llvm::DebuggerKind::LLDB;
DebuggerTuning = llvm::DebuggerKind::SCE; else if (A->getOption().matches(options::OPT_gsce))
else DebuggerTuning = llvm::DebuggerKind::SCE;
DebuggerTuning = llvm::DebuggerKind::GDB; else
DebuggerTuning = llvm::DebuggerKind::GDB;
}
} }
// If a -gdwarf argument appeared, remember it. // If a -gdwarf argument appeared, remember it.
if (const Arg *A = if (const Arg *A =
Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3, Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
options::OPT_gdwarf_4, options::OPT_gdwarf_5)) options::OPT_gdwarf_4, options::OPT_gdwarf_5))
DWARFVersion = DwarfVersionNum(A->getSpelling()); if (checkDebugInfoOption(A, Args, D, TC))
DWARFVersion = DwarfVersionNum(A->getSpelling());
// Forward -gcodeview. EmitCodeView might have been set by CL-compatibility // Forward -gcodeview. EmitCodeView might have been set by CL-compatibility
// argument parsing. // argument parsing.
if (EmitCodeView) { if (EmitCodeView) {
// DWARFVersion remains at 0 if no explicit choice was made. if (const Arg *A = Args.getLastArg(options::OPT_gcodeview)) {
CmdArgs.push_back("-gcodeview"); EmitCodeView = checkDebugInfoOption(A, Args, D, TC);
} else if (DWARFVersion == 0 && if (EmitCodeView) {
DebugInfoKind != codegenoptions::NoDebugInfo) { // DWARFVersion remains at 0 if no explicit choice was made.
DWARFVersion = TC.GetDefaultDwarfVersion(); CmdArgs.push_back("-gcodeview");
}
}
} }
if (!EmitCodeView && DWARFVersion == 0 &&
DebugInfoKind != codegenoptions::NoDebugInfo)
DWARFVersion = TC.GetDefaultDwarfVersion();
// We ignore flag -gstrict-dwarf for now. // We ignore flag -gstrict-dwarf for now.
// And we handle flag -grecord-gcc-switches later with DWARFDebugFlags. // And we handle flag -grecord-gcc-switches later with DWARFDebugFlags.
Args.ClaimAllArgs(options::OPT_g_flags_Group); Args.ClaimAllArgs(options::OPT_g_flags_Group);
// Column info is included by default for everything except SCE and CodeView. // Column info is included by default for everything except SCE and
// Clang doesn't track end columns, just starting columns, which, in theory, // CodeView. Clang doesn't track end columns, just starting columns, which,
// is fine for CodeView (and PDB). In practice, however, the Microsoft // in theory, is fine for CodeView (and PDB). In practice, however, the
// debuggers don't handle missing end columns well, so it's better not to // Microsoft debuggers don't handle missing end columns well, so it's better
// include any column info. // not to include any column info.
if (const Arg *A = Args.getLastArg(options::OPT_gcolumn_info))
(void)checkDebugInfoOption(A, Args, D, TC);
if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info, if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
/*Default=*/!EmitCodeView && /*Default=*/!EmitCodeView &&
DebuggerTuning != llvm::DebuggerKind::SCE)) DebuggerTuning != llvm::DebuggerKind::SCE))
@ -2960,12 +2994,14 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// FIXME: Move backend command line options to the module. // FIXME: Move backend command line options to the module.
// If -gline-tables-only is the last option it wins. // If -gline-tables-only is the last option it wins.
if (DebugInfoKind != codegenoptions::DebugLineTablesOnly && if (const Arg *A = Args.getLastArg(options::OPT_gmodules))
Args.hasArg(options::OPT_gmodules)) { if (checkDebugInfoOption(A, Args, D, TC)) {
DebugInfoKind = codegenoptions::LimitedDebugInfo; if (DebugInfoKind != codegenoptions::DebugLineTablesOnly) {
CmdArgs.push_back("-dwarf-ext-refs"); DebugInfoKind = codegenoptions::LimitedDebugInfo;
CmdArgs.push_back("-fmodule-format=obj"); CmdArgs.push_back("-dwarf-ext-refs");
} CmdArgs.push_back("-fmodule-format=obj");
}
}
// -gsplit-dwarf should turn on -g and enable the backend dwarf // -gsplit-dwarf should turn on -g and enable the backend dwarf
// splitting and extraction. // splitting and extraction.
@ -2989,19 +3025,23 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug, bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug,
options::OPT_fno_standalone_debug, options::OPT_fno_standalone_debug,
TC.GetDefaultStandaloneDebug()); TC.GetDefaultStandaloneDebug());
if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug))
(void)checkDebugInfoOption(A, Args, D, TC);
if (DebugInfoKind == codegenoptions::LimitedDebugInfo && NeedFullDebug) if (DebugInfoKind == codegenoptions::LimitedDebugInfo && NeedFullDebug)
DebugInfoKind = codegenoptions::FullDebugInfo; DebugInfoKind = codegenoptions::FullDebugInfo;
if (Args.hasFlag(options::OPT_gembed_source, options::OPT_gno_embed_source, false)) { if (Args.hasFlag(options::OPT_gembed_source, options::OPT_gno_embed_source,
false)) {
// Source embedding is a vendor extension to DWARF v5. By now we have // Source embedding is a vendor extension to DWARF v5. By now we have
// checked if a DWARF version was stated explicitly, and have otherwise // checked if a DWARF version was stated explicitly, and have otherwise
// fallen back to the target default, so if this is still not at least 5 we // fallen back to the target default, so if this is still not at least 5
// emit an error. // we emit an error.
const Arg *A = Args.getLastArg(options::OPT_gembed_source);
if (DWARFVersion < 5) if (DWARFVersion < 5)
D.Diag(diag::err_drv_argument_only_allowed_with) D.Diag(diag::err_drv_argument_only_allowed_with)
<< Args.getLastArg(options::OPT_gembed_source)->getAsString(Args) << A->getAsString(Args) << "-gdwarf-5";
<< "-gdwarf-5"; else if (checkDebugInfoOption(A, Args, D, TC))
CmdArgs.push_back("-gembed-source"); CmdArgs.push_back("-gembed-source");
} }
RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DWARFVersion, RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DWARFVersion,
@ -3010,31 +3050,41 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// -fdebug-macro turns on macro debug info generation. // -fdebug-macro turns on macro debug info generation.
if (Args.hasFlag(options::OPT_fdebug_macro, options::OPT_fno_debug_macro, if (Args.hasFlag(options::OPT_fdebug_macro, options::OPT_fno_debug_macro,
false)) false))
CmdArgs.push_back("-debug-info-macro"); if (checkDebugInfoOption(Args.getLastArg(options::OPT_fdebug_macro), Args,
D, TC))
CmdArgs.push_back("-debug-info-macro");
// -ggnu-pubnames turns on gnu style pubnames in the backend. // -ggnu-pubnames turns on gnu style pubnames in the backend.
if (Args.hasFlag(options::OPT_ggnu_pubnames, options::OPT_gno_gnu_pubnames, if (Args.hasFlag(options::OPT_ggnu_pubnames, options::OPT_gno_gnu_pubnames,
false)) false))
CmdArgs.push_back("-ggnu-pubnames"); if (checkDebugInfoOption(Args.getLastArg(options::OPT_ggnu_pubnames), Args,
D, TC))
CmdArgs.push_back("-ggnu-pubnames");
// -gdwarf-aranges turns on the emission of the aranges section in the // -gdwarf-aranges turns on the emission of the aranges section in the
// backend. // backend.
// Always enabled for SCE tuning. // Always enabled for SCE tuning.
if (Args.hasArg(options::OPT_gdwarf_aranges) || bool NeedAranges = DebuggerTuning == llvm::DebuggerKind::SCE;
DebuggerTuning == llvm::DebuggerKind::SCE) { if (const Arg *A = Args.getLastArg(options::OPT_gdwarf_aranges))
NeedAranges = checkDebugInfoOption(A, Args, D, TC) || NeedAranges;
if (NeedAranges) {
CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-generate-arange-section"); CmdArgs.push_back("-generate-arange-section");
} }
if (Args.hasFlag(options::OPT_fdebug_types_section, if (Args.hasFlag(options::OPT_fdebug_types_section,
options::OPT_fno_debug_types_section, false)) { options::OPT_fno_debug_types_section, false)) {
if (!T.isOSBinFormatELF()) if (!T.isOSBinFormatELF()) {
D.Diag(diag::err_drv_unsupported_opt_for_target) D.Diag(diag::err_drv_unsupported_opt_for_target)
<< Args.getLastArg(options::OPT_fdebug_types_section) << Args.getLastArg(options::OPT_fdebug_types_section)
->getAsString(Args) ->getAsString(Args)
<< T.getTriple(); << T.getTriple();
CmdArgs.push_back("-mllvm"); } else if (checkDebugInfoOption(
CmdArgs.push_back("-generate-type-units"); Args.getLastArg(options::OPT_fdebug_types_section), Args, D,
TC)) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-generate-type-units");
}
} }
// Decide how to render forward declarations of template instantiations. // Decide how to render forward declarations of template instantiations.
@ -3042,11 +3092,12 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
if (DebuggerTuning == llvm::DebuggerKind::SCE) if (DebuggerTuning == llvm::DebuggerKind::SCE)
CmdArgs.push_back("-debug-forward-template-params"); CmdArgs.push_back("-debug-forward-template-params");
// Do we need to explicitly import anonymous namespaces into the parent scope? // Do we need to explicitly import anonymous namespaces into the parent
// scope?
if (DebuggerTuning == llvm::DebuggerKind::SCE) if (DebuggerTuning == llvm::DebuggerKind::SCE)
CmdArgs.push_back("-dwarf-explicit-import"); CmdArgs.push_back("-dwarf-explicit-import");
RenderDebugInfoCompressionArgs(Args, CmdArgs, D); RenderDebugInfoCompressionArgs(Args, CmdArgs, D, TC);
} }
void Clang::ConstructJob(Compilation &C, const JobAction &JA, void Clang::ConstructJob(Compilation &C, const JobAction &JA,
@ -5388,7 +5439,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
} }
RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion, RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion,
llvm::DebuggerKind::Default); llvm::DebuggerKind::Default);
RenderDebugInfoCompressionArgs(Args, CmdArgs, D); RenderDebugInfoCompressionArgs(Args, CmdArgs, D, getToolChain());
// Handle -fPIC et al -- the relocation-model affects the assembler // Handle -fPIC et al -- the relocation-model affects the assembler

View File

@ -679,6 +679,18 @@ void CudaToolChain::addClangTargetOptions(
} }
} }
bool CudaToolChain::supportsDebugInfoOption(const llvm::opt::Arg *A) const {
const Option &O = A->getOption();
return (O.matches(options::OPT_gN_Group) &&
!O.matches(options::OPT_gmodules)) ||
O.matches(options::OPT_g_Flag) ||
O.matches(options::OPT_ggdbN_Group) || O.matches(options::OPT_ggdb) ||
O.matches(options::OPT_gdwarf) || O.matches(options::OPT_gdwarf_2) ||
O.matches(options::OPT_gdwarf_3) || O.matches(options::OPT_gdwarf_4) ||
O.matches(options::OPT_gdwarf_5) ||
O.matches(options::OPT_gcolumn_info);
}
void CudaToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs, void CudaToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const { ArgStringList &CC1Args) const {
// Check our CUDA version if we're going to include the CUDA headers. // Check our CUDA version if we're going to include the CUDA headers.

View File

@ -158,6 +158,7 @@ public:
bool isPIEDefault() const override { return false; } bool isPIEDefault() const override { return false; }
bool isPICDefaultForced() const override { return false; } bool isPICDefaultForced() const override { return false; }
bool SupportsProfiling() const override { return false; } bool SupportsProfiling() const override { return false; }
bool supportsDebugInfoOption(const llvm::opt::Arg *A) const override;
bool IsMathErrnoDefault() const override { return false; } bool IsMathErrnoDefault() const override { return false; }
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,

View File

@ -15,6 +15,8 @@
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE // RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE
// NO_DEBUG-NOT: warning: debug
// LINE_TABLE-NOT: warning: debug
// NO_DEBUG: ptxas // NO_DEBUG: ptxas
// NO_DEBUG-NOT: "-g" // NO_DEBUG-NOT: "-g"
// LINE_TABLE: "-lineinfo" // LINE_TABLE: "-lineinfo"
@ -36,6 +38,7 @@
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix HAS_DEBUG // RUN: FileCheck %s -check-prefix HAS_DEBUG
// HAS_DEBUG-NOT: warning: debug
// HAS_DEBUG: "-fcuda-is-device" // HAS_DEBUG: "-fcuda-is-device"
// HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-dwarf-version=2"
// HAS_DEBUG: ptxas // HAS_DEBUG: ptxas

View File

@ -0,0 +1,21 @@
// REQUIRES: clang-driver
// REQUIRES: x86-registered-target
// REQUIRES: nvptx-registered-target
// RUN: %clang -### -target x86_64-linux-gnu -c %s -g -gz 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-4 -gcodeview 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -gdwarf-5 -gmodules 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -ggdb -gembed-source -gdwarf-5 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -ggdb1 -fdebug-macro 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -ggdb2 -ggnu-pubnames 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -ggdb3 -gdwarf-aranges 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -c %s -g -gcolumn-info -fdebug-types-section 2>&1 | FileCheck %s
// CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt]
// CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86
// CHECK: "-triple" "nvptx64-nvidia-cuda"
// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}}
// CHECK: "-triple" "x86_64
// CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}}

View File

@ -182,6 +182,8 @@
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \
// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s // RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s
// LINE_TABLE-NOT: warning: debug
// NO_DEBUG-NOT: warning: debug
// NO_DEBUG: ptxas // NO_DEBUG: ptxas
// LINE_TABLE: "-lineinfo" // LINE_TABLE: "-lineinfo"
// NO_DEBUG-NOT: "-g" // NO_DEBUG-NOT: "-g"
@ -203,6 +205,7 @@
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \
// RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: | FileCheck -check-prefix=HAS_DEBUG %s
// HAS_DEBUG-NOT: warning: debug
// HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda"
// HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-dwarf-version=2"
// HAS_DEBUG-SAME: "-fopenmp-is-device" // HAS_DEBUG-SAME: "-fopenmp-is-device"

View File

@ -0,0 +1,21 @@
// REQUIRES: clang-driver
// REQUIRES: x86-registered-target
// REQUIRES: nvptx-registered-target
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gz 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf -fdebug-info-for-profiling 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-2 -gsplit-dwarf 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-3 -glldb 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-4 -gcodeview 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -gdwarf-5 -gmodules 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb -gembed-source -gdwarf-5 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb1 -fdebug-macro 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb2 -ggnu-pubnames 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -ggdb3 -gdwarf-aranges 2>&1 | FileCheck %s
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c %s -g -gcolumn-info -fdebug-types-section 2>&1 | FileCheck %s
// CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt]
// CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86
// CHECK: "-triple" "nvptx64-nvidia-cuda"
// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}}
// CHECK: "-triple" "x86_64
// CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}}