Skip to content

Commit e751294

Browse files
Add c++2b as a permitted language version (#156)
1 parent 4143cea commit e751294

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

include/cppast/compile_config.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum class cpp_standard
2626
cpp_17,
2727
cpp_2a,
2828
cpp_20,
29+
cpp_2b,
2930

3031
cpp_latest = cpp_standard::cpp_14, //< The latest supported C++ standard.
3132
};
@@ -52,6 +53,8 @@ inline const char* to_string(cpp_standard standard) noexcept
5253
return "c++2a";
5354
case cpp_standard::cpp_20:
5455
return "c++20";
56+
case cpp_standard::cpp_2b:
57+
return "c++2b";
5558
}
5659

5760
DEBUG_UNREACHABLE(detail::assert_handler{});

src/libclang/libclang_parser.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,15 @@ void libclang_compile_config::do_set_flags(cpp_standard standard, compile_flags
415415
}
416416
else
417417
throw std::invalid_argument("c++20 is not yet supported for current version of clang");
418+
case cpp_standard::cpp_2b:
419+
if (libclang_parser::libclang_minor_version() >= 61)
420+
{ // Corresponds to Clang version 12
421+
if (flags & compile_flag::gnu_extensions)
422+
add_flag("-std=gnu++2a");
423+
else
424+
add_flag("-std=c++2a");
425+
break;
426+
}
418427
}
419428

420429
if (flags & compile_flag::ms_compatibility)

tool/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ try
310310
config.set_flags(cppast::cpp_standard::cpp_2a, flags);
311311
else if (options["std"].as<std::string>() == "c++20")
312312
config.set_flags(cppast::cpp_standard::cpp_20, flags);
313+
else if (options["std"].as<std::string>() == "c++2b")
314+
config.set_flags(cppast::cpp_standard::cpp_2b, flags);
313315
else
314316
{
315317
print_error("invalid value '" + options["std"].as<std::string>() + "' for std flag");

0 commit comments

Comments
 (0)