[clang] 999ead9 - [Modules] Code cleanup after removing ModulesTS
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 15 23:24:01 PST 2023
Author: Chuanqi Xu
Date: 2023-02-16T15:22:38+08:00
New Revision: 999ead9dc9080cf95445149e6dae1de087ef90b8
URL: https://github.com/llvm/llvm-project/commit/999ead9dc9080cf95445149e6dae1de087ef90b8
DIFF: https://github.com/llvm/llvm-project/commit/999ead9dc9080cf95445149e6dae1de087ef90b8.diff
LOG: [Modules] Code cleanup after removing ModulesTS
Some codes become unused after we remove ModulesTS.
Added:
Modified:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaModule.cpp
clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
clang/test/CXX/module/module.interface/p1.cpp
clang/test/Modules/cxx20-10-2-ex1.cpp
clang/test/Modules/cxx20-export-import.cpp
clang/test/Modules/cxx20-import-diagnostics-a.cpp
clang/test/Modules/export-in-non-modules.cpp
clang/test/SemaCXX/modules.cppm
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index af714de6b6072..5ab134592e865 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 223190602d921..80b6f9d0ab1d5 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2280,8 +2280,6 @@ class Sema final {
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 c8a855d79a8e8..d9d0ed6784f46 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 1fd1941ebf429..f1c409078f413 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 dda584799ae30..963a8bc7e128c 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 0947b81915eb1..fcc88aff41d1e 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 at +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 e91997afe898a..007f080804836 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 at std-10-2-ex1.h:* {{export declaration can only be used within a module interface unit after the module declaration}}
+// expected-error at 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 6424ed5cebe35..c40069e1df20d 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 c5d22805d29ea..4c94a593b8d2b 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 c10d863d27005..69360eb46d774 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 0111082c98626..afa9176a7eb5d 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
More information about the cfe-commits
mailing list