Coverage Report

Created: 2021-01-23 06:44

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Testing/CommandLineArgs.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- CommandLineArgs.cpp ----------------------------------------------===//
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
#include "clang/Testing/CommandLineArgs.h"
10
#include "llvm/Support/ErrorHandling.h"
11
12
namespace clang {
13
14
22.9k
std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
15
22.9k
  std::vector<std::string> Args;
16
  // Test with basic arguments.
17
22.9k
  switch (Lang) {
18
897
  case Lang_C89:
19
897
    Args = {"-x", "c", "-std=c89"};
20
897
    break;
21
1.28k
  case Lang_C99:
22
1.28k
    Args = {"-x", "c", "-std=c99"};
23
1.28k
    break;
24
5.51k
  case Lang_CXX03:
25
5.51k
    Args = {"-std=c++03", "-frtti"};
26
5.51k
    break;
27
4.34k
  case Lang_CXX11:
28
4.34k
    Args = {"-std=c++11", "-frtti"};
29
4.34k
    break;
30
4.79k
  case Lang_CXX14:
31
4.79k
    Args = {"-std=c++14", "-frtti"};
32
4.79k
    break;
33
3.07k
  case Lang_CXX17:
34
3.07k
    Args = {"-std=c++17", "-frtti"};
35
3.07k
    break;
36
3.04k
  case Lang_CXX20:
37
3.04k
    Args = {"-std=c++20", "-frtti"};
38
3.04k
    break;
39
10
  case Lang_OBJCXX:
40
10
    Args = {"-x", "objective-c++", "-frtti"};
41
10
    break;
42
0
  case Lang_OpenCL:
43
0
    llvm_unreachable("Not implemented yet!");
44
22.9k
  }
45
22.9k
  return Args;
46
22.9k
}
47
48
13.1k
StringRef getFilenameForTesting(TestLanguage Lang) {
49
13.1k
  switch (Lang) {
50
658
  case Lang_C89:
51
1.31k
  case Lang_C99:
52
1.31k
    return "input.c";
53
54
2.02k
  case Lang_CXX03:
55
5.04k
  case Lang_CXX11:
56
7.30k
  case Lang_CXX14:
57
9.53k
  case Lang_CXX17:
58
11.8k
  case Lang_CXX20:
59
11.8k
    return "input.cc";
60
61
0
  case Lang_OpenCL:
62
0
    return "input.cl";
63
64
0
  case Lang_OBJCXX:
65
0
    return "input.mm";
66
0
  }
67
0
  llvm_unreachable("Unhandled TestLanguage enum");
68
0
}
69
70
} // end namespace clang