[PATCH] D88680: Add ability to turn off -fpch-instantiate-templates in clang-cl

Luboš Luňák via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 21:58:39 PDT 2020


llunak added a comment.

> I tried pretty hard to get a small repro for these failures, but couldn't.

Can you get at least some testcase, even if not small? You can use -E -frewrite-includes to create a single large file from all the input. Although the patch looks fine to me as such, I consider it a workaround. The reason for -fpch-instantiate-templates being the default for clang-cl is that MSVC does some kind of template instantiation for PCHs too (although seeing your email you probably know more than I do). So preferably the core problem should be fixed.

In D88680#2307564 <https://reviews.llvm.org/D88680#2307564>, @rnk wrote:

> I think the flag was originally intended to be an internal -cc1 flag not exposed to users.

No, it's intentionally exposed in the gcc-compatible driver, because there the option is not the default because of corner cases if the PCH is not self-contained. But since MSVC requires PCHs to be self-contained, it was deemed safe to always enable it in clang-cl. And, as said above, I still think it generally should.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88680



More information about the cfe-commits mailing list