[libcxx-commits] [PATCH] D92580: [libc++] Use -fmodules-validate-system-headers in the test suite

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 3 09:14:06 PST 2020

ldionne created this revision.
ldionne added a reviewer: rsmith.
Herald added subscribers: libcxx-commits, jkorous, arichardson.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne requested review of this revision.

As discussed in https://reviews.llvm.org/D91311#2431363, this is the
correct fix for making sure that Clang invalidates the cache when system
headers change.

  rG LLVM Github Monorepo



Index: libcxx/utils/libcxx/test/features.py
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -41,14 +41,11 @@
                                                                  sys.platform.lower().strip() == 'darwin'), # TODO: this doesn't handle cross-compiling to Apple platforms.
   Feature(name='objective-c++',                 when=lambda cfg: hasCompileFlag(cfg, '-xobjective-c++ -fobjc-arc')),
-  # Note: We use a custom modules cache path to make sure that we don't reuse
-  #       the default one, which can be shared across builds. This is important
-  #       because we define macros in headers files, and a change in these macros
-  #       doesn't seem to invalidate modules cache entries, which means we could
-  #       build against now-invalid cached headers from a previous build.
+  # NOTE: We make sure that Clang considers system headers for invalidating the
+  # modules cache, otherwise we could be using stale versions of the headers.
           when=lambda cfg: hasCompileFlag(cfg, '-fmodules'),
-          actions=lambda cfg: [AddCompileFlag('-fmodules-cache-path=%t/ModuleCache')]),
+          actions=lambda cfg: [AddCompileFlag('-fmodules-validate-system-headers')]),
           when=lambda cfg: sourceBuilds(cfg, """

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92580.309279.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201203/36e650ff/attachment-0001.bin>

More information about the libcxx-commits mailing list