rsmith added inline comments.

================
Comment at: clang/include/clang/Lex/Preprocessor.h:749-750
 
+    /// The set of the included headers' UID for the submodule.
+    std::set<unsigned> IncludedFiles;
+
----------------
A `std::set` is a very heavy object to be copying each time a module is entered 
/ left. I think this is also putting the cost in the wrong place: ideally we 
want an approach whose cost scales only with the number of `#include` / 
`#import` directives that name a header that should only be included once, not 
the number of modules entered / left after such a directive is seen, so we 
should be tracking the state on the `HeaderFileInfo` instead of here.

So, how about this: on each `HeaderFileInfo`, track the set of module IDs in 
which the header file has been included in a way that suppresses further 
inclusion. Then when we come to consider a `#include`, check to see if any of 
those module IDs is visible in the includer and suppress the inclusion if so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75951



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to