Add a proper workaround for #46

This commit is contained in:
Jonathan Müller 2018-03-26 21:21:38 +02:00
commit 045a33fbd6

View file

@ -91,7 +91,7 @@ namespace
} }
return result; return result;
} }
} } // namespace
libclang_compile_config::libclang_compile_config() libclang_compile_config::libclang_compile_config()
: compile_config({}), : compile_config({}),
@ -150,7 +150,7 @@ namespace
// relative w/o separator // relative w/o separator
return dir.std_str() + file; return dir.std_str() + file;
} }
} } // namespace
void detail::for_each_file(const libclang_compilation_database& database, void* user_data, void detail::for_each_file(const libclang_compilation_database& database, void* user_data,
void (*callback)(void*, std::string)) void (*callback)(void*, std::string))
@ -226,7 +226,7 @@ namespace
// else skip argument // else skip argument
} }
} }
} } // namespace
libclang_compile_config::libclang_compile_config(const libclang_compilation_database& database, libclang_compile_config::libclang_compile_config(const libclang_compilation_database& database,
const std::string& file) const std::string& file)
@ -303,7 +303,12 @@ void libclang_compile_config::do_set_flags(cpp_standard standard, compile_flags
} }
if (flags & compile_flag::ms_compatibility) if (flags & compile_flag::ms_compatibility)
{
add_flag("-fms-compatibility"); add_flag("-fms-compatibility");
// see https://github.com/foonathan/cppast/issues/46
define_macro("_DEBUG_FUNCTIONAL_MACHINERY", "");
}
if (flags & compile_flag::ms_extensions) if (flags & compile_flag::ms_extensions)
add_flag("-fms-extensions"); add_flag("-fms-extensions");
} }
@ -484,7 +489,7 @@ namespace
clang_getPresumedLocation(loc, nullptr, &line, nullptr); clang_getPresumedLocation(loc, nullptr, &line, nullptr);
return line; return line;
} }
} } // namespace
std::unique_ptr<cpp_file> libclang_parser::do_parse(const cpp_entity_index& idx, std::string path, std::unique_ptr<cpp_file> libclang_parser::do_parse(const cpp_entity_index& idx, std::string path,
const compile_config& c) const try const compile_config& c) const try