ChuanqiXu updated this revision to Diff 385440.
ChuanqiXu added reviewers: aaron.ballman, rsmith, urnathan, dblaikie.
ChuanqiXu set the repository for this revision to rG LLVM Github Monorepo.
ChuanqiXu added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113391/new/
https://reviews.llvm.org/D113391
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/Basic/Features.def
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Driver/Options.td
clang/include/clang/Lex/Preprocessor.h
clang/lib/ARCMigrate/ObjCMT.cpp
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/DeclObjC.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/ASTUnit.cpp
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Frontend/FrontendActions.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/Preprocessor.cpp
clang/lib/Parse/ParseObjc.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/ClangScanDeps/Inputs/header-search-pruning/cdb.json
clang/test/ClangScanDeps/Inputs/module_fmodule_name_cdb.json
clang/test/ClangScanDeps/Inputs/modules_cdb.json
clang/test/ClangScanDeps/Inputs/modules_cdb_by_mod_name.json
clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json
clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
clang/test/ClangScanDeps/Inputs/modules_inferred_cdb.json
clang/test/Driver/conflict-clang-module-and-cxx20-module.cpp
clang/test/Modules/cxx20.cpp
clang/test/Modules/ms-enums.cpp
clang/test/SemaCXX/compare-modules-cxx2a.cpp
clang/tools/libclang/Indexing.cpp
Index: clang/tools/libclang/Indexing.cpp
===================================================================
--- clang/tools/libclang/Indexing.cpp
+++ clang/tools/libclang/Indexing.cpp
@@ -604,7 +604,7 @@
PPOpts.DetailedRecord = true;
}
- if (!requestedToGetTU && !CInvok->getLangOpts()->Modules)
+ if (!requestedToGetTU && !CInvok->getLangOpts()->hasModules())
PPOpts.DetailedRecord = false;
// Unless the user specified that they want the preamble on the first parse
Index: clang/test/SemaCXX/compare-modules-cxx2a.cpp
===================================================================
--- clang/test/SemaCXX/compare-modules-cxx2a.cpp
+++ clang/test/SemaCXX/compare-modules-cxx2a.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -I%S/Inputs %s -fno-modules-error-recovery
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -fno-cxx-modules -I%S/Inputs %s -fno-modules-error-recovery
#pragma clang module build compare
module compare {
Index: clang/test/Modules/ms-enums.cpp
===================================================================
--- clang/test/Modules/ms-enums.cpp
+++ clang/test/Modules/ms-enums.cpp
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -fms-compatibility -x c++ -std=c++20 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/ms-enums %s -verify -fno-modules-error-recovery
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -fms-compatibility -x c++ -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/ms-enums %s -verify -fno-modules-error-recovery
#include "B.h"
// [email protected]:1 {{declaration here is not visible}}
Index: clang/test/Modules/cxx20.cpp
===================================================================
--- clang/test/Modules/cxx20.cpp
+++ clang/test/Modules/cxx20.cpp
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -x c++ -std=c++20 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/cxx20 %s -verify -fno-modules-error-recovery
+// RUN: %clang_cc1 -x c++ -std=c++20 -fmodules-cache-path=%t -fmodules -fno-cxx-modules -fimplicit-module-maps -I %S/Inputs/cxx20 %s -verify -fno-modules-error-recovery
// expected-no-diagnostics
Index: clang/test/Driver/conflict-clang-module-and-cxx20-module.cpp
===================================================================
--- /dev/null
+++ clang/test/Driver/conflict-clang-module-and-cxx20-module.cpp
@@ -0,0 +1,7 @@
+// RUN: %clangxx -### -c %s -std=c++20 -fmodules 2>&1 | FileCheck %s
+// RUN: %clangxx -### -c %s -std=c++2a -fmodules 2>&1 | FileCheck %s
+// RUN: %clangxx -### -c %s -std=c++20 -fmodules -fno-cxx-modules 2>&1 | FileCheck %s --check-prefix=FINE
+// RUN: %clangxx -### -c %s -fcxx-modules -fmodules -fcxx-modules 2>&1 | FileCheck %s
+
+// CHECK: error: Unable to use clang module and c++20 module at the same time.
+// FINE-NOT: error: Unable to use clang module and c++20 module at the same time.
Index: clang/test/ClangScanDeps/Inputs/modules_inferred_cdb.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/modules_inferred_cdb.json
+++ clang/test/ClangScanDeps/Inputs/modules_inferred_cdb.json
@@ -1,7 +1,5 @@
-[
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules_cdb_input.cpp -FFRAMEWORKS -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -pedantic -Werror",
- "file": "DIR/modules_cdb_input.cpp"
-}
-]
+[{
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules_cdb_input.cpp -FFRAMEWORKS -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -pedantic -Werror",
+ "file" : "DIR/modules_cdb_input.cpp"
+}]
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
@@ -1,12 +1,11 @@
-[
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
- "file": ""
-},
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
- "file": ""
+[{
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+ "file" : ""
},
+ {
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+ "file" : ""
+ },
]
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl.json
@@ -1,22 +1,20 @@
-[
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input2.cpp",
- "file": "DIR/modules_cdb_input2.cpp"
+[{
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input2.cpp",
+ "file" : "DIR/modules_cdb_input2.cpp"
},
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input.cpp",
- "file": "DIR/modules_cdb_input.cpp"
-},
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o a.o -- DIR/modules_cdb_input.cpp",
- "file": "DIR/modules_cdb_input.cpp"
-},
-{
- "directory": "DIR",
- "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o b.o -- DIR/modules_cdb_input.cpp",
- "file": "DIR/modules_cdb_input.cpp"
-}
-]
+ {
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -- DIR/modules_cdb_input.cpp",
+ "file" : "DIR/modules_cdb_input.cpp"
+ },
+ {
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o a.o -- DIR/modules_cdb_input.cpp",
+ "file" : "DIR/modules_cdb_input.cpp"
+ },
+ {
+ "directory" : "DIR",
+ "command" : "clang-cl /E /IInputs /clang:-fmodules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps -o b.o -- DIR/modules_cdb_input.cpp",
+ "file" : "DIR/modules_cdb_input.cpp"
+ }]
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_by_mod_name.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/modules_cdb_by_mod_name.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_by_mod_name.json
@@ -1,12 +1,11 @@
-[
-{
- "directory": "DIR",
- "command": "clang -E -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb2.d -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -gmodules -x c++",
- "file": ""
-},
-{
- "directory": "DIR",
- "command": "clang -E -IInputs -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -x c++",
- "file": ""
+[{
+ "directory" : "DIR",
+ "command" : "clang -E -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb2.d -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -gmodules -x c++",
+ "file" : ""
},
+ {
+ "directory" : "DIR",
+ "command" : "clang -E -IInputs -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -x c++",
+ "file" : ""
+ },
]
Index: clang/test/ClangScanDeps/Inputs/modules_cdb.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/modules_cdb.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb.json
@@ -1,22 +1,20 @@
-[
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules_cdb_input2.cpp -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb2.d -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps",
- "file": "DIR/modules_cdb_input2.cpp"
+[{
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules_cdb_input2.cpp -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb2.d -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps",
+ "file" : "DIR/modules_cdb_input2.cpp"
},
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps",
- "file": "DIR/modules_cdb_input.cpp"
-},
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -o a.o",
- "file": "DIR/modules_cdb_input.cpp"
-},
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -o b.o",
- "file": "DIR/modules_cdb_input.cpp"
-}
-]
+ {
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps",
+ "file" : "DIR/modules_cdb_input.cpp"
+ },
+ {
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -o a.o",
+ "file" : "DIR/modules_cdb_input.cpp"
+ },
+ {
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules_cdb_input.cpp -IInputs -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -o b.o",
+ "file" : "DIR/modules_cdb_input.cpp"
+ }]
Index: clang/test/ClangScanDeps/Inputs/module_fmodule_name_cdb.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/module_fmodule_name_cdb.json
+++ clang/test/ClangScanDeps/Inputs/module_fmodule_name_cdb.json
@@ -1,7 +1,5 @@
-[
-{
- "directory": "DIR",
- "command": "clang -E DIR/modules-fmodule-name-no-module-built.m -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb.d -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fmodule-name=header3 -fimplicit-module-maps",
- "file": "DIR/modules-fmodule-name-no-module-built.m"
-}
-]
+[{
+ "directory" : "DIR",
+ "command" : "clang -E DIR/modules-fmodule-name-no-module-built.m -IInputs -D INCLUDE_HEADER2 -MD -MF DIR/modules_cdb.d -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fmodule-name=header3 -fimplicit-module-maps",
+ "file" : "DIR/modules-fmodule-name-no-module-built.m"
+}]
Index: clang/test/ClangScanDeps/Inputs/header-search-pruning/cdb.json
===================================================================
--- clang/test/ClangScanDeps/Inputs/header-search-pruning/cdb.json
+++ clang/test/ClangScanDeps/Inputs/header-search-pruning/cdb.json
@@ -1,7 +1,5 @@
-[
- {
- "directory": "DIR",
- "command": "clang -E DIR/header-search-pruning.cpp -Ibegin -I1 -Ia -I3 -I4 -I5 -I6 -Ib -I8 -Iend DEFINES -fmodules -fcxx-modules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fmodule-map-file=DIR/module.modulemap",
- "file": "DIR/header-search-pruning.cpp"
- }
-]
+[{
+ "directory" : "DIR",
+ "command" : "clang -E DIR/header-search-pruning.cpp -Ibegin -I1 -Ia -I3 -I4 -I5 -I6 -Ib -I8 -Iend DEFINES -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fmodule-map-file=DIR/module.modulemap",
+ "file" : "DIR/header-search-pruning.cpp"
+}]
Index: clang/lib/Serialization/ASTWriter.cpp
===================================================================
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -1426,7 +1426,7 @@
WriteInputFiles(Context.SourceMgr,
PP.getHeaderSearchInfo().getHeaderSearchOpts(),
- PP.getLangOpts().Modules);
+ PP.getLangOpts().hasModules());
Stream.ExitBlock();
}
@@ -3268,7 +3268,7 @@
/// recent declaration in any module that imports this one.
static NamedDecl *getDeclForLocalLookup(const LangOptions &LangOpts,
NamedDecl *D) {
- if (!LangOpts.Modules || !D->isFromASTFile())
+ if (!LangOpts.hasModules() || !D->isFromASTFile())
return D;
if (Decl *Redecl = D->getPreviousDecl()) {
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -758,7 +758,7 @@
// If this is a definition subject to the ODR, and we already have a
// definition, merge this one into it.
if (ED->isCompleteDefinition() &&
- Reader.getContext().getLangOpts().Modules &&
+ Reader.getContext().getLangOpts().hasModules() &&
Reader.getContext().getLangOpts().CPlusPlus) {
EnumDecl *&OldDef = Reader.EnumDefinitions[ED->getCanonicalDecl()];
if (!OldDef) {
@@ -1018,7 +1018,7 @@
if (InsertPos)
CommonPtr->Specializations.InsertNode(FTInfo, InsertPos);
else {
- assert(Reader.getContext().getLangOpts().Modules &&
+ assert(Reader.getContext().getLangOpts().hasModules() &&
"already deserialized this template specialization");
mergeRedeclarable(FD, ExistingInfo->getFunction(), Redecl);
}
@@ -2564,7 +2564,7 @@
RedeclarableResult &Redecl,
DeclID TemplatePatternID) {
// If modules are not available, there is no reason to perform this merge.
- if (!Reader.getContext().getLangOpts().Modules)
+ if (!Reader.getContext().getLangOpts().hasModules())
return;
// If we're not the canonical declaration, we don't need to merge.
@@ -2689,7 +2689,7 @@
/// identical class definitions from two different modules.
void ASTDeclReader::mergeMergeable(LifetimeExtendedTemporaryDecl *D) {
// If modules are not available, there is no reason to perform this merge.
- if (!Reader.getContext().getLangOpts().Modules)
+ if (!Reader.getContext().getLangOpts().hasModules())
return;
LifetimeExtendedTemporaryDecl *LETDecl = D;
@@ -2711,7 +2711,7 @@
template<typename T>
void ASTDeclReader::mergeMergeable(Mergeable<T> *D) {
// If modules are not available, there is no reason to perform this merge.
- if (!Reader.getContext().getLangOpts().Modules)
+ if (!Reader.getContext().getLangOpts().hasModules())
return;
// ODR-based merging is performed in C++ and in some cases (tag types) in C.
Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -703,7 +703,7 @@
}
// Detailed record is important since it is used for the module cache hash.
- if (LangOpts.Modules &&
+ if (LangOpts.hasModules() &&
PPOpts.DetailedRecord != ExistingPPOpts.DetailedRecord && Validate) {
if (Diags) {
Diags->Report(diag::err_pch_pp_detailed_record) << PPOpts.DetailedRecord;
@@ -784,7 +784,7 @@
DiagnosticsEngine *Diags,
const LangOptions &LangOpts,
const PreprocessorOptions &PPOpts) {
- if (LangOpts.Modules) {
+ if (LangOpts.hasModules()) {
if (SpecificModuleCachePath != ExistingModuleCachePath &&
!PPOpts.AllowPCHWithDifferentModulesCachePath) {
if (Diags)
@@ -1246,7 +1246,7 @@
void ASTReader::Error(StringRef Msg) const {
Error(diag::err_fe_pch_malformed, Msg);
- if (PP.getLangOpts().Modules && !Diags.isDiagnosticInFlight() &&
+ if (PP.getLangOpts().hasModules() && !Diags.isDiagnosticInFlight() &&
!PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
Diag(diag::note_module_cache_path)
<< PP.getHeaderSearchInfo().getModuleCachePath();
@@ -2062,7 +2062,7 @@
Deserializing AnIdentifier(this);
unsigned PriorGeneration = 0;
- if (getContext().getLangOpts().Modules)
+ if (getContext().getLangOpts().hasModules())
PriorGeneration = IdentifierGeneration[&II];
// If there is a global index, look there first to determine which modules
@@ -2089,7 +2089,7 @@
II->setOutOfDate(false);
// Update the generation for this identifier.
- if (getContext().getLangOpts().Modules)
+ if (getContext().getLangOpts().hasModules())
IdentifierGeneration[II] = getGeneration();
}
@@ -4108,7 +4108,7 @@
return false;
if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
- !PP.getLangOpts().Modules)
+ !PP.getLangOpts().hasModules())
return true;
// Try to load the global index.
@@ -4129,8 +4129,8 @@
}
bool ASTReader::isGlobalIndexUnavailable() const {
- return PP.getLangOpts().Modules && UseGlobalIndex &&
- !hasGlobalIndex() && TriedLoadingGlobalIndex;
+ return PP.getLangOpts().hasModules() && UseGlobalIndex && !hasGlobalIndex() &&
+ TriedLoadingGlobalIndex;
}
static void updateModuleTimestamp(ModuleFile &MF) {
@@ -4219,7 +4219,7 @@
/*ImportedBy=*/nullptr, Loaded, 0, 0, ASTFileSignature(),
ClientLoadCapabilities)) {
ModuleMgr.removeModules(ModuleMgr.begin() + NumModules,
- PP.getLangOpts().Modules
+ PP.getLangOpts().hasModules()
? &PP.getHeaderSearchInfo().getModuleMap()
: nullptr);
@@ -9325,7 +9325,7 @@
// FIXME: Check for =delete/=default?
// FIXME: Complain about ODR violations here?
const FunctionDecl *Defn = nullptr;
- if (!getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
+ if (!getContext().getLangOpts().hasModules() || !FD->hasBody(Defn)) {
FD->setLazyBody(PB->second);
} else {
auto *NonConstDefn = const_cast<FunctionDecl*>(Defn);
@@ -9349,7 +9349,7 @@
}
ObjCMethodDecl *MD = cast<ObjCMethodDecl>(PB->first);
- if (!getContext().getLangOpts().Modules || !MD->hasBody())
+ if (!getContext().getLangOpts().hasModules() || !MD->hasBody())
MD->setLazyBody(PB->second);
}
PendingBodies.clear();
Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -8492,7 +8492,7 @@
bool Sema::hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
bool OnlyNeedComplete) {
// Easy case: if we don't have modules, all declarations are visible.
- if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility)
+ if (!getLangOpts().hasModules() && !getLangOpts().ModulesLocalVisibility)
return true;
// If this definition was instantiated from a template, map back to the
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -11095,7 +11095,7 @@
} // end anonymous namespace
void Sema::checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec) {
- if (!getLangOpts().Modules)
+ if (!getLangOpts().hasModules())
return;
ExplicitSpecializationVisibilityChecker(*this, Loc).check(Spec);
Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -4892,7 +4892,7 @@
// If we're handling a missing symbol error, using modules, and the
// special search all modules option is used, look for a missing import.
- if (ErrorRecovery && getLangOpts().Modules &&
+ if (ErrorRecovery && getLangOpts().hasModules() &&
getLangOpts().ModulesSearchAll) {
// The following has the side effect of loading the missing module.
getModuleLoader().lookupMissingImports(Typo->getName(),
@@ -5463,7 +5463,6 @@
if (Correction.requiresImport()) {
NamedDecl *Decl = Correction.getFoundDecl();
assert(Decl && "import required but no declaration to import");
-
diagnoseMissingImport(Correction.getCorrectionRange().getBegin(), Decl,
MissingImportKind::Declaration, ErrorRecovery);
return;
Index: clang/lib/Sema/SemaDeclObjC.cpp
===================================================================
--- clang/lib/Sema/SemaDeclObjC.cpp
+++ clang/lib/Sema/SemaDeclObjC.cpp
@@ -1234,7 +1234,7 @@
// If we are using modules, add the decl to the context in order to
// serialize something meaningful.
- if (getLangOpts().Modules)
+ if (getLangOpts().ClangModules)
PushOnScopeChains(PDecl, TUScope);
PDecl->startDefinition();
} else {
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -2218,7 +2218,7 @@
TypedefNameDecl *Decl,
LookupResult &Previous) {
// This is only interesting when modules are enabled.
- if (!S.getLangOpts().Modules && !S.getLangOpts().ModulesLocalVisibility)
+ if (!S.getLangOpts().hasModules() && !S.getLangOpts().ModulesLocalVisibility)
return;
// Empty sets are uninteresting.
@@ -2444,7 +2444,7 @@
}
// Modules always permit redefinition of typedefs, as does C11.
- if (getLangOpts().Modules || getLangOpts().C11)
+ if (getLangOpts().hasModules() || getLangOpts().C11)
return;
// If we have a redefinition of a typedef in C, emit a warning. This warning
@@ -17986,7 +17986,7 @@
Sema::SkipBodyInfo Sema::shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II,
SourceLocation IILoc) {
- if (!(getLangOpts().Modules || getLangOpts().ModulesLocalVisibility) ||
+ if (!(getLangOpts().hasModules() || getLangOpts().ModulesLocalVisibility) ||
!getLangOpts().CPlusPlus)
return SkipBodyInfo();
Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -4148,7 +4148,7 @@
Modules[I]->isAvailable() ? CXAvailability_Available
: CXAvailability_NotAvailable));
}
- } else if (getLangOpts().Modules) {
+ } else if (getLangOpts().hasModules()) {
// Load the named module.
Module *Mod =
PP.getModuleLoader().loadModule(ImportLoc, Path, Module::AllVisible,
@@ -6741,7 +6741,7 @@
Builder.AddPlaceholderChunk("class");
Results.AddResult(Result(Builder.TakeString()));
- if (Results.getSema().getLangOpts().Modules) {
+ if (Results.getSema().getLangOpts().hasModules()) {
// @import name
Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt, "import"));
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
Index: clang/lib/Parse/ParseObjc.cpp
===================================================================
--- clang/lib/Parse/ParseObjc.cpp
+++ clang/lib/Parse/ParseObjc.cpp
@@ -78,7 +78,7 @@
SingleDecl = ParseObjCPropertyDynamic(AtLoc);
break;
case tok::objc_import:
- if (getLangOpts().Modules || getLangOpts().DebuggerSupport) {
+ if (getLangOpts().hasModules() || getLangOpts().DebuggerSupport) {
SingleDecl = ParseModuleImport(AtLoc);
break;
}
Index: clang/lib/Lex/Preprocessor.cpp
===================================================================
--- clang/lib/Lex/Preprocessor.cpp
+++ clang/lib/Lex/Preprocessor.cpp
@@ -875,7 +875,7 @@
if (((LastTokenWasAt && II.isModulesImport()) ||
Identifier.is(tok::kw_import)) &&
!InMacroArgs && !DisableMacroExpansion &&
- (getLangOpts().Modules || getLangOpts().DebuggerSupport) &&
+ (getLangOpts().hasModules() || getLangOpts().DebuggerSupport) &&
CurLexerKind != CLK_CachingLexer) {
ModuleImportLoc = Identifier.getLocation();
ModuleImportPath.clear();
@@ -1285,7 +1285,7 @@
}
Module *Imported = nullptr;
- if (getLangOpts().Modules) {
+ if (getLangOpts().hasModules()) {
Imported = TheModuleLoader.loadModule(ModuleImportLoc,
ModuleImportPath,
Module::Hidden,
Index: clang/lib/Lex/PPDirectives.cpp
===================================================================
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1144,12 +1144,12 @@
break;
case tok::pp___public_macro:
- if (getLangOpts().Modules || getLangOpts().ModulesLocalVisibility)
+ if (getLangOpts().hasModules() || getLangOpts().ModulesLocalVisibility)
return HandleMacroPublicDirective(Result);
break;
case tok::pp___private_macro:
- if (getLangOpts().Modules || getLangOpts().ModulesLocalVisibility)
+ if (getLangOpts().hasModules() || getLangOpts().ModulesLocalVisibility)
return HandleMacroPrivateDirective();
break;
}
@@ -2057,7 +2057,8 @@
// Determine whether we should try to import the module for this #include, if
// there is one. Don't do so if precompiled module support is disabled or we
// are processing this module textually (because we're building the module).
- if (Action == Enter && File && SuggestedModule && getLangOpts().Modules &&
+ if (Action == Enter && File && SuggestedModule &&
+ getLangOpts().hasModules() &&
!isForModuleBuilding(SuggestedModule.getModule(),
getLangOpts().CurrentModule,
getLangOpts().ModuleName)) {
@@ -2143,7 +2144,7 @@
// this file will have no effect.
if (Action == Enter && File &&
!HeaderInfo.ShouldEnterIncludeFile(*this, &File->getFileEntry(),
- EnterOnce, getLangOpts().Modules,
+ EnterOnce, getLangOpts().hasModules(),
SuggestedModule.getModule())) {
// Even if we've already preprocessed this header once and know that we
// don't need to see its contents again, we still need to import it if it's
Index: clang/lib/Frontend/FrontendActions.cpp
===================================================================
--- clang/lib/Frontend/FrontendActions.cpp
+++ clang/lib/Frontend/FrontendActions.cpp
@@ -212,7 +212,7 @@
bool GenerateModuleFromModuleMapAction::BeginSourceFileAction(
CompilerInstance &CI) {
- if (!CI.getLangOpts().Modules) {
+ if (!CI.getLangOpts().ClangModules) {
CI.getDiagnostics().Report(diag::err_module_build_requires_fmodules);
return false;
}
@@ -263,7 +263,7 @@
bool GenerateHeaderModuleAction::PrepareToExecuteAction(
CompilerInstance &CI) {
- if (!CI.getLangOpts().Modules) {
+ if (!CI.getLangOpts().hasModules()) {
CI.getDiagnostics().Report(diag::err_header_module_requires_modules);
return false;
}
Index: clang/lib/Frontend/FrontendAction.cpp
===================================================================
--- clang/lib/Frontend/FrontendAction.cpp
+++ clang/lib/Frontend/FrontendAction.cpp
@@ -584,6 +584,10 @@
if (!BeginInvocation(CI))
return false;
+ if (CI.getLangOpts().ClangModules && CI.getLangOpts().CPlusPlusModules)
+ CI.getDiagnostics().Report(
+ diag::err_conflicts_clang_module_and_cxx20_module);
+
// If we're replaying the build of an AST file, import it and set up
// the initial state from its build.
if (ReplayASTFile) {
@@ -879,7 +883,7 @@
return false;
CI.setASTReader(static_cast<ASTReader *>(FinalReader.get()));
CI.getASTContext().setExternalSource(source);
- } else if (CI.getLangOpts().Modules ||
+ } else if (CI.getLangOpts().hasModules() ||
!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {
// Use PCM or PCH.
assert(hasPCHSupport() && "This action does not have PCH support!");
@@ -910,7 +914,7 @@
// If modules are enabled, create the AST reader before creating
// any builtins, so that all declarations know that they might be
// extended by an external source.
- if (CI.getLangOpts().Modules || !CI.hasASTContext() ||
+ if (CI.getLangOpts().hasModules() || !CI.hasASTContext() ||
!CI.getASTContext().getExternalSource()) {
CI.createASTReader();
CI.getASTReader()->setDeserializationListener(DeserialListener,
@@ -925,7 +929,7 @@
// Initialize built-in info as long as we aren't using an external AST
// source.
- if (CI.getLangOpts().Modules || !CI.hasASTContext() ||
+ if (CI.getLangOpts().hasModules() || !CI.hasASTContext() ||
!CI.getASTContext().getExternalSource()) {
Preprocessor &PP = CI.getPreprocessor();
PP.getBuiltinInfo().initializeBuiltins(PP.getIdentifierTable(),
@@ -933,7 +937,7 @@
} else {
// FIXME: If this is a problem, recover from it by creating a multiplex
// source.
- assert((!CI.getLangOpts().Modules || CI.getASTReader()) &&
+ assert((!CI.getLangOpts().hasModules() || CI.getASTReader()) &&
"modules enabled but created an external source that "
"doesn't support modules");
}
Index: clang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -485,7 +485,7 @@
PP->setPreprocessedOutput(getPreprocessorOutputOpts().ShowCPP);
- if (PP->getLangOpts().Modules && PP->getLangOpts().ImplicitModules) {
+ if (PP->getLangOpts().hasModules() && PP->getLangOpts().ImplicitModules) {
std::string ModuleHash = getInvocation().getModuleHash();
PP->getHeaderSearchInfo().setModuleHash(ModuleHash);
PP->getHeaderSearchInfo().setModuleCachePath(
Index: clang/lib/Frontend/ASTUnit.cpp
===================================================================
--- clang/lib/Frontend/ASTUnit.cpp
+++ clang/lib/Frontend/ASTUnit.cpp
@@ -2257,7 +2257,7 @@
}
// Disable the preprocessing record if modules are not enabled.
- if (!Clang->getLangOpts().Modules)
+ if (!Clang->getLangOpts().hasModules())
PreprocessorOpts.DetailedRecord = false;
std::unique_ptr<SyntaxOnlyAction> Act;
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3438,10 +3438,14 @@
return false;
}
-static void RenderModulesOptions(Compilation &C, const Driver &D,
+static bool RenderModulesOptions(Compilation &C, const Driver &D,
const ArgList &Args, const InputInfo &Input,
const InputInfo &Output,
- ArgStringList &CmdArgs, bool &HaveModules) {
+ ArgStringList &CmdArgs, bool HaveCXXModules) {
+ if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules, false) &&
+ HaveCXXModules)
+ D.Diag(clang::diag::err_drv_clang_module_cxx_module_conflicts);
+
// -fmodules enables the use of precompiled modules (off by default).
// Users can pass -fno-cxx-modules to turn off modules support for
// C++/Objective-C++ programs.
@@ -3455,7 +3459,7 @@
}
}
- HaveModules |= HaveClangModules;
+ bool HaveModules = HaveCXXModules || HaveClangModules;
if (Args.hasArg(options::OPT_fmodules_ts)) {
CmdArgs.push_back("-fmodules-ts");
HaveModules = true;
@@ -3610,6 +3614,8 @@
CmdArgs.push_back("-fmodules-validate-system-headers");
Args.AddLastArg(CmdArgs, options::OPT_fmodules_disable_diagnostic_validation);
+
+ return HaveModules;
}
static void RenderCharacterOptions(const ArgList &Args, const llvm::Triple &T,
@@ -6315,12 +6321,15 @@
options::OPT_finline_hint_functions,
options::OPT_fno_inline_functions);
+ bool HaveCXXModules = Args.hasFlag(
+ options::OPT_fcxx_modules, options::OPT_fno_cxx_modules,
+ Std && (Std->containsValue("c++2a") || Std->containsValue("c++20") ||
+ Std->containsValue("c++latest")));
+
// FIXME: Find a better way to determine whether the language has modules
// support by default, or just assume that all languages do.
bool HaveModules =
- Std && (Std->containsValue("c++2a") || Std->containsValue("c++20") ||
- Std->containsValue("c++latest"));
- RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveModules);
+ RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveCXXModules);
if (Args.hasFlag(options::OPT_fpch_validate_input_files_content,
options::OPT_fno_pch_validate_input_files_content, false))
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -551,7 +551,7 @@
SanStats->finish();
if (CodeGenOpts.Autolink &&
- (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) {
+ (Context.getLangOpts().hasModules() || !LinkerOptionsMetadata.empty())) {
EmitModuleLinkOptions();
}
Index: clang/lib/AST/DeclObjC.cpp
===================================================================
--- clang/lib/AST/DeclObjC.cpp
+++ clang/lib/AST/DeclObjC.cpp
@@ -1503,7 +1503,7 @@
auto *Result = new (C, DC)
ObjCInterfaceDecl(C, DC, atLoc, Id, typeParamList, ClassLoc, PrevDecl,
isInternal);
- Result->Data.setInt(!C.getLangOpts().Modules);
+ Result->Data.setInt(!C.getLangOpts().ClangModules);
C.getObjCInterfaceType(Result, PrevDecl);
return Result;
}
@@ -1513,7 +1513,7 @@
auto *Result = new (C, ID)
ObjCInterfaceDecl(C, nullptr, SourceLocation(), nullptr, nullptr,
SourceLocation(), nullptr, false);
- Result->Data.setInt(!C.getLangOpts().Modules);
+ Result->Data.setInt(!C.getLangOpts().ClangModules);
return Result;
}
@@ -1899,7 +1899,7 @@
ObjCProtocolDecl *PrevDecl) {
auto *Result =
new (C, DC) ObjCProtocolDecl(C, DC, Id, nameLoc, atStartLoc, PrevDecl);
- Result->Data.setInt(!C.getLangOpts().Modules);
+ Result->Data.setInt(!C.getLangOpts().ClangModules);
return Result;
}
@@ -1908,7 +1908,7 @@
ObjCProtocolDecl *Result =
new (C, ID) ObjCProtocolDecl(C, nullptr, nullptr, SourceLocation(),
SourceLocation(), nullptr);
- Result->Data.setInt(!C.getLangOpts().Modules);
+ Result->Data.setInt(!C.getLangOpts().ClangModules);
return Result;
}
Index: clang/lib/AST/DeclCXX.cpp
===================================================================
--- clang/lib/AST/DeclCXX.cpp
+++ clang/lib/AST/DeclCXX.cpp
@@ -136,7 +136,7 @@
bool DelayTypeCreation) {
auto *R = new (C, DC) CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
PrevDecl);
- R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
+ R->setMayHaveOutOfDateDef(C.getLangOpts().hasModules());
// FIXME: DelayTypeCreation seems like such a hack
if (!DelayTypeCreation)
Index: clang/lib/AST/Decl.cpp
===================================================================
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4420,7 +4420,7 @@
bool IsScopedUsingClassTag, bool IsFixed) {
auto *Enum = new (C, DC) EnumDecl(C, DC, StartLoc, IdLoc, Id, PrevDecl,
IsScoped, IsScopedUsingClassTag, IsFixed);
- Enum->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
+ Enum->setMayHaveOutOfDateDef(C.getLangOpts().hasModules());
C.getTypeDeclType(Enum, PrevDecl);
return Enum;
}
@@ -4429,7 +4429,7 @@
EnumDecl *Enum =
new (C, ID) EnumDecl(C, nullptr, SourceLocation(), SourceLocation(),
nullptr, nullptr, false, false, false);
- Enum->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
+ Enum->setMayHaveOutOfDateDef(C.getLangOpts().hasModules());
return Enum;
}
@@ -4564,7 +4564,7 @@
IdentifierInfo *Id, RecordDecl* PrevDecl) {
RecordDecl *R = new (C, DC) RecordDecl(Record, TK, C, DC,
StartLoc, IdLoc, Id, PrevDecl);
- R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
+ R->setMayHaveOutOfDateDef(C.getLangOpts().hasModules());
C.getTypeDeclType(R, PrevDecl);
return R;
@@ -4574,7 +4574,7 @@
RecordDecl *R =
new (C, ID) RecordDecl(Record, TTK_Struct, C, nullptr, SourceLocation(),
SourceLocation(), nullptr, nullptr);
- R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
+ R->setMayHaveOutOfDateDef(C.getLangOpts().hasModules());
return R;
}
Index: clang/lib/ARCMigrate/ObjCMT.cpp
===================================================================
--- clang/lib/ARCMigrate/ObjCMT.cpp
+++ clang/lib/ARCMigrate/ObjCMT.cpp
@@ -1734,7 +1734,7 @@
return true;
}
edit::Commit commit(*Editor);
- if (Ctx.getLangOpts().Modules)
+ if (Ctx.getLangOpts().ClangModules)
commit.insert(Loc, "#ifndef NS_ENUM\n@import Foundation;\n#endif\n");
else
commit.insert(Loc, "#ifndef NS_ENUM\n#import <Foundation/Foundation.h>\n#endif\n");
Index: clang/include/clang/Lex/Preprocessor.h
===================================================================
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -606,7 +606,7 @@
// FIXME: Find a spare bit on IdentifierInfo and store a
// HasModuleMacros flag.
if (!II->hasMacroDefinition() ||
- (!PP.getLangOpts().Modules &&
+ (!PP.getLangOpts().hasModules() &&
!PP.getLangOpts().ModulesLocalVisibility) ||
!PP.CurSubmoduleState->VisibleModules.getGeneration())
return nullptr;
@@ -1090,7 +1090,7 @@
}
bool isMacroDefined(const IdentifierInfo *II) {
return II->hasMacroDefinition() &&
- (!getLangOpts().Modules || (bool)getMacroDefinition(II));
+ (!getLangOpts().hasModules() || (bool)getMacroDefinition(II));
}
/// Determine whether II is defined as a macro within the module M,
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2189,7 +2189,7 @@
Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">,
MarshallingInfoFlag<LangOpts<"ModulesTS">>;
defm modules : BoolFOption<"modules",
- LangOpts<"Modules">, Default<!strconcat(fmodules_ts.KeyPath, "||", fcxx_modules.KeyPath)>,
+ LangOpts<"ClangModules">, DefaultFalse,
PosFlag<SetTrue, [CC1Option], "Enable the 'modules' language feature">,
NegFlag<SetFalse>, BothFlags<[NoXarchOption, CoreOption]>>;
def fmodule_maps : Flag <["-"], "fmodule-maps">, Flags<[CoreOption]>, Alias<fimplicit_module_maps>;
Index: clang/include/clang/Basic/LangOptions.h
===================================================================
--- clang/include/clang/Basic/LangOptions.h
+++ clang/include/clang/Basic/LangOptions.h
@@ -398,6 +398,11 @@
return isCompilingModule() || ModulesLocalVisibility;
}
+ /// are clang module or c++20 module (or c++ module ts) enabled?
+ bool hasModules() const {
+ return ClangModules || CPlusPlusModules || ModulesTS;
+ }
+
bool isSignedOverflowDefined() const {
return getSignedOverflowBehavior() == SOB_Defined;
}
Index: clang/include/clang/Basic/LangOptions.def
===================================================================
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -162,7 +162,7 @@
BENIGN_LANGOPT(EmitAllDecls , 1, 0, "emitting all declarations")
LANGOPT(MathErrno , 1, 1, "errno in math functions")
BENIGN_LANGOPT(HeinousExtensions , 1, 0, "extensions that we really don't like and may be ripped out at any time")
-LANGOPT(Modules , 1, 0, "modules semantics")
+LANGOPT(ClangModules , 1, 0, "clang modules semantics")
COMPATIBLE_LANGOPT(ModulesTS , 1, 0, "C++ Modules TS syntax")
COMPATIBLE_LANGOPT(CPlusPlusModules, 1, 0, "C++ modules syntax")
BENIGN_ENUM_LANGOPT(CompilingModule, CompilingModuleKind, 2, CMK_None,
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -105,7 +105,7 @@
FEATURE(objc_fixed_enum, LangOpts.ObjC)
FEATURE(objc_instancetype, LangOpts.ObjC)
FEATURE(objc_kindof, LangOpts.ObjC)
-FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)
+FEATURE(objc_modules, LangOpts.ObjC && LangOpts.ClangModules)
FEATURE(objc_nonfragile_abi, LangOpts.ObjCRuntime.isNonFragile())
FEATURE(objc_property_explicit_atomic, true)
FEATURE(objc_protocol_qualifier_mangling, true)
@@ -222,7 +222,7 @@
FEATURE(is_trivially_constructible, LangOpts.CPlusPlus)
FEATURE(is_trivially_copyable, LangOpts.CPlusPlus)
FEATURE(is_union, LangOpts.CPlusPlus)
-FEATURE(modules, LangOpts.Modules)
+FEATURE(modules, LangOpts.hasModules())
FEATURE(safe_stack, LangOpts.Sanitize.has(SanitizerKind::SafeStack))
FEATURE(shadow_call_stack,
LangOpts.Sanitize.has(SanitizerKind::ShadowCallStack))
Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -241,6 +241,8 @@
def err_modules_embed_file_not_found :
Error<"file '%0' specified by '-fmodules-embed-file=' not found">,
DefaultFatal;
+def err_conflicts_clang_module_and_cxx20_module :
+ Error<"Unable to use clang module and c++20 module at the same time.">;
def err_module_header_file_not_found :
Error<"module header file '%0' not found">, DefaultFatal;
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -159,6 +159,8 @@
"'%0': unable to use AST files with this tool">;
def err_drv_no_module_support : Error<
"'%0': unable to use module files with this tool">;
+def err_drv_clang_module_cxx_module_conflicts : Error <
+ "Unable to use clang module and c++20 module at the same time.">;
def err_drv_clang_unsupported : Error<
"the clang compiler does not support '%0'">;
def err_drv_clang_unsupported_opt_cxx_darwin_i386 : Error<
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits