Coverage Report

Created: 2022-01-22 13:19

/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
24.4k
std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
15
24.4k
  std::vector<std::string> Args;
16
  // Test with basic arguments.
17
24.4k
  switch (Lang) {
18
948
  case Lang_C89:
19
948
    Args = {"-x", "c", "-std=c89"};
20
948
    break;
21
1.33k
  case Lang_C99:
22
1.33k
    Args = {"-x", "c", "-std=c99"};
23
1.33k
    break;
24
5.65k
  case Lang_CXX03:
25
5.65k
    Args = {"-std=c++03", "-frtti"};
26
5.65k
    break;
27
4.89k
  case Lang_CXX11:
28
4.89k
    Args = {"-std=c++11", "-frtti"};
29
4.89k
    break;
30
5.13k
  case Lang_CXX14:
31
5.13k
    Args = {"-std=c++14", "-frtti"};
32
5.13k
    break;
33
3.27k
  case Lang_CXX17:
34
3.27k
    Args = {"-std=c++17", "-frtti"};
35
3.27k
    break;
36
3.22k
  case Lang_CXX20:
37
3.22k
    Args = {"-std=c++20", "-frtti"};
38
3.22k
    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
24.4k
  }
45
24.4k
  return Args;
46
24.4k
}
47
48
13.9k
StringRef getFilenameForTesting(TestLanguage Lang) {
49
13.9k
  switch (Lang) {
50
700
  case Lang_C89:
51
1.40k
  case Lang_C99:
52
1.40k
    return "input.c";
53
54
2.10k
  case Lang_CXX03:
55
5.38k
  case Lang_CXX11:
56
7.76k
  case Lang_CXX14:
57
10.1k
  case Lang_CXX17:
58
12.5k
  case Lang_CXX20:
59
12.5k
    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
13.9k
  }
67
0
  llvm_unreachable("Unhandled TestLanguage enum");
68
0
}
69
70
} // end namespace clang