Coverage Report

Created: 2020-10-24 06:27

/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.4k
std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
15
22.4k
  std::vector<std::string> Args;
16
  // Test with basic arguments.
17
22.4k
  switch (Lang) {
18
894
  case Lang_C89:
19
894
    Args = {"-x", "c", "-std=c89"};
20
894
    break;
21
1.25k
  case Lang_C99:
22
1.25k
    Args = {"-x", "c", "-std=c99"};
23
1.25k
    break;
24
5.44k
  case Lang_CXX03:
25
5.44k
    Args = {"-std=c++03", "-frtti"};
26
5.44k
    break;
27
4.11k
  case Lang_CXX11:
28
4.11k
    Args = {"-std=c++11", "-frtti"};
29
4.11k
    break;
30
4.75k
  case Lang_CXX14:
31
4.75k
    Args = {"-std=c++14", "-frtti"};
32
4.75k
    break;
33
2.97k
  case Lang_CXX17:
34
2.97k
    Args = {"-std=c++17", "-frtti"};
35
2.97k
    break;
36
3.01k
  case Lang_CXX20:
37
3.01k
    Args = {"-std=c++20", "-frtti"};
38
3.01k
    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.4k
  }
45
22.4k
  return Args;
46
22.4k
}
47
48
12.8k
StringRef getFilenameForTesting(TestLanguage Lang) {
49
12.8k
  switch (Lang) {
50
1.31k
  case Lang_C89:
51
1.31k
  case Lang_C99:
52
1.31k
    return "input.c";
53
54
11.4k
  case Lang_CXX03:
55
11.4k
  case Lang_CXX11:
56
11.4k
  case Lang_CXX14:
57
11.4k
  case Lang_CXX17:
58
11.4k
  case Lang_CXX20:
59
11.4k
    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