aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-02-15 18:30:49 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-02-16 14:40:32 +0800
commit612f3ac26f8cdb7487408b5541b224876564e57c (patch)
treef8db21882cbb9fec83e9916ade7364c07823acb9 /clang/lib
parent96df79af029b85616ab90e73143e0e8ae89c7b46 (diff)
downloadllvm-612f3ac26f8cdb7487408b5541b224876564e57c.zip
llvm-612f3ac26f8cdb7487408b5541b224876564e57c.tar.gz
llvm-612f3ac26f8cdb7487408b5541b224876564e57c.tar.bz2
[Modules] Remove -fmodules-ts
As the diagnostic message shows, we should remove -fmodules-ts flag in clang/llvm17. Since clang/llvm16 is already branched. We can remove the depreacared flag now.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Decl.cpp16
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp2
-rw-r--r--clang/lib/CodeGen/ItaniumCXXABI.cpp1
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp1
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp5
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp5
-rw-r--r--clang/lib/Index/IndexSymbol.cpp1
-rw-r--r--clang/lib/Lex/PPDirectives.cpp3
-rw-r--r--clang/lib/Lex/Preprocessor.cpp10
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp9
-rw-r--r--clang/lib/Parse/Parser.cpp12
-rw-r--r--clang/lib/Sema/Sema.cpp10
-rw-r--r--clang/lib/Sema/SemaModule.cpp26
13 files changed, 25 insertions, 76 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index eb633ef..cd09e2f 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -601,22 +601,14 @@ static bool isExportedFromModuleInterfaceUnit(const NamedDecl *D) {
}
static LinkageInfo getInternalLinkageFor(const NamedDecl *D) {
- // (for the modules ts) Internal linkage declarations within a module
- // interface unit are modeled as "module-internal linkage", which means that
- // they have internal linkage formally but can be indirectly accessed from
- // outside the module via inline functions and templates defined within the
- // module.
- if (isInModulePurview(D) && D->getASTContext().getLangOpts().ModulesTS)
- return LinkageInfo(ModuleInternalLinkage, DefaultVisibility, false);
-
return LinkageInfo::internal();
}
static LinkageInfo getExternalLinkageFor(const NamedDecl *D) {
- // C++ Modules TS [basic.link]/6.8:
- // - A name declared at namespace scope that does not have internal linkage
- // by the previous rules and that is introduced by a non-exported
- // declaration has module linkage.
+ // C++ [basic.link]p4.8:
+ // - if the declaration of the name is attached to a named module and is not
+ // exported
+ // the name has module linkage;
//
// [basic.namespace.general]/p2
// A namespace is never attached to a named module and never has a name with
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 63b08d8..97dc5cd 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -191,7 +191,7 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts,
case KEYCOROUTINES:
return LangOpts.Coroutines ? KS_Enabled : KS_Unknown;
case KEYMODULES:
- return LangOpts.ModulesTS ? KS_Enabled : KS_Unknown;
+ return KS_Unknown;
case KEYOPENCLCXX:
return LangOpts.OpenCLCPlusPlus ? KS_Enabled : KS_Unknown;
case KEYMSCOMPAT:
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 1840303..7685902 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3643,7 +3643,6 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
return llvm::GlobalValue::InternalLinkage;
case VisibleNoLinkage:
- case ModuleInternalLinkage:
case ModuleLinkage:
case ExternalLinkage:
// RTTI is not enabled, which means that this type info struct is going
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index ae785cc..93b81db 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -3655,7 +3655,6 @@ static llvm::GlobalValue::LinkageTypes getLinkageForRTTI(QualType Ty) {
return llvm::GlobalValue::InternalLinkage;
case VisibleNoLinkage:
- case ModuleInternalLinkage:
case ModuleLinkage:
case ExternalLinkage:
return llvm::GlobalValue::LinkOnceODRLinkage;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7b91fdf..31c9c1a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3686,11 +3686,6 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
}
HaveModules |= HaveClangModules;
- if (Args.hasArg(options::OPT_fmodules_ts)) {
- D.Diag(diag::warn_deprecated_fmodules_ts_flag);
- CmdArgs.push_back("-fmodules-ts");
- HaveModules = true;
- }
// -fmodule-maps enables implicit reading of module map files. By default,
// this is enabled if we are using Clang's flavor of precompiled modules.
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index b5e868f..ccb983d 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -251,11 +251,6 @@ GenerateModuleFromModuleMapAction::CreateOutputFile(CompilerInstance &CI,
bool GenerateModuleInterfaceAction::BeginSourceFileAction(
CompilerInstance &CI) {
- if (!CI.getLangOpts().ModulesTS && !CI.getLangOpts().CPlusPlusModules) {
- CI.getDiagnostics().Report(diag::err_module_interface_requires_cpp_modules);
- return false;
- }
-
CI.getLangOpts().setCompilingModule(LangOptions::CMK_ModuleInterface);
return GenerateModuleAction::BeginSourceFileAction(CI);
diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp
index a40c218..d731653 100644
--- a/clang/lib/Index/IndexSymbol.cpp
+++ b/clang/lib/Index/IndexSymbol.cpp
@@ -71,7 +71,6 @@ bool index::isFunctionLocalSymbol(const Decl *D) {
return true;
case VisibleNoLinkage:
case UniqueExternalLinkage:
- case ModuleInternalLinkage:
llvm_unreachable("Not a sema linkage");
case ModuleLinkage:
case ExternalLinkage:
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 6ae513d..9e23925 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -902,8 +902,7 @@ Preprocessor::getHeaderToIncludeForDiagnostics(SourceLocation IncLoc,
// If we have a module import syntax, we shouldn't include a header to
// make a particular module visible. Let the caller know they should
// suggest an import instead.
- if (getLangOpts().ObjC || getLangOpts().CPlusPlusModules ||
- getLangOpts().ModulesTS)
+ if (getLangOpts().ObjC || getLangOpts().CPlusPlusModules)
return nullptr;
// If this is an accessible, non-textual header of M's top-level module
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 7ec5247..27be7d6 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -865,7 +865,7 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) {
// keyword when we're in a caching lexer, because caching lexers only get
// used in contexts where import declarations are disallowed.
//
- // Likewise if this is the C++ Modules TS import keyword.
+ // Likewise if this is the standard C++ import keyword.
if (((LastTokenWasAt && II.isModulesImport()) ||
Identifier.is(tok::kw_import)) &&
!InMacroArgs && !DisableMacroExpansion &&
@@ -1279,7 +1279,7 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) {
// If we're expecting a '.' or a ';', and we got a '.', then wait until we
// see the next identifier. (We can also see a '[[' that begins an
- // attribute-specifier-seq here under the C++ Modules TS.)
+ // attribute-specifier-seq here under the Standard C++ Modules.)
if (!ModuleImportExpectsIdentifier && Result.getKind() == tok::period) {
ModuleImportExpectsIdentifier = true;
CurLexerKind = CLK_LexAfterModuleImport;
@@ -1304,12 +1304,12 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) {
SemiLoc = Suffix.back().getLocation();
}
- // Under the Modules TS, the dot is just part of the module name, and not
- // a real hierarchy separator. Flatten such module names now.
+ // Under the standard C++ Modules, the dot is just part of the module name,
+ // and not a real hierarchy separator. Flatten such module names now.
//
// FIXME: Is this the right level to be performing this transformation?
std::string FlatModuleName;
- if (getLangOpts().ModulesTS || getLangOpts().CPlusPlusModules) {
+ if (getLangOpts().CPlusPlusModules) {
for (auto &Piece : NamedModuleImportPath) {
// If the FlatModuleName ends with colon, it implies it is a partition.
if (!FlatModuleName.empty() && FlatModuleName.back() != ':')
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 227c1df..c7d8eb0 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -428,7 +428,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, DeclaratorContext Context) {
: nullptr;
}
-/// Parse a C++ Modules TS export-declaration.
+/// Parse a standard C++ Modules export-declaration.
///
/// export-declaration:
/// 'export' declaration
@@ -456,13 +456,6 @@ Decl *Parser::ParseExportDeclaration() {
BalancedDelimiterTracker T(*this, tok::l_brace);
T.consumeOpen();
- // The Modules TS draft says "An export-declaration shall declare at least one
- // entity", but the intent is that it shall contain at least one declaration.
- if (Tok.is(tok::r_brace) && getLangOpts().ModulesTS) {
- Diag(ExportLoc, diag::err_export_empty)
- << SourceRange(ExportLoc, Tok.getLocation());
- }
-
while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
Tok.isNot(tok::eof)) {
ParsedAttributes DeclAttrs(AttrFactory);
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index c197d6b..829a187 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -630,8 +630,8 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result,
goto module_decl;
// Note: no need to handle kw_import here. We only form kw_import under
- // the Modules TS, and in that case 'export import' is parsed as an
- // export-declaration containing an import-declaration.
+ // the Standard C++ Modules, and in that case 'export import' is parsed as
+ // an export-declaration containing an import-declaration.
// Recognize context-sensitive C++20 'export module' and 'export import'
// declarations.
@@ -786,7 +786,7 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result,
///
/// [C++0x/GNU] 'extern' 'template' declaration
///
-/// [Modules-TS] module-import-declaration
+/// [C++20] module-import-declaration
///
Parser::DeclGroupPtrTy
Parser::ParseExternalDeclaration(ParsedAttributes &Attrs,
@@ -938,7 +938,7 @@ Parser::ParseExternalDeclaration(ParsedAttributes &Attrs,
SingleDecl = ParseModuleImport(SourceLocation(), IS);
} break;
case tok::kw_export:
- if (getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS) {
+ if (getLangOpts().CPlusPlusModules) {
ProhibitAttributes(Attrs);
SingleDecl = ParseExportDeclaration();
break;
@@ -2388,7 +2388,7 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() {
/// Parse a declaration beginning with the 'module' keyword or C++20
/// context-sensitive keyword (optionally preceded by 'export').
///
-/// module-declaration: [Modules TS + P0629R0]
+/// module-declaration: [C++20]
/// 'export'[opt] 'module' module-name attribute-specifier-seq[opt] ';'
///
/// global-module-fragment: [C++2a]
@@ -2614,7 +2614,7 @@ Decl *Parser::ParseModuleImport(SourceLocation AtLoc,
return Import.get();
}
-/// Parse a C++ Modules TS / Objective-C module name (both forms use the same
+/// Parse a C++ / Objective-C module name (both forms use the same
/// grammar).
///
/// module-name:
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 80f502c..c8a855d 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1024,16 +1024,6 @@ void Sema::ActOnStartOfTranslationUnit() {
if (getLangOpts().CPlusPlusModules &&
getLangOpts().getCompilingModule() == LangOptions::CMK_HeaderUnit)
HandleStartOfHeaderUnit();
- else if (getLangOpts().ModulesTS &&
- (getLangOpts().getCompilingModule() ==
- LangOptions::CMK_ModuleInterface ||
- getLangOpts().getCompilingModule() == LangOptions::CMK_None)) {
- // We start in an implied global module fragment.
- SourceLocation StartOfTU =
- SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
- ActOnGlobalModuleFragmentDecl(StartOfTU);
- ModuleScopes.back().ImplicitGlobalModuleFragment = true;
- }
}
void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) {
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index 8f38dc8..1fd1941 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -74,16 +74,6 @@ static std::string stringFromPath(ModuleIdPath Path) {
Sema::DeclGroupPtrTy
Sema::ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc) {
- if (!ModuleScopes.empty() &&
- ModuleScopes.back().Module->Kind == Module::GlobalModuleFragment) {
- // Under -std=c++2a -fmodules-ts, we can find an explicit 'module;' after
- // already implicitly entering the global module fragment. That's OK.
- assert(getLangOpts().CPlusPlusModules && getLangOpts().ModulesTS &&
- "unexpectedly encountered multiple global module fragment decls");
- ModuleScopes.back().BeginLoc = ModuleLoc;
- return nullptr;
- }
-
// We start in the global module; all those declarations are implicitly
// module-private (though they do not have module linkage).
Module *GlobalModule =
@@ -179,8 +169,8 @@ Sema::DeclGroupPtrTy
Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc,
ModuleDeclKind MDK, ModuleIdPath Path,
ModuleIdPath Partition, ModuleImportState &ImportState) {
- assert((getLangOpts().ModulesTS || getLangOpts().CPlusPlusModules) &&
- "should only have module decl in Modules TS or C++20");
+ assert(getLangOpts().CPlusPlusModules &&
+ "should only have module decl in standard C++ modules");
bool IsFirstDecl = ImportState == ModuleImportState::FirstDecl;
bool SeenGMF = ImportState == ModuleImportState::GlobalFragment;
@@ -244,7 +234,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc,
return nullptr;
}
- assert((!getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS ||
+ assert((!getLangOpts().CPlusPlusModules ||
SeenGMF == (bool)this->GlobalModuleFragment) &&
"mismatched global module state");
@@ -484,9 +474,8 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
SourceLocation ExportLoc,
SourceLocation ImportLoc, ModuleIdPath Path,
bool IsPartition) {
-
- bool Cxx20Mode = getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS;
- assert((!IsPartition || Cxx20Mode) && "partition seen in non-C++20 code?");
+ assert((!IsPartition || getLangOpts().CPlusPlusModules) &&
+ "partition seen in non-C++20 code?");
// For a C++20 module name, flatten into a single identifier with the source
// location of the first component.
@@ -504,7 +493,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
ModuleName += stringFromPath(Path);
ModuleNameLoc = {PP.getIdentifierInfo(ModuleName), Path[0].second};
Path = ModuleIdPath(ModuleNameLoc);
- } else if (Cxx20Mode) {
+ } else if (getLangOpts().CPlusPlusModules) {
ModuleName = stringFromPath(Path);
ModuleNameLoc = {PP.getIdentifierInfo(ModuleName), Path[0].second};
Path = ModuleIdPath(ModuleNameLoc);
@@ -552,8 +541,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
// of the same top-level module. Until we do, make it an error rather than
// silently ignoring the import.
// FIXME: Should we warn on a redundant import of the current module?
- if (Mod->isForBuilding(getLangOpts()) &&
- (getLangOpts().isCompilingModule() || !getLangOpts().ModulesTS)) {
+ if (Mod->isForBuilding(getLangOpts())) {
Diag(ImportLoc, getLangOpts().isCompilingModule()
? diag::err_module_self_import
: diag::err_module_import_in_implementation)