diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-02-16 15:22:12 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-02-16 15:22:38 +0800 |
commit | 999ead9dc9080cf95445149e6dae1de087ef90b8 (patch) | |
tree | 7aa4e6aba58d6c01b986775e44053021b44702fa | |
parent | 612f3ac26f8cdb7487408b5541b224876564e57c (diff) | |
download | llvm-999ead9dc9080cf95445149e6dae1de087ef90b8.zip llvm-999ead9dc9080cf95445149e6dae1de087ef90b8.tar.gz llvm-999ead9dc9080cf95445149e6dae1de087ef90b8.tar.bz2 |
[Modules] Code cleanup after removing ModulesTS
Some codes become unused after we remove ModulesTS.
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 | ||||
-rw-r--r-- | clang/include/clang/Sema/Sema.h | 2 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 8 | ||||
-rw-r--r-- | clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm | 2 | ||||
-rw-r--r-- | clang/test/CXX/module/module.interface/p1.cpp | 6 | ||||
-rw-r--r-- | clang/test/Modules/cxx20-10-2-ex1.cpp | 2 | ||||
-rw-r--r-- | clang/test/Modules/cxx20-export-import.cpp | 2 | ||||
-rw-r--r-- | clang/test/Modules/cxx20-import-diagnostics-a.cpp | 2 | ||||
-rw-r--r-- | clang/test/Modules/export-in-non-modules.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/modules.cppm | 2 |
11 files changed, 12 insertions, 22 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index af714de..5ab1345 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -11229,8 +11229,7 @@ def err_export_using_internal : Error< "using declaration referring to %1 with %select{internal|module|unknown}0 " "linkage cannot be exported">; def err_export_not_in_module_interface : Error< - "export declaration can only be used within a module interface unit" - "%select{ after the module declaration|}0">; + "export declaration can only be used within a module purview">; def err_export_inline_not_defined : Error< "inline function not defined%select{| before the private module fragment}0">; def err_export_partition_impl : Error< diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 2231906..80b6f9d 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -2280,8 +2280,6 @@ private: SourceLocation BeginLoc; clang::Module *Module = nullptr; bool ModuleInterface = false; - bool IsPartition = false; - bool ImplicitGlobalModuleFragment = false; VisibleModuleSet OuterVisibleModules; }; /// The modules we're currently parsing. diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index c8a855d..d9d0ed6 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1196,8 +1196,7 @@ void Sema::ActOnEndOfTranslationUnit() { // A global-module-fragment is only permitted within a module unit. bool DiagnosedMissingModuleDeclaration = false; if (!ModuleScopes.empty() && - ModuleScopes.back().Module->Kind == Module::GlobalModuleFragment && - !ModuleScopes.back().ImplicitGlobalModuleFragment) { + ModuleScopes.back().Module->Kind == Module::GlobalModuleFragment) { Diag(ModuleScopes.back().BeginLoc, diag::err_module_declaration_missing_after_global_module_introducer); DiagnosedMissingModuleDeclaration = true; diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 1fd1941..f1c4090 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -125,7 +125,6 @@ void Sema::HandleStartOfHeaderUnit() { ModuleScopes.back().BeginLoc = StartOfTU; ModuleScopes.back().Module = Mod; ModuleScopes.back().ModuleInterface = true; - ModuleScopes.back().IsPartition = false; VisibleModules.setVisible(Mod, StartOfTU); // From now on, we have an owning module for all declarations we see. @@ -373,7 +372,6 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleScopes.back().BeginLoc = StartLoc; ModuleScopes.back().Module = Mod; ModuleScopes.back().ModuleInterface = MDK != ModuleDeclKind::Implementation; - ModuleScopes.back().IsPartition = IsPartition; VisibleModules.setVisible(Mod, ModuleLoc); // From now on, we have an owning module for all declarations we see. @@ -601,9 +599,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, // [module.interface]p1: // An export-declaration shall inhabit a namespace scope and appear in the // purview of a module interface unit. - Diag(ExportLoc, diag::err_export_not_in_module_interface) - << (!ModuleScopes.empty() && - !ModuleScopes.back().ImplicitGlobalModuleFragment); + Diag(ExportLoc, diag::err_export_not_in_module_interface); } // In some cases we need to know if an entity was present in a directly- @@ -980,8 +976,6 @@ Module *Sema::PushGlobalModuleFragment(SourceLocation BeginLoc, // Enter the scope of the global module. ModuleScopes.push_back({BeginLoc, GlobalModuleFragment, /*ModuleInterface=*/false, - /*IsPartition=*/false, - /*ImplicitGlobalModuleFragment=*/IsImplicit, /*OuterVisibleModules=*/{}}); VisibleModules.setVisible(GlobalModuleFragment, BeginLoc); diff --git a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm index dda5847..963a8bc 100644 --- a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm +++ b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm @@ -22,7 +22,7 @@ module A; // #module-decl #endif #ifndef INTERFACE -export int b; // expected-error {{export declaration can only be used within a module interface unit}} +export int b; // expected-error {{export declaration can only be used within a module purview}} #ifdef IMPLEMENTATION // expected-note@#module-decl {{add 'export' here}} #endif diff --git a/clang/test/CXX/module/module.interface/p1.cpp b/clang/test/CXX/module/module.interface/p1.cpp index 0947b81..fcc88af 100644 --- a/clang/test/CXX/module/module.interface/p1.cpp +++ b/clang/test/CXX/module/module.interface/p1.cpp @@ -5,14 +5,14 @@ module; #ifdef ERRORS -export int a; // expected-error {{after the module declaration}} +export int a; // expected-error {{export declaration can only be used within a module purview}} #endif #ifndef IMPLEMENTATION export #else -// expected-error@#1 {{can only be used within a module interface unit}} -// expected-error@#2 {{can only be used within a module interface unit}} +// expected-error@#1 {{export declaration can only be used within a module purview}} +// expected-error@#2 {{export declaration can only be used within a module purview}} // expected-note@+2 1+{{add 'export'}} #endif module M; diff --git a/clang/test/Modules/cxx20-10-2-ex1.cpp b/clang/test/Modules/cxx20-10-2-ex1.cpp index e91997af..007f080 100644 --- a/clang/test/Modules/cxx20-10-2-ex1.cpp +++ b/clang/test/Modules/cxx20-10-2-ex1.cpp @@ -14,7 +14,7 @@ export int x; module; #include "std-10-2-ex1.h" -// expected-error@std-10-2-ex1.h:* {{export declaration can only be used within a module interface unit after the module declaration}} +// expected-error@std-10-2-ex1.h:* {{export declaration can only be used within a module purview}} export module M1; export namespace {} // expected-error {{declaration does not introduce any names to be exported}} diff --git a/clang/test/Modules/cxx20-export-import.cpp b/clang/test/Modules/cxx20-export-import.cpp index 6424ed5..c40069e 100644 --- a/clang/test/Modules/cxx20-export-import.cpp +++ b/clang/test/Modules/cxx20-export-import.cpp @@ -1,4 +1,4 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify %s -export import dummy; // expected-error {{export declaration can only be used within a module interface unit after the module declaration}} +export import dummy; // expected-error {{export declaration can only be used within a module purview}} diff --git a/clang/test/Modules/cxx20-import-diagnostics-a.cpp b/clang/test/Modules/cxx20-import-diagnostics-a.cpp index c5d2280..4c94a59 100644 --- a/clang/test/Modules/cxx20-import-diagnostics-a.cpp +++ b/clang/test/Modules/cxx20-import-diagnostics-a.cpp @@ -70,7 +70,7 @@ module; module AOK1; -export import C; // expected-error {{export declaration can only be used within a module interface unit}} +export import C; // expected-error {{export declaration can only be used within a module purview}} int theAnswer () { return 42; } diff --git a/clang/test/Modules/export-in-non-modules.cpp b/clang/test/Modules/export-in-non-modules.cpp index c10d863..69360eb 100644 --- a/clang/test/Modules/export-in-non-modules.cpp +++ b/clang/test/Modules/export-in-non-modules.cpp @@ -1,4 +1,4 @@ // RUN: %clang_cc1 -std=c++20 %s -fsyntax-only -verify -export struct Unit { // expected-error {{export declaration can only be used within a module interface unit after the module declaration}} +export struct Unit { // expected-error {{export declaration can only be used within a module purview}} bool operator<(const Unit &); }; diff --git a/clang/test/SemaCXX/modules.cppm b/clang/test/SemaCXX/modules.cppm index 0111082..afa9176 100644 --- a/clang/test/SemaCXX/modules.cppm +++ b/clang/test/SemaCXX/modules.cppm @@ -81,7 +81,7 @@ struct S { export { extern "C++" { namespace NestedExport { - export { // expected-error {{export declaration can only be used within a module interface unit after the module declaration}} + export { // expected-error {{export declaration can only be used within a module purview}} int q; } } // namespace NestedExport |