[PATCH] D75951: Keep a list of already-included pragma-once files for mods.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 10:51:20 PDT 2020


jyknight added a comment.

I suspect we also need to support saving/loading some of this information in the serialized AST, e.g. clang/lib/Serialization/ASTWriter.cpp has code to save the HeaderInfo data, around line 1650. And around line 2174, code to save the macros per submodule. We'll also need to save the pragma-once-header-state per-submodule too, I think.



================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1264
+  if (FileInfo.isPragmaOnce || FileInfo.isImport){
+    if (FileInfo.isModuleHeader && M != nullptr){
+      if (PP.isIncludeVisibleInLocalModule(File, M)) return false;
----------------
I don't think whether the header you're trying to include is modular or not (isModuleHeader) should matter here, just whether we have a current module M or not.



================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1266
+      if (PP.isIncludeVisibleInLocalModule(File, M)) return false;
+      else  PP.setIncludeVisibleForHeader(File, M);
+    } else {
----------------
I wonder if this should be just using the CurSubmoduleState. Actually, is "M" even needed in this function at all -- why isn't everything just using CurSubmoduleState? (It's very likely I'm just confused about what the semantics of this are...).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75951





More information about the cfe-commits mailing list