Coverage Report

Created: 2017-09-21 03:39

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/lld/lib/Config/Version.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- lib/Config/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/Config/Version.h"
15
16
using namespace llvm;
17
18
// Returns an SVN repository path, which is usually "trunk".
19
13
static std::string getRepositoryPath() {
20
13
  StringRef S = LLD_REPOSITORY_STRING;
21
13
  size_t Pos = S.find("lld/");
22
13
  if (Pos != StringRef::npos)
23
0
    return S.substr(Pos + 4);
24
13
  return S;
25
13
}
26
27
// Returns an SVN repository name, e.g., " (trunk 284614)"
28
// or an empty string if no repository info is available.
29
13
static std::string getRepository() {
30
13
  std::string Repo = getRepositoryPath();
31
13
  std::string Rev = LLD_REVISION_STRING;
32
13
33
13
  if (
Repo.empty() && 13
Rev.empty()13
)
34
13
    return "";
35
0
  
if (0
!Repo.empty() && 0
!Rev.empty()0
)
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
13
std::string lld::getLLDVersion() {
42
13
  return "LLD " + std::string(LLD_VERSION_STRING) + getRepository();
43
13
}