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 #include "VCSVersion.inc" 16*0b57cec5SDimitry Andric 17*0b57cec5SDimitry Andric // Returns a version string, e.g.: 18*0b57cec5SDimitry Andric // lld 9.0.0 (https://github.com/llvm/llvm-project.git 9efdd7ac5e914d3c9fa1ef) getLLDVersion()19*0b57cec5SDimitry Andricstd::string lld::getLLDVersion() { 205ffd83dbSDimitry Andric #ifdef LLD_VENDOR 215ffd83dbSDimitry Andric #define LLD_VENDOR_DISPLAY LLD_VENDOR " " 22*0b57cec5SDimitry Andric #else 235ffd83dbSDimitry Andric #define LLD_VENDOR_DISPLAY 24*0b57cec5SDimitry Andric #endif 255ffd83dbSDimitry Andric #if defined(LLD_REPOSITORY) && defined(LLD_REVISION) 265ffd83dbSDimitry Andric return LLD_VENDOR_DISPLAY "LLD " LLD_VERSION_STRING " (" LLD_REPOSITORY 275ffd83dbSDimitry Andric " " LLD_REVISION ")"; 285ffd83dbSDimitry Andric #else 295ffd83dbSDimitry Andric return LLD_VENDOR_DISPLAY "LLD " LLD_VERSION_STRING; 305ffd83dbSDimitry Andric #endif 315ffd83dbSDimitry Andric #undef LLD_VENDOR_DISPLAY 32*0b57cec5SDimitry Andric } 33