Add support for C++17 parsing with cpp_1z option
Note: It is currently experimental.
This commit is contained in:
parent
63c34e1ca3
commit
2af22083a6
3 changed files with 14 additions and 2 deletions
|
|
@ -23,7 +23,9 @@ namespace cppast
|
||||||
cpp_11,
|
cpp_11,
|
||||||
cpp_14,
|
cpp_14,
|
||||||
|
|
||||||
cpp_latest = cpp_standard::cpp_14,
|
cpp_1z, //< Upcoming C++17 (experimental).
|
||||||
|
|
||||||
|
cpp_latest = cpp_standard::cpp_14, //< The latest supported C++ standard.
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \returns A human readable string representing the option,
|
/// \returns A human readable string representing the option,
|
||||||
|
|
@ -40,6 +42,8 @@ namespace cppast
|
||||||
return "c++11";
|
return "c++11";
|
||||||
case cpp_standard::cpp_14:
|
case cpp_standard::cpp_14:
|
||||||
return "c++14";
|
return "c++14";
|
||||||
|
case cpp_standard::cpp_1z:
|
||||||
|
return "c++1z";
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_UNREACHABLE(detail::assert_handler{});
|
DEBUG_UNREACHABLE(detail::assert_handler{});
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,12 @@ void libclang_compile_config::do_set_flags(cpp_standard standard, compile_flags
|
||||||
else
|
else
|
||||||
add_flag("-std=c++14");
|
add_flag("-std=c++14");
|
||||||
break;
|
break;
|
||||||
|
case cpp_standard::cpp_1z:
|
||||||
|
if (flags & compile_flag::gnu_extensions)
|
||||||
|
add_flag("-std=gnu++1z");
|
||||||
|
else
|
||||||
|
add_flag("-std=c++1z");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & compile_flag::ms_compatibility)
|
if (flags & compile_flag::ms_compatibility)
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ int main(int argc, char* argv[])
|
||||||
("file", "the file that is being parsed (last positional argument)",
|
("file", "the file that is being parsed (last positional argument)",
|
||||||
cxxopts::value<std::string>());
|
cxxopts::value<std::string>());
|
||||||
options.add_options("compilation")
|
options.add_options("compilation")
|
||||||
("std", "set the C++ standard (c++98, c++03, c++11, c++14)",
|
("std", "set the C++ standard (c++98, c++03, c++11, c++14, c++1z (experimental))",
|
||||||
cxxopts::value<std::string>()->default_value(cppast::to_string(cppast::cpp_standard::cpp_latest)))
|
cxxopts::value<std::string>()->default_value(cppast::to_string(cppast::cpp_standard::cpp_latest)))
|
||||||
("I,include_directory", "add directory to include search path",
|
("I,include_directory", "add directory to include search path",
|
||||||
cxxopts::value<std::vector<std::string>>())
|
cxxopts::value<std::vector<std::string>>())
|
||||||
|
|
@ -276,6 +276,8 @@ int main(int argc, char* argv[])
|
||||||
config.set_flags(cppast::cpp_standard::cpp_11, flags);
|
config.set_flags(cppast::cpp_standard::cpp_11, flags);
|
||||||
else if (options["std"].as<std::string>() == "c++14")
|
else if (options["std"].as<std::string>() == "c++14")
|
||||||
config.set_flags(cppast::cpp_standard::cpp_14, flags);
|
config.set_flags(cppast::cpp_standard::cpp_14, flags);
|
||||||
|
else if (options["std"].as<std::string>() == "c++1z")
|
||||||
|
config.set_flags(cppast::cpp_standard::cpp_1z, flags);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_error("invalid value '" + options["std"].as<std::string>() + "' for std flag");
|
print_error("invalid value '" + options["std"].as<std::string>() + "' for std flag");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue