mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
[HLSL] emit-obj when set output.
When not set output, set default output to stdout. When set output with -Fo and no -fcgl, set -emit-obj to generate dx container. Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D130858
This commit is contained in:
parent
3b52341116
commit
549542b494
@ -5664,6 +5664,9 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
|
||||
return "-";
|
||||
}
|
||||
|
||||
if (IsDXCMode() && !C.getArgs().hasArg(options::OPT_o))
|
||||
return "-";
|
||||
|
||||
// Is this the assembly listing for /FA?
|
||||
if (JA.getType() == types::TY_PP_Asm &&
|
||||
(C.getArgs().hasArg(options::OPT__SLASH_FA) ||
|
||||
|
@ -3513,6 +3513,7 @@ static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs,
|
||||
options::OPT_I,
|
||||
options::OPT_S,
|
||||
options::OPT_emit_llvm,
|
||||
options::OPT_emit_obj,
|
||||
options::OPT_disable_llvm_passes,
|
||||
options::OPT_fnative_half_type,
|
||||
options::OPT_hlsl_entrypoint};
|
||||
|
@ -175,6 +175,15 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
|
||||
}
|
||||
DAL->append(A);
|
||||
}
|
||||
|
||||
if (DAL->hasArg(options::OPT_o)) {
|
||||
// When run the whole pipeline.
|
||||
if (!DAL->hasArg(options::OPT_emit_llvm))
|
||||
// Emit obj if write to file.
|
||||
DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_emit_obj));
|
||||
} else
|
||||
DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_o), "-");
|
||||
|
||||
// Add default validator version if not set.
|
||||
// TODO: remove this once read validator version from validator.
|
||||
if (!DAL->hasArg(options::OPT_dxil_validator_version)) {
|
||||
|
15
clang/test/Driver/dxc_Fo.hlsl
Normal file
15
clang/test/Driver/dxc_Fo.hlsl
Normal file
@ -0,0 +1,15 @@
|
||||
// RUN: %clang_dxc -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
|
||||
// RUN: %clang_dxc -fcgl -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s --check-prefix=FCGL
|
||||
// RUN: %clang_dxc -T lib_6_7 foo.hlsl -Fo foo.dxc -### %s 2>&1 | FileCheck %s --check-prefix=EMITOBJ
|
||||
|
||||
|
||||
// Make sure default use "-" as output and not emit obj.
|
||||
// DEFAULT-NOT:"-emit-obj"
|
||||
// DEFAULT:"-o" "-"
|
||||
|
||||
// Make sure -fcgl without -Fo use "-" as output.
|
||||
// FCGL:"-o" "-"
|
||||
|
||||
|
||||
// Make sure emit-obj when set -Fo.
|
||||
// EMITOBJ:"-emit-obj"
|
Loading…
Reference in New Issue
Block a user