Added option to inject custom compile flags to compilation database (fixes #112)
This commit is contained in:
@@ -183,4 +183,17 @@ void generate_diagrams(const std::vector<std::string> &diagram_names,
|
||||
}
|
||||
}
|
||||
|
||||
void adjust_compilation_database(const clanguml::config::config &config,
|
||||
clang::tooling::CompilationDatabase &db)
|
||||
{
|
||||
if (config.add_compile_flags && !config.add_compile_flags().empty()) {
|
||||
for (auto &compile_command : db.getAllCompileCommands()) {
|
||||
compile_command.CommandLine.insert(
|
||||
compile_command.CommandLine.begin() + 1,
|
||||
config.add_compile_flags().begin(),
|
||||
config.add_compile_flags().end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace clanguml::common::generators
|
||||
@@ -139,6 +139,9 @@ void find_translation_units_for_diagrams(
|
||||
const std::vector<std::string> &compilation_database_files,
|
||||
std::map<std::string, std::vector<std::string>> &translation_units_map);
|
||||
|
||||
void adjust_compilation_database(const clanguml::config::config &config,
|
||||
clang::tooling::CompilationDatabase &db);
|
||||
|
||||
template <typename DiagramModel, typename DiagramConfig,
|
||||
typename TranslationUnitVisitor>
|
||||
class diagram_ast_consumer : public clang::ASTConsumer {
|
||||
|
||||
Reference in New Issue
Block a user