[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


================
@@ -27,37 +27,117 @@ struct TestClangConfig {
   /// The argument of the `-target` command line flag.
   std::string Target;
 
-  bool isC() const { return Language == Lang_C89 || Language == Lang_C99; }
-
-  bool isC99OrLater() const { return Language == Lang_C99; }
-
-  bool isCXX() const {
-    return Language == Lang_CXX03 || Language == Lang_CXX11 ||
-           Language == Lang_CXX14 || Language == Lang_CXX17 ||
-           Language == Lang_CXX20 || Language == Lang_CXX23;
+  bool isC() const {
+    return false
+#define TESTLANGUAGE
+#define TESTLANGUAGE_C(lang, version, std_flag, version_index)                 \
+  || Language == Lang_##lang##version
+#define TESTLANGUAGE_CXX(lang, version, std_flag, version_index)
+#include "clang/Testing/TestLanguage.def"
----------------
Sirraide wrote:

```suggestion
    return false
#define TESTLANGUAGE_C(lang, version, std_flag, version_index)                 \
  || Language == Lang_##lang##version
#include "clang/Testing/TestLanguage.def"
```

Just to illustrate what I meant in the previous comment (the same applies to other cases below as well)

https://github.com/llvm/llvm-project/pull/94243


More information about the cfe-commits mailing list