Skip to content

Commit 154c2b0

Browse files
committed
review: apply objcopy before validation
- DXC will invoke the validator after the final blob has been generated (in this case after the part is removed)
1 parent f8ff016 commit 154c2b0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4647,6 +4647,16 @@ void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args,
46474647
// Only add action when needValidation.
46484648
const auto &TC =
46494649
static_cast<const toolchains::HLSLToolChain &>(C.getDefaultToolChain());
4650+
if (TC.requiresObjcopy(Args)) {
4651+
Action *LastAction = Actions.back();
4652+
// llvm-objcopy expects a DXIL container, which can either be
4653+
// validated (in which case they are TY_DX_CONTAINER), or unvalidated
4654+
// (TY_OBJECT).
4655+
if (LastAction->getType() == types::TY_DX_CONTAINER ||
4656+
LastAction->getType() == types::TY_Object)
4657+
Actions.push_back(
4658+
C.MakeAction<ObjcopyJobAction>(LastAction, types::TY_DX_CONTAINER));
4659+
}
46504660
if (TC.requiresValidation(Args)) {
46514661
Action *LastAction = Actions.back();
46524662
Actions.push_back(C.MakeAction<BinaryAnalyzeJobAction>(
@@ -4662,16 +4672,6 @@ void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args,
46624672
Actions.push_back(C.MakeAction<BinaryTranslatorJobAction>(
46634673
LastAction, types::TY_DX_CONTAINER));
46644674
}
4665-
if (TC.requiresObjcopy(Args)) {
4666-
Action *LastAction = Actions.back();
4667-
// llvm-objcopy expects a DXIL container, which can either be
4668-
// validated (in which case they are TY_DX_CONTAINER), or unvalidated
4669-
// (TY_OBJECT).
4670-
if (LastAction->getType() == types::TY_DX_CONTAINER ||
4671-
LastAction->getType() == types::TY_Object)
4672-
Actions.push_back(
4673-
C.MakeAction<ObjcopyJobAction>(LastAction, types::TY_DX_CONTAINER));
4674-
}
46754675
}
46764676

46774677
// Claim ignored clang-cl options.

0 commit comments

Comments
 (0)