mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 07:46:06 +00:00

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
16 lines
538 B
C++
16 lines
538 B
C++
// RUN: rm -rf %t
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-lifetime-extended-temporary -verify -std=c++11 %s -DORDER=1
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-lifetime-extended-temporary -verify -std=c++11 %s -DORDER=2
|
|
|
|
// expected-no-diagnostics
|
|
#if ORDER == 1
|
|
#include "c.h"
|
|
#include "b.h"
|
|
#else
|
|
#include "b.h"
|
|
#include "c.h"
|
|
#endif
|
|
|
|
static_assert(PtrTemp1 == &LETemp, "");
|
|
static_assert(PtrTemp1 == PtrTemp2, "");
|