[PATCH] D80263: [HeaderSearch] Fix processing #import-ed headers multiple times with modules enabled.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 18:11:12 PDT 2020


vsapsai created this revision.
vsapsai added reviewers: rsmith, bruno, Bigcheese.
Herald added subscribers: ributzka, dexonsmith, jkorous.
Herald added a project: clang.

HeaderSearch was marking requested HeaderFileInfo as Resolved only based on
the presence of ExternalSource. As the result, using any module was enough
to set ExternalSource and headers unknown to this module would have
HeaderFileInfo with empty fields, including `isImport = 0`, `NumIncludes = 0`.
Such HeaderFileInfo was preserved without changes regardless of how the
header was used in other modules and caused incorrect result in
`HeaderSearch::ShouldEnterIncludeFile`.

Fix by marking HeaderFileInfo as Resolved only if ExternalSource knows
about this header.

rdar://problem/62126911


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80263

Files:
  clang/lib/Lex/HeaderSearch.cpp
  clang/test/Modules/Inputs/import-once/ImportOnce.framework/Headers/ImportOnce.h
  clang/test/Modules/Inputs/import-once/ImportOnce.framework/Modules/module.modulemap
  clang/test/Modules/Inputs/import-once/IndirectImporter.framework/Headers/IndirectImporter.h
  clang/test/Modules/Inputs/import-once/IndirectImporter.framework/Modules/module.modulemap
  clang/test/Modules/Inputs/import-once/Unrelated.framework/Headers/Unrelated.h
  clang/test/Modules/Inputs/import-once/Unrelated.framework/Modules/module.modulemap
  clang/test/Modules/import-once.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80263.265105.patch
Type: text/x-patch
Size: 4192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200520/0da93f4c/attachment-0001.bin>


More information about the cfe-commits mailing list