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