diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -976,6 +976,9 @@ /// The macros for the submodule. MacroMap Macros; + /// The set of files that have been included in the submodule. + IncludedFilesSet IncludedFiles; + /// The set of modules that are visible within the submodule. VisibleModuleSet VisibleModules; @@ -995,9 +998,6 @@ /// Files included outside of any module (e.g. in PCH) have nullptr key. llvm::DenseMap IncludedFilesPerSubmodule; - /// The files that have been included. - IncludedFilesSet IncludedFiles; - /// The set of top-level modules that affected preprocessing, but were not /// imported. llvm::SmallSetVector AffectingClangModules; @@ -1486,7 +1486,7 @@ /// of its dependencies (transitively). void markTransitivelyIncluded(const FileEntry *File) { HeaderInfo.getFileInfo(File); - IncludedFiles.insert(File); + CurSubmoduleState->IncludedFiles.insert(File); } /// Mark the file as included in the current state and attribute it to the @@ -1500,13 +1500,13 @@ : getCurrentModule(); IncludedFilesPerSubmodule[M].insert(File); - return IncludedFiles.insert(File).second; + return CurSubmoduleState->IncludedFiles.insert(File).second; } /// Return true if this header has already been included. bool alreadyIncluded(const FileEntry *File) const { HeaderInfo.getFileInfo(File); - return IncludedFiles.count(File); + return CurSubmoduleState->IncludedFiles.count(File); } /// Invoke the callback for every module known to include the given file. @@ -1523,9 +1523,10 @@ return IncludedFilesPerSubmodule[M]; } - /// Get the set of included files. - IncludedFilesSet &getIncludedFiles() { return IncludedFiles; } - const IncludedFilesSet &getIncludedFiles() const { return IncludedFiles; } + /// Get the set of files included in the current state. + IncludedFilesSet &getIncludedFiles() { + return CurSubmoduleState->IncludedFiles; + } /// Return the name of the macro defined before \p Loc that has /// spelling \p Tokens. If there are multiple macros with same spelling, diff --git a/clang/test/Modules/import-textual-noguard.mm b/clang/test/Modules/import-textual-noguard.mm --- a/clang/test/Modules/import-textual-noguard.mm +++ b/clang/test/Modules/import-textual-noguard.mm @@ -1,7 +1,9 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -std=c++11 -fmodules -fimplicit-module-maps -I%S/Inputs/import-textual/M2 -fmodules-cache-path=%t -x objective-c++ -fmodules-local-submodule-visibility %s -verify -#include "A/A.h" // expected-error {{could not build module 'M'}} +// expected-no-diagnostics + +#include "A/A.h" #include "B/B.h" typedef aint xxx;