Coverage Report

Created: 2018-08-19 14:04

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/Common/Version.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- lib/Common/Version.cpp - LLD Version Number ---------------*- C++-=====//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file defines several version-related utility functions for LLD.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "lld/Common/Version.h"
15
16
using namespace llvm;
17
18
// Returns an SVN repository path, which is usually "trunk".
19
17
static std::string getRepositoryPath() {
20
17
  StringRef S = LLD_REPOSITORY_STRING;
21
17
  size_t Pos = S.find("lld/");
22
17
  if (Pos != StringRef::npos)
23
0
    return S.substr(Pos + 4);
24
17
  return S;
25
17
}
26
27
// Returns an SVN repository name, e.g., " (trunk 284614)"
28
// or an empty string if no repository info is available.
29
17
static std::string getRepository() {
30
17
  std::string Repo = getRepositoryPath();
31
17
  std::string Rev = LLD_REVISION_STRING;
32
17
33
17
  if (Repo.empty() && Rev.empty())
34
17
    return "";
35
0
  if (!Repo.empty() && !Rev.empty())
36
0
    return " (" + Repo + " " + Rev + ")";
37
0
  return " (" + Repo + Rev + ")";
38
0
}
39
40
// Returns a version string, e.g., "LLD 4.0 (lld/trunk 284614)".
41
17
std::string lld::getLLDVersion() {
42
17
  return "LLD " + std::string(LLD_VERSION_STRING) + getRepository();
43
17
}