[PATCH] D130858: [HLSL] emit-obj when set output.
Xiang Li via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 5 16:27:31 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG549542b494f4: [HLSL] emit-obj when set output. (authored by python3kgae).
Changed prior to commit:
https://reviews.llvm.org/D130858?vs=448890&id=450447#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130858/new/
https://reviews.llvm.org/D130858
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/test/Driver/dxc_Fo.hlsl
Index: clang/test/Driver/dxc_Fo.hlsl
===================================================================
--- /dev/null
+++ clang/test/Driver/dxc_Fo.hlsl
@@ -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"
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -175,6 +175,15 @@
}
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)) {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3513,6 +3513,7 @@
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};
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -5664,6 +5664,9 @@
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) ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130858.450447.patch
Type: text/x-patch
Size: 2568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220805/1ac4b4e4/attachment-0001.bin>
More information about the cfe-commits
mailing list