Add option to change preprocessor -CC to -C

See #37.
This commit is contained in:
Jonathan Müller 2018-03-19 21:55:06 +01:00
commit 61a2a22542
4 changed files with 35 additions and 4 deletions

View file

@ -27,6 +27,8 @@ namespace cppast
static bool write_preprocessed(const libclang_compile_config& config);
static bool fast_preprocessing(const libclang_compile_config& config);
static bool remove_comments_in_macro(const libclang_compile_config& config);
};
void for_each_file(const libclang_compilation_database& database, void* user_data,
@ -144,6 +146,15 @@ namespace cppast
fast_preprocessing_ = b;
}
/// \effects Sets whether or not documentation comments generated by macros are removed.
/// Default value is `false`.
/// \notes If this leads to an error due to preprocessing and comments, you have to enable it.
/// \notes If this is `true`, `clang` will be invoked with `-CC`, otherwise `-C`.
void remove_comments_in_macro(bool b) noexcept
{
remove_comments_in_macro_ = b;
}
private:
void do_set_flags(cpp_standard standard, compile_flags flags) override;
@ -162,6 +173,7 @@ namespace cppast
int clang_version_;
bool write_preprocessed_ : 1;
bool fast_preprocessing_ : 1;
bool remove_comments_in_macro_ : 1;
friend detail::libclang_compile_config_access;
};