[clang] [clang][test] add TestLanguage.def to specify all tested language versions (PR #94243)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 12:00:47 PDT 2024
================
@@ -11,99 +11,84 @@
#include "llvm/Support/ErrorHandling.h"
namespace clang {
+std::vector<TestLanguage> getCOrLater(const int MinimumStd) {
+ std::vector<TestLanguage> Result{};
+
+#define TESTLANGUAGE(lang, version, std_flag, version_index)
+#define TESTLANGUAGE_C(lang, version, std_flag, version_index) \
+ if (version >= MinimumStd) \
+ Result.push_back(Lang_##lang##version);
+#include "clang/Testing/TestLanguage.def"
+
+ return Result;
+}
+std::vector<TestLanguage> getCXXOrLater(const int MinimumStd) {
+ std::vector<TestLanguage> Result{};
+
+#define TESTLANGUAGE(lang, version, std_flag, version_index)
+#define TESTLANGUAGE_CXX(lang, version, std_flag, version_index) \
+ if (version >= MinimumStd) \
+ Result.push_back(Lang_##lang##version);
+#include "clang/Testing/TestLanguage.def"
+
+ return Result;
+}
std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
- std::vector<std::string> Args;
// Test with basic arguments.
switch (Lang) {
- case Lang_C89:
- Args = {"-x", "c", "-std=c89"};
- break;
- case Lang_C99:
- Args = {"-x", "c", "-std=c99"};
- break;
- case Lang_CXX03:
- Args = {"-std=c++03", "-frtti"};
- break;
- case Lang_CXX11:
- Args = {"-std=c++11", "-frtti"};
- break;
- case Lang_CXX14:
- Args = {"-std=c++14", "-frtti"};
- break;
- case Lang_CXX17:
- Args = {"-std=c++17", "-frtti"};
- break;
- case Lang_CXX20:
- Args = {"-std=c++20", "-frtti"};
- break;
- case Lang_CXX23:
- Args = {"-std=c++23", "-frtti"};
- break;
+#define TESTLANGUAGE
+#define TESTLANGUAGE_C(lang, version, std_flag, version_index) \
+ case Lang_##lang##version: \
+ return { "-x", "c", "-std=" #std_flag };
+#define TESTLANGUAGE_CXX(lang, version, std_flag, version_index) \
+ case Lang_##lang##version: \
+ return { "-std=" #std_flag, "-frtti" };
+#include "clang/Testing/TestLanguage.def"
+
case Lang_OBJC:
- Args = {"-x", "objective-c", "-frtti", "-fobjc-nonfragile-abi"};
- break;
+ return {"-x", "objective-c", "-frtti", "-fobjc-nonfragile-abi"};
case Lang_OBJCXX:
- Args = {"-x", "objective-c++", "-frtti"};
- break;
+ return {"-x", "objective-c++", "-frtti"};
case Lang_OpenCL:
llvm_unreachable("Not implemented yet!");
}
- return Args;
+ llvm_unreachable("Not implemented yet!");
----------------
Sirraide wrote:
(That applies to all of these `llvm_unreachable` calls, not just here)
https://github.com/llvm/llvm-project/pull/94243
More information about the cfe-commits
mailing list