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
2020-01-22 23:34:34 +08:00
|
|
|
// RUN: rm -rf %t
|
2018-09-06 06:30:37 +08:00
|
|
|
// RUN: %clang_cc1 -x c++ -std=c++17 -fmodules -fmodules-local-submodule-visibility -fmodules-cache-path=%t %s -verify
|
|
|
|
|
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#pragma clang module build PR38627
|
|
|
|
module PR38627 {}
|
|
|
|
#pragma clang module contents
|
|
|
|
#pragma clang module begin PR38627
|
|
|
|
namespace PR38627 {
|
|
|
|
struct X {
|
|
|
|
virtual ~X() {}
|
|
|
|
struct C {
|
|
|
|
friend X::~X();
|
|
|
|
} c;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#pragma clang module end
|
|
|
|
#pragma clang module endbuild
|
|
|
|
|
|
|
|
#pragma clang module import PR38627
|
|
|
|
|
|
|
|
namespace PR38627 {
|
|
|
|
struct Y {
|
|
|
|
virtual ~Y() {}
|
|
|
|
struct C {
|
|
|
|
friend Y::~Y();
|
|
|
|
} c;
|
|
|
|
};
|
|
|
|
static_assert(noexcept(X().~X()));
|
|
|
|
static_assert(noexcept(Y().~Y()));
|
|
|
|
|
|
|
|
struct A { virtual ~A() = default; };
|
|
|
|
struct B : public A, public X {
|
|
|
|
virtual ~B() override = default;
|
|
|
|
};
|
|
|
|
} // PR38627
|