Coverage Report

Created: 2021-08-24 07:12

/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
23.3k
std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
15
23.3k
  std::vector<std::string> Args;
16
  // Test with basic arguments.
17
23.3k
  switch (Lang) {
18
905
  case Lang_C89:
19
905
    Args = {"-x", "c", "-std=c89"};
20
905
    break;
21
1.29k
  case Lang_C99:
22
1.29k
    Args = {"-x", "c", "-std=c99"};
23
1.29k
    break;
24
5.57k
  case Lang_CXX03:
25
5.57k
    Args = {"-std=c++03", "-frtti"};
26
5.57k
    break;
27
4.50k
  case Lang_CXX11:
28
4.50k
    Args = {"-std=c++11", "-frtti"};
29
4.50k
    break;
30
4.82k
  case Lang_CXX14:
31
4.82k
    Args = {"-std=c++14", "-frtti"};
32
4.82k
    break;
33
3.13k
  case Lang_CXX17:
34
3.13k
    Args = {"-std=c++17", "-frtti"};
35
3.13k
    break;
36
3.09k
  case Lang_CXX20:
37
3.09k
    Args = {"-std=c++20", "-frtti"};
38
3.09k
    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
23.3k
  }
45
23.3k
  return Args;
46
23.3k
}
47
48
13.3k
StringRef getFilenameForTesting(TestLanguage Lang) {
49
13.3k
  switch (Lang) {
50
662
  case Lang_C89:
51
1.32k
  case Lang_C99:
52
1.32k
    return "input.c";
53
54
2.03k
  case Lang_CXX03:
55
5.14k
  case Lang_CXX11:
56
7.41k
  case Lang_CXX14:
57
9.66k
  case Lang_CXX17:
58
11.9k
  case Lang_CXX20:
59
11.9k
    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.3k
  }
67
0
  llvm_unreachable("Unhandled TestLanguage enum");
68
0
}
69
70
} // end namespace clang