[PATCH] D28415: PCH: fix a regression that reports a module is defined in both pch and pcm

Manman Ren via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 6 14:40:27 PST 2017


manmanren created this revision.
manmanren added reviewers: rsmith, benlangmuir, doug.gregor.
manmanren added a subscriber: cfe-commits.

In r276159, we started to say that a module X is defined in a pch if we specify -fmodule-name when building the pch.
This caused a regression that reports module X is defined in both pch and pcm if we generate the pch with -fmodule-name=X and then in a separate clang invocation, we include the pch and also import X.pcm.

This patch adds an option CompilingPCH similar to CompilingModule. When we use -fmodule-name=X while building a pch, modular headers in X will be textually included and the compiler knows that we are not building module X, so we don't put module X in SUBMODULE_DEFINITION of the pch.


https://reviews.llvm.org/D28415

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Frontend/FrontendActions.h
  lib/Frontend/FrontendActions.cpp
  lib/Lex/PPDirectives.cpp
  lib/Serialization/ASTWriter.cpp
  test/Modules/Inputs/pch-with-module-name/A.h
  test/Modules/Inputs/pch-with-module-name/C.h
  test/Modules/Inputs/pch-with-module-name/C.m
  test/Modules/Inputs/pch-with-module-name/D.h
  test/Modules/Inputs/pch-with-module-name/module.modulemap
  test/Modules/Inputs/pch-with-module-name/test.h
  test/Modules/pch-with-module-name.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28415.83431.patch
Type: text/x-patch
Size: 6989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170106/8846702f/attachment-0001.bin>


More information about the cfe-commits mailing list