[all-commits] [llvm/llvm-project] 495321: Make AST reading work better with LLVM_APPEND_VC_R...

Nico Weber via All-commits all-commits at lists.llvm.org
Mon Jan 27 19:08:58 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 49532137d087d8053789d18540c5e7916b91ef30
      https://github.com/llvm/llvm-project/commit/49532137d087d8053789d18540c5e7916b91ef30
  Author: Nico Weber <thakis at chromium.org>
  Date:   2020-01-27 (Mon, 27 Jan 2020)

  Changed paths:
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/Modules/diagnostics.modulemap
    M clang/test/Modules/exception-spec.cpp
    M clang/test/Modules/merge-lifetime-extended-temporary.cpp
    M clang/test/Modules/objc-method-redecl.m
    M clang/test/Modules/using-decl-inheritance.cpp

  Log Message:
  -----------
  Make AST reading work better with LLVM_APPEND_VC_REV=NO

With LLVM_APPEND_VC_REV=NO, Modules/merge-lifetime-extended-temporary.cpp
would fail if it ran before a0f50d731639350c7a7 (which changed
the serialization format) and then after, for these reasons:

1. With LLVM_APPEND_VC_REV=NO, the module hash before and after the
   change was the same.

2. Modules/merge-lifetime-extended-temporary.cpp is the only test
   we have that uses -fmodule-cache-path=%t that
   a) actually writes to the cache path
   b) doesn't do `rm -rf %t` at the top of the test

So the old run would write a module file, and then the new run would
try to load it, but the serialized format changed.

Do several things to fix this:

1. Include clang::serialization::VERSION_MAJOR/VERSION_MINOR in
   the module hash, so that when the AST format changes (...and
   we remember to bump these), we use a different module cache dir.
2. Bump VERSION_MAJOR, since a0f50d731639350c7a7 changed the
   on-disk format in a way that a gch file written before that change
   can't be read after that change.
3. Add `rm -rf %t` to all tests that pass -fmodule-cache-path=%t.
   This is unnecessary from a correctness PoV after 1 and 2,
   but makes it so that we don't amass many cache dirs over time.
   (Arguably, it also makes it so that the test suite doesn't catch
   when we change the serialization format but don't bump
   clang::serialization::VERSION_MAJOR/VERSION_MINOR; oh well.)

Differential Revision: https://reviews.llvm.org/D73202




More information about the All-commits mailing list