[PATCH] D135381: [clang][modules] Fix handling of `ModuleHeaderRole::ExcludedHeader`

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 11:26:40 PDT 2022


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Lex/ModuleMap.cpp:598
+      // Cannot use a module if the header is excluded in it.
+      if (!AllowExcluded && H.getRole() == ModuleMap::ExcludedHeader)
+        continue;
----------------
This is what actually fixes the attached test case. `MakeResult` was too late to check for excluded headers (in the `if (H.getModule()->getTopLevelModule() == SourceModule)` condition) - we'd end up returning `{}` and skipping remaining module associations of the header file. This caused the ObjC interface to be associated with the wrong module in the PCM, causing "interface redefinition" errors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135381



More information about the cfe-commits mailing list