clang  14.0.0git
CommandLineArgs.cpp
Go to the documentation of this file.
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 
10 #include "llvm/Support/ErrorHandling.h"
11 
12 namespace clang {
13 
14 std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
15  std::vector<std::string> Args;
16  // Test with basic arguments.
17  switch (Lang) {
18  case Lang_C89:
19  Args = {"-x", "c", "-std=c89"};
20  break;
21  case Lang_C99:
22  Args = {"-x", "c", "-std=c99"};
23  break;
24  case Lang_CXX03:
25  Args = {"-std=c++03", "-frtti"};
26  break;
27  case Lang_CXX11:
28  Args = {"-std=c++11", "-frtti"};
29  break;
30  case Lang_CXX14:
31  Args = {"-std=c++14", "-frtti"};
32  break;
33  case Lang_CXX17:
34  Args = {"-std=c++17", "-frtti"};
35  break;
36  case Lang_CXX20:
37  Args = {"-std=c++20", "-frtti"};
38  break;
39  case Lang_OBJCXX:
40  Args = {"-x", "objective-c++", "-frtti"};
41  break;
42  case Lang_OpenCL:
43  llvm_unreachable("Not implemented yet!");
44  }
45  return Args;
46 }
47 
49  switch (Lang) {
50  case Lang_C89:
51  case Lang_C99:
52  return "input.c";
53 
54  case Lang_CXX03:
55  case Lang_CXX11:
56  case Lang_CXX14:
57  case Lang_CXX17:
58  case Lang_CXX20:
59  return "input.cc";
60 
61  case Lang_OpenCL:
62  return "input.cl";
63 
64  case Lang_OBJCXX:
65  return "input.mm";
66  }
67  llvm_unreachable("Unhandled TestLanguage enum");
68 }
69 
70 } // end namespace clang
clang::Lang_CXX14
@ Lang_CXX14
Definition: CommandLineArgs.h:28
clang::Lang_CXX20
@ Lang_CXX20
Definition: CommandLineArgs.h:30
clang::getFilenameForTesting
StringRef getFilenameForTesting(TestLanguage Lang)
Definition: CommandLineArgs.cpp:48
clang::TestLanguage
TestLanguage
Definition: CommandLineArgs.h:23
clang::Lang_OBJCXX
@ Lang_OBJCXX
Definition: CommandLineArgs.h:32
clang::Lang_OpenCL
@ Lang_OpenCL
Definition: CommandLineArgs.h:31
clang::getCommandLineArgsForTesting
std::vector< std::string > getCommandLineArgsForTesting(TestLanguage Lang)
Definition: CommandLineArgs.cpp:14
clang::Lang_CXX11
@ Lang_CXX11
Definition: CommandLineArgs.h:27
clang::Lang_C89
@ Lang_C89
Definition: CommandLineArgs.h:24
clang::Lang_CXX17
@ Lang_CXX17
Definition: CommandLineArgs.h:29
clang::Lang_C99
@ Lang_C99
Definition: CommandLineArgs.h:25
clang
Definition: CalledOnceCheck.h:17
CommandLineArgs.h
clang::Lang_CXX03
@ Lang_CXX03
Definition: CommandLineArgs.h:26