This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Consider LLVM_APPEND_VC_REV when generating SVNVersion.inc
AbandonedPublic

Authored by GBuella on Jun 7 2018, 3:21 PM.

Details

Summary

This is merely a quickfix, due to being fustrated with waiting
for ~70 objects to be linked each time following git commit --amend.
When toggling LLVM_APPEND_VC_REV between ON and OFF, the
version inc file is still updated. Still, this is arguable
an improvement.

Diff Detail

Event Timeline

GBuella created this revision.Jun 7 2018, 3:21 PM
smeenai added a subscriber: smeenai.Jun 7 2018, 3:33 PM

I believe LLVM_APPEND_VC_REV controls whether the revision is appended to LLVM version string (e.g. the output of llvm-config --version), whereas the SVNRevision.inc file (which is what's causing the relink after amending) is used for e.g. the clang --version output, so I'm not sure this is the right thing to do. I would also love for an option to disable the SVNRevision stuff entirely though.

I believe LLVM_APPEND_VC_REV controls whether the revision is appended to LLVM version string (e.g. the output of llvm-config --version), whereas the SVNRevision.inc file (which is what's causing the relink after amending) is used for e.g. the clang --version output, so I'm not sure this is the right thing to do. I would also love for an option to disable the SVNRevision stuff entirely though.

Right, that is why I added the word "quickfix".
Perhaps we can add a CLANG_APPEND_VC_REV CMake option?

Sorry for the late comment...

Are you amending an llvm commit or a clang commit? The reason I ask is that if I amend an llvm commit, I have to update around 78 targets (llvm + clang + libcxx + libcxxabi + libunwind), but if I amend a clang commit, I only have to update 18 targets.

Since tools/clang/lib/Basic/SVNVersion.inc only includes revision number and repository for clang and llvm, the contents don't change on 'git commit --amend' of the clang repo. Conversely, include/llvm/Support/VCSRevision.h includes the git hash, so it changes each time 'git commit --amend' is run on the llvm repo.

If the clang version is the one causing your problem, perhaps you could add a check to see if the file actually changed before overwriting it. See llvm/include/llvm/Support/CMakeLists.txt for an example of how to do this, i.e., the "undef" case.

GBuella abandoned this revision.Jan 26 2019, 9:40 PM