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) ||
@@ -4680,12 +4620,6 @@ void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args,
46804620 Args.ClaimAllArgs (options::OPT_cl_ignored_Group);
46814621}
46824622
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-
46894623// / Returns the canonical name for the offloading architecture when using a HIP
46904624// / or CUDA architecture.
46914625static StringRef getCanonicalArchString (Compilation &C,
0 commit comments