jansvoboda11 updated this revision to Diff 388410.
jansvoboda11 added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114173/new/

https://reviews.llvm.org/D114173

Files:
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Lex/Preprocessor.cpp
  clang/test/Modules/import-textual-noguard.mm


Index: clang/test/Modules/import-textual-noguard.mm
===================================================================
--- clang/test/Modules/import-textual-noguard.mm
+++ 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;
Index: clang/lib/Lex/Preprocessor.cpp
===================================================================
--- clang/lib/Lex/Preprocessor.cpp
+++ clang/lib/Lex/Preprocessor.cpp
@@ -1482,16 +1482,16 @@
     CurrentSubmodule = BuildingSubmoduleStack.back().M;
   IncludedFilesPerSubmodule[CurrentSubmodule].insert(File);
 
-  return IncludedFiles.insert(File).second;
+  return CurSubmoduleState->IncludedFiles.insert(File).second;
 }
 
 void Preprocessor::markTransitivelyIncluded(const FileEntry *File) {
-  IncludedFiles.insert(File);
+  CurSubmoduleState->IncludedFiles.insert(File);
 }
 
 /// Return true if this header has already been included.
 bool Preprocessor::alreadyIncluded(const FileEntry *File) const {
-  return IncludedFiles.count(File);
+  return CurSubmoduleState->IncludedFiles.count(File);
 }
 
 const Preprocessor::IncludedFilesSet *
Index: clang/include/clang/Lex/Preprocessor.h
===================================================================
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -752,6 +752,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;
 
@@ -771,10 +774,6 @@
   /// Files included outside of any module (e.g. in PCH) have nullptr key.
   llvm::DenseMap<Module *, IncludedFilesSet> IncludedFilesPerSubmodule;
 
-  /// The global set of files that have been included.
-  // TODO: Move this into SubmoduleState.
-  IncludedFilesSet IncludedFiles;
-
   /// The set of known macros exported from modules.
   llvm::FoldingSet<ModuleMacro> ModuleMacros;
 


Index: clang/test/Modules/import-textual-noguard.mm
===================================================================
--- clang/test/Modules/import-textual-noguard.mm
+++ 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;
Index: clang/lib/Lex/Preprocessor.cpp
===================================================================
--- clang/lib/Lex/Preprocessor.cpp
+++ clang/lib/Lex/Preprocessor.cpp
@@ -1482,16 +1482,16 @@
     CurrentSubmodule = BuildingSubmoduleStack.back().M;
   IncludedFilesPerSubmodule[CurrentSubmodule].insert(File);
 
-  return IncludedFiles.insert(File).second;
+  return CurSubmoduleState->IncludedFiles.insert(File).second;
 }
 
 void Preprocessor::markTransitivelyIncluded(const FileEntry *File) {
-  IncludedFiles.insert(File);
+  CurSubmoduleState->IncludedFiles.insert(File);
 }
 
 /// Return true if this header has already been included.
 bool Preprocessor::alreadyIncluded(const FileEntry *File) const {
-  return IncludedFiles.count(File);
+  return CurSubmoduleState->IncludedFiles.count(File);
 }
 
 const Preprocessor::IncludedFilesSet *
Index: clang/include/clang/Lex/Preprocessor.h
===================================================================
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -752,6 +752,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;
 
@@ -771,10 +774,6 @@
   /// Files included outside of any module (e.g. in PCH) have nullptr key.
   llvm::DenseMap<Module *, IncludedFilesSet> IncludedFilesPerSubmodule;
 
-  /// The global set of files that have been included.
-  // TODO: Move this into SubmoduleState.
-  IncludedFilesSet IncludedFiles;
-
   /// The set of known macros exported from modules.
   llvm::FoldingSet<ModuleMacro> ModuleMacros;
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to