parent
2004780ea6
commit
61a2a22542
4 changed files with 35 additions and 4 deletions
|
|
@ -48,6 +48,12 @@ bool detail::libclang_compile_config_access::fast_preprocessing(
|
|||
return config.fast_preprocessing_;
|
||||
}
|
||||
|
||||
bool detail::libclang_compile_config_access::remove_comments_in_macro(
|
||||
const libclang_compile_config& config)
|
||||
{
|
||||
return config.remove_comments_in_macro_;
|
||||
}
|
||||
|
||||
libclang_compilation_database::libclang_compilation_database(const std::string& build_directory)
|
||||
{
|
||||
static_assert(std::is_same<database, CXCompilationDatabase>::value, "forgot to update type");
|
||||
|
|
@ -88,7 +94,10 @@ namespace
|
|||
}
|
||||
|
||||
libclang_compile_config::libclang_compile_config()
|
||||
: compile_config({}), write_preprocessed_(false), fast_preprocessing_(false)
|
||||
: compile_config({}),
|
||||
write_preprocessed_(false),
|
||||
fast_preprocessing_(false),
|
||||
remove_comments_in_macro_(false)
|
||||
{
|
||||
// set given clang binary
|
||||
auto ptr = CPPAST_CLANG_VERSION_STRING;
|
||||
|
|
|
|||
|
|
@ -200,9 +200,15 @@ namespace
|
|||
{
|
||||
// -x c++: force C++ as input language
|
||||
// -E: print preprocessor output
|
||||
// -CC: keep comments, even in macro
|
||||
// -dD: keep macros
|
||||
auto flags = std::string("-x c++ -E -CC -dD");
|
||||
auto flags = std::string("-x c++ -E -dD");
|
||||
|
||||
// -CC: keep comments, even in macro
|
||||
// -C: keep comments, but not in macro
|
||||
if (!detail::libclang_compile_config_access::remove_comments_in_macro(c))
|
||||
flags += " -CC";
|
||||
else
|
||||
flags += " -C";
|
||||
|
||||
if (macro_file_path)
|
||||
// -no*: disable default include search paths
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue