[PATCH] D126676: [clang] Disallow differences in defines used for creating and using PCH

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 9 14:58:16 PDT 2022


mstorsjo updated this revision to Diff 443461.
mstorsjo added a comment.

Reduce the scope and impact of the change: When telling Clang to include a specifically named PCH file, keep tolerating the same set of mismatches as before. (Clang has been tolerating such differences for over 10 years, and there are a number of tests specifically for such fuzzy matches.) When using a GCC style directory with multiple alternative PCH files, require an exact match, to avoid the case where multiple ones are acceptable and Clang erroneously picks the first seemingly acceptable one.

In this form, the patch no longer breaks other testcases than the one that is meant to be fixed/changed.

This still has a small risk of breaking someone's setup, but as this makes Clang match GCC's behaviour for the compatible option, the risk is probably quite small.

(A more comprehensive solution to avoid breaking that case, would be to iterate over the PCH directory, first requiring a strict match, and if none is found, iterate over the directory again, tolerating inexact matches like before. But I don't think that's necessary.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126676

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Serialization/ASTReader.h
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/PCH/pch-dir.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126676.443461.patch
Type: text/x-patch
Size: 8804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220709/e69b36ac/attachment-0001.bin>


More information about the cfe-commits mailing list