From 1614d6340597d29ca8214acc2eff80df50392d36 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Fri, 18 Nov 2022 11:49:33 +0800 Subject: [PATCH] [NFC] Remove unused codes after 4a7be42d922af There are still some unused codes remained after 4a7be42d922af. And this patch tries to remove them. --- clang/include/clang/Basic/DiagnosticFrontendKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 +- clang/include/clang/Basic/LangOptions.h | 3 --- clang/include/clang/Driver/Action.h | 4 +--- clang/lib/Driver/ToolChain.cpp | 1 - clang/lib/Driver/ToolChains/Clang.cpp | 7 ++----- clang/lib/Sema/SemaModule.cpp | 3 +-- 7 files changed, 5 insertions(+), 18 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td index f0212ca..6ac8537 100644 --- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -213,9 +213,6 @@ def err_module_build_requires_fmodules : Error< "module compilation requires '-fmodules'">; def err_module_interface_requires_cpp_modules : Error< "module interface compilation requires '-std=c++20' or '-fmodules-ts'">; -def err_header_module_requires_modules : Error< - "header module compilation requires '-fmodules', '-std=c++20', or " - "'-fmodules-ts'">; def warn_module_config_mismatch : Warning< "module file %0 cannot be loaded due to a configuration mismatch with the current " "compilation">, InGroup>, DefaultError; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 03fa742..247d8e7 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11095,7 +11095,7 @@ def err_invalid_type_for_program_scope_var : Error< let CategoryName = "Modules Issue" in { def err_module_decl_in_module_map_module : Error< "'module' declaration found while building module from module map">; -def err_module_decl_in_header_module : Error< +def err_module_decl_in_header_unit : Error< "'module' declaration found while building header unit">; def err_module_interface_implementation_mismatch : Error< "missing 'export' specifier in module declaration while " diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index 30c96c1..70b1234 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -110,9 +110,6 @@ public: /// Compiling a module from a module map. CMK_ModuleMap, - /// Compiling a module from a list of header files. - CMK_HeaderModule, - /// Compiling a module header unit. CMK_HeaderUnit, diff --git a/clang/include/clang/Driver/Action.h b/clang/include/clang/Driver/Action.h index 39aa80c..f8b0621 100644 --- a/clang/include/clang/Driver/Action.h +++ b/clang/include/clang/Driver/Action.h @@ -58,7 +58,6 @@ public: OffloadClass, PreprocessJobClass, PrecompileJobClass, - HeaderModulePrecompileJobClass, ExtractAPIJobClass, AnalyzeJobClass, MigrateJobClass, @@ -431,8 +430,7 @@ public: PrecompileJobAction(Action *Input, types::ID OutputType); static bool classof(const Action *A) { - return A->getKind() == PrecompileJobClass || - A->getKind() == HeaderModulePrecompileJobClass; + return A->getKind() == PrecompileJobClass; } }; diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 695741f..a1efa1f 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -395,7 +395,6 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const { case Action::CompileJobClass: case Action::PrecompileJobClass: - case Action::HeaderModulePrecompileJobClass: case Action::PreprocessJobClass: case Action::ExtractAPIJobClass: case Action::AnalyzeJobClass: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index beed44d..3833fb4 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4558,11 +4558,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, InputInfo ExtractAPIPlaceholderInput(Inputs[0].getType(), "extract-api", "extract-api"); - const InputInfo &Input = [&]() -> const InputInfo & { - if (IsExtractAPI) - return ExtractAPIPlaceholderInput; - return Inputs[0]; - }(); + const InputInfo &Input = + IsExtractAPI ? ExtractAPIPlaceholderInput : Inputs[0]; InputInfoList ExtractAPIInputs; InputInfoList HostOffloadingInputs; diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 3d4fef1..1a48a060 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -225,9 +225,8 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, Diag(ModuleLoc, diag::err_module_decl_in_module_map_module); return nullptr; - case LangOptions::CMK_HeaderModule: case LangOptions::CMK_HeaderUnit: - Diag(ModuleLoc, diag::err_module_decl_in_header_module); + Diag(ModuleLoc, diag::err_module_decl_in_header_unit); return nullptr; } -- 2.7.4