Add support for -fXX feature flags

This commit is contained in:
Jonathan Müller 2018-12-03 12:17:50 +01:00
commit c6aae718bd
3 changed files with 23 additions and 0 deletions

View file

@ -74,6 +74,13 @@ public:
do_set_flags(standard, flags);
}
/// \effects Enables an `-fXXX` flag.
/// \returns Whether or not it was a known feature and enabled.
bool enable_feature(std::string name)
{
return do_enable_feature(name);
}
/// \effects Adds the given path to the set of include directories.
void add_include_dir(std::string path)
{
@ -121,6 +128,14 @@ private:
/// \effects Sets the given C++ standard and compilation flags.
virtual void do_set_flags(cpp_standard standard, compile_flags flags) = 0;
/// \effects Sets the given feature flags.
/// \returns Whether or not it was a known feature and set.
virtual bool do_enable_feature(std::string name)
{
(void)name;
return false;
}
/// \effects Adds the given path to the set of include directories.
virtual void do_add_include_dir(std::string path) = 0;

View file

@ -157,6 +157,8 @@ public:
private:
void do_set_flags(cpp_standard standard, compile_flags flags) override;
bool do_enable_feature(std::string name) override;
void do_add_include_dir(std::string path) override;
void do_add_macro_definition(std::string name, std::string definition) override;

View file

@ -386,6 +386,12 @@ void libclang_compile_config::do_set_flags(cpp_standard standard, compile_flags
add_flag("-fms-extensions");
}
bool libclang_compile_config::do_enable_feature(std::string name)
{
add_flag("-f" + std::move(name));
return true;
}
void libclang_compile_config::do_add_include_dir(std::string path)
{
add_flag("-I" + std::move(path));