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:
- With LLVM_APPEND_VC_REV=NO, the module hash before and after the change was the same.
- 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:
- 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.
- 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.
- Add rm -rf %t to all tests that pass -fmodule-cache-path=%t. This is unneccessary 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.)
Arguably, we should omit the full repo version from the hash: There's no reason to use a new cache dir just because someone fixed a typo in the (say) mlir docs. We'd also be better about remembering to bump clang::serialization::VERSION_MAJOR/MINOR in that case.