6666#include " clang/Driver/Tool.h"
6767#include " clang/Driver/ToolChain.h"
6868#include " clang/Driver/Types.h"
69- #include " clang/Lex/DependencyDirectivesScanner.h"
7069#include " llvm/ADT/ArrayRef.h"
7170#include " llvm/ADT/STLExtras.h"
7271#include " llvm/ADT/SmallSet.h"
@@ -4189,11 +4188,6 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
41894188 YcArg = nullptr ;
41904189 }
41914190
4192- if (Args.hasArgNoClaim (options::OPT_fmodules_driver))
4193- // TODO: Check against all incompatible -fmodules-driver arguments
4194- if (!ModulesModeCXX20 && !Args.hasArgNoClaim (options::OPT_fmodules))
4195- Args.eraseArg (options::OPT_fmodules_driver);
4196-
41974191 Arg *FinalPhaseArg;
41984192 phases::ID FinalPhase = getFinalPhase (Args, &FinalPhaseArg);
41994193
@@ -4320,33 +4314,6 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
43204314 }
43214315}
43224316
4323- static bool hasCXXModuleInputType (const Driver::InputList &Inputs) {
4324- const auto IsTypeCXXModule = [](const auto &Input) -> bool {
4325- const auto TypeID = Input.first ;
4326- return (TypeID == types::TY_CXXModule);
4327- };
4328- return llvm::any_of (Inputs, IsTypeCXXModule);
4329- }
4330-
4331- llvm::ErrorOr<bool >
4332- Driver::ScanInputsForCXX20ModulesUsage (const InputList &Inputs) const {
4333- const auto CXXInputs = llvm::make_filter_range (
4334- Inputs, [](const auto &Input) { return types::isCXX (Input.first ); });
4335- for (const auto &Input : CXXInputs) {
4336- StringRef Filename = Input.second ->getSpelling ();
4337- auto ErrOrBuffer = VFS->getBufferForFile (Filename);
4338- if (!ErrOrBuffer)
4339- return ErrOrBuffer.getError ();
4340- const auto Buffer = std::move (*ErrOrBuffer);
4341-
4342- if (scanInputForCXX20ModulesUsage (Buffer->getBuffer ())) {
4343- Diags.Report (diag::remark_found_cxx20_module_usage) << Filename;
4344- return true ;
4345- }
4346- }
4347- return false ;
4348- }
4349-
43504317void Driver::BuildActions (Compilation &C, DerivedArgList &Args,
43514318 const InputList &Inputs, ActionList &Actions) const {
43524319 llvm::PrettyStackTraceString CrashInfo (" Building compilation actions" );
@@ -4358,33 +4325,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
43584325
43594326 handleArguments (C, Args, Inputs, Actions);
43604327
4361- if (Args.hasFlag (options::OPT_fmodules_driver,
4362- options::OPT_fno_modules_driver, false )) {
4363- // TODO: Move the logic for implicitly enabling explicit-module-builds out
4364- // of -fmodules-driver once it is no longer experimental.
4365- // Currently, this serves diagnostic purposes only.
4366- bool UsesCXXModules = hasCXXModuleInputType (Inputs);
4367- if (!UsesCXXModules) {
4368- const auto ErrOrScanResult = ScanInputsForCXX20ModulesUsage (Inputs);
4369- if (!ErrOrScanResult) {
4370- Diags.Report (diag::err_cannot_open_file)
4371- << ErrOrScanResult.getError ().message ();
4372- return ;
4373- }
4374- UsesCXXModules = *ErrOrScanResult;
4375- }
4376- if (UsesCXXModules || Args.hasArg (options::OPT_fmodules))
4377- BuildDriverManagedModuleBuildActions (C, Args, Inputs, Actions);
4378- return ;
4379- }
4380-
4381- BuildDefaultActions (C, Args, Inputs, Actions);
4382- }
4383-
4384- void Driver::BuildDefaultActions (Compilation &C, DerivedArgList &Args,
4385- const InputList &Inputs,
4386- ActionList &Actions) const {
4387-
43884328 bool UseNewOffloadingDriver =
43894329 C.isOffloadingHostKind (Action::OFK_OpenMP) ||
43904330 C.isOffloadingHostKind (Action::OFK_SYCL) ||
@@ -4642,28 +4582,16 @@ void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args,
46424582 }
46434583 }
46444584
4585+ // Call validator for dxil when -Vd not in Args.
46454586 if (C.getDefaultToolChain ().getTriple ().isDXIL ()) {
4587+ // Only add action when needValidation.
46464588 const auto &TC =
46474589 static_cast <const toolchains::HLSLToolChain &>(C.getDefaultToolChain ());
4648-
4649- // Call objcopy for manipulation of the unvalidated DXContainer when an
4650- // option in Args requires it.
4651- if (TC.requiresObjcopy (Args)) {
4652- Action *LastAction = Actions.back ();
4653- // llvm-objcopy expects an unvalidated DXIL container (TY_OBJECT).
4654- if (LastAction->getType () == types::TY_Object)
4655- Actions.push_back (
4656- C.MakeAction <ObjcopyJobAction>(LastAction, types::TY_Object));
4657- }
4658-
4659- // Call validator for dxil when -Vd not in Args.
46604590 if (TC.requiresValidation (Args)) {
46614591 Action *LastAction = Actions.back ();
46624592 Actions.push_back (C.MakeAction <BinaryAnalyzeJobAction>(
46634593 LastAction, types::TY_DX_CONTAINER));
46644594 }
4665-
4666- // Call metal-shaderconverter when targeting metal.
46674595 if (TC.requiresBinaryTranslation (Args)) {
46684596 Action *LastAction = Actions.back ();
46694597 // Metal shader converter runs on DXIL containers, which can either be
@@ -4680,12 +4608,6 @@ void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args,
46804608 Args.ClaimAllArgs (options::OPT_cl_ignored_Group);
46814609}
46824610
4683- void Driver::BuildDriverManagedModuleBuildActions (
4684- Compilation &C, llvm::opt::DerivedArgList &Args, const InputList &Inputs,
4685- ActionList &Actions) const {
4686- Diags.Report (diag::remark_performing_driver_managed_module_build);
4687- }
4688-
46894611// / Returns the canonical name for the offloading architecture when using a HIP
46904612// / or CUDA architecture.
46914613static StringRef getCanonicalArchString (Compilation &C,
@@ -6265,9 +6187,8 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
62656187 C.getArgs ().hasArg (options::OPT_dxc_Fo)) ||
62666188 JA.getType () == types::TY_DX_CONTAINER) {
62676189 StringRef FoValue = C.getArgs ().getLastArgValue (options::OPT_dxc_Fo);
6268- // If we are targeting DXIL and not validating/translating/objcopying, we
6269- // should set the final result file. Otherwise we should emit to a
6270- // temporary.
6190+ // If we are targeting DXIL and not validating or translating, we should set
6191+ // the final result file. Otherwise we should emit to a temporary.
62716192 if (C.getDefaultToolChain ().getTriple ().isDXIL ()) {
62726193 const auto &TC = static_cast <const toolchains::HLSLToolChain &>(
62736194 C.getDefaultToolChain ());
@@ -6613,9 +6534,6 @@ std::string Driver::GetStdModuleManifestPath(const Compilation &C,
66136534 const ToolChain &TC) const {
66146535 std::string error = " <NOT PRESENT>" ;
66156536
6616- if (C.getArgs ().hasArg (options::OPT_nostdlib))
6617- return error;
6618-
66196537 switch (TC.GetCXXStdlibType (C.getArgs ())) {
66206538 case ToolChain::CST_Libcxx: {
66216539 auto evaluate = [&](const char *library) -> std::optional<std::string> {
@@ -6836,8 +6754,6 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
68366754 TC = std::make_unique<toolchains::VEToolChain>(*this , Target, Args);
68376755 else if (Target.isOHOSFamily ())
68386756 TC = std::make_unique<toolchains::OHOS>(*this , Target, Args);
6839- else if (Target.isWALI ())
6840- TC = std::make_unique<toolchains::WebAssembly>(*this , Target, Args);
68416757 else
68426758 TC = std::make_unique<toolchains::Linux>(*this , Target, Args);
68436759 break ;
0 commit comments