[PATCH] D112915: WIP: [clang][modules] Granular tracking of includes

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 3 19:26:43 PDT 2021


vsapsai added a comment.

In D112915#3106472 <https://reviews.llvm.org/D112915#3106472>, @jansvoboda11 wrote:

> That's interesting. I think `HeaderFileInfo::isImport` should definitely be tracked in the preprocessor, not in `HeaderFileInfo`. The fact that the header was `#import`ed is not an intrinsic property of the file itself, but rather a preprocessor state. Can you think of other fields that don't really belong to `HeaderFileInfo`?

After checking `HeaderFileInfo`, looks like `isImport` is the only other field that should be tracked in the preprocessor. I had in mind a case where a hidden submodule imports a file with x-macros and then a visible submodule includes this header twice with different macros. First include would go through because NumIncludes == 0, and the second one shouldn't because NumIncludes == 1 && isImport == true. The import in the hidden submodule is incorrect but errors in unused headers shouldn't break actually used headers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112915



More information about the cfe-commits mailing list