xref: /freebsd/contrib/llvm-project/lld/Common/Version.cpp (revision 8a272653d9fbd9fc37691c9aad6a05089b4ecb4d)
1 //===- lib/Common/Version.cpp - LLD Version Number ---------------*- C++-=====//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines several version-related utility functions for LLD.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "lld/Common/Version.h"
14 
15 #ifdef HAVE_VCS_VERSION_INC
16 #include "VCSVersion.inc"
17 #endif
18 
19 // Returns a version string, e.g.:
20 // lld 9.0.0 (https://github.com/llvm/llvm-project.git 9efdd7ac5e914d3c9fa1ef)
21 std::string lld::getLLDVersion() {
22 #ifdef LLD_VENDOR
23 #define LLD_VENDOR_DISPLAY LLD_VENDOR " "
24 #else
25 #define LLD_VENDOR_DISPLAY
26 #endif
27 #if defined(LLD_REPOSITORY) && defined(LLD_REVISION)
28   return LLD_VENDOR_DISPLAY "LLD " LLD_VERSION_STRING " (" LLD_REPOSITORY
29                             " " LLD_REVISION ")";
30 #else
31   return LLD_VENDOR_DISPLAY "LLD " LLD_VERSION_STRING;
32 #endif
33 #undef LLD_VENDOR_DISPLAY
34 }
35