From 9b0256355edb2c00a04fe244bd712862826bc60b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 7 Feb 2018 10:27:30 -0800 Subject: [PATCH] Address ODR violation spot by @Riatre and work around .o .a in compile_commands.json --- src/project.cc | 5 +++++ src/query.cc | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/project.cc b/src/project.cc index 937ff8cd..fbade5ca 100644 --- a/src/project.cc +++ b/src/project.cc @@ -241,6 +241,11 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry( // This is most likely the file path we will be passing to clang. if (EndsWith(arg, base_name)) arg = cleanup_maybe_relative_path(arg); + // TODO Exclude .a .o to make link command in compile_commands.json work. + // Also, clang_parseTranslationUnit2FullArgv does not seem to accept + // multiple source filenames. + else if (EndsWith(arg, ".a") || EndsWith(arg, ".o")) + continue; } result.args.push_back(arg); diff --git a/src/query.cc b/src/query.cc index b81ed1aa..5b4f4f8f 100644 --- a/src/query.cc +++ b/src/query.cc @@ -357,11 +357,6 @@ Maybe GetQueryVarIdFromUsr(QueryDatabase* query_db, } // namespace -template <> -bool Maybe::has_value() const { - return storage.range.start.line >= 0; -} - Maybe QueryDatabase::GetQueryFileIdFromPath( const std::string& path) { return ::GetQueryFileIdFromPath(this, path, false);