From 872a61beb73ed919b11b00471914a176502f1760 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 7 Jun 2015 17:26:53 +0200 Subject: [PATCH] Removed dangerous use of vector. Opening files in a project now work every time. --- juci/source.cc | 8 ++++---- juci/source.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/juci/source.cc b/juci/source.cc index 0704446..c3241f0 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -115,7 +115,7 @@ InitSyntaxHighlighting(const std::string &filepath, int end_offset, clang::Index *index) { set_project_path(project_path); - std::vector arguments = get_compilation_commands(); + std::vector arguments = get_compilation_commands(); tu_ = clang::TranslationUnit(index, filepath, arguments, @@ -202,16 +202,16 @@ const Source::Config& Source::Model::config() const { return config_; } -std::vector Source::Model:: +std::vector Source::Model:: get_compilation_commands() { clang::CompilationDatabase db(project_path()+"/"); clang::CompileCommands commands(file_path(), &db); std::vector cmds = commands.get_commands(); - std::vector arguments; + std::vector arguments; for (auto &i : cmds) { std::vector lol = i.get_command_as_args(); for (int a = 1; a < lol.size()-4; a++) { - arguments.emplace_back(lol[a].c_str()); + arguments.emplace_back(lol[a]); } } return arguments; diff --git a/juci/source.h b/juci/source.h index 04ea352..b1c417b 100644 --- a/juci/source.h +++ b/juci/source.h @@ -135,7 +135,7 @@ namespace Source { int token_kind); void HighlightCursor(clang::Token *token, std::vector *source_ranges); - std::vector get_compilation_commands(); + std::vector get_compilation_commands(); }; class Controller {