diff --git a/src/project.cc b/src/project.cc index f1496418..0286fa26 100644 --- a/src/project.cc +++ b/src/project.cc @@ -256,7 +256,7 @@ std::vector LoadFromDirectoryListing(ProjectConfig *config) { e.filename = file; e.args = GetCompilerArgumentForFile(file); if (e.args.empty()) - e.args.push_back("%clang"); // Add a Dummy. + e.args.push_back("%clang"); e.args.push_back(Intern(e.filename)); proc.Process(e); result.push_back(e); @@ -364,7 +364,7 @@ LoadEntriesFromDirectory(ProjectConfig *project, // argument guessing. int ComputeGuessScore(std::string_view a, std::string_view b) { // Increase score based on common prefix and suffix. Prefixes are prioritized. - if (a.size() < b.size()) + if (a.size() > b.size()) std::swap(a, b); size_t i = std::mismatch(a.begin(), a.end(), b.begin()).first - a.begin(); size_t j = std::mismatch(a.rbegin(), a.rend(), b.rbegin()).first - a.rbegin(); @@ -407,19 +407,6 @@ void Project::Load(const std::string &root) { } } -void Project::SetArgsForFile(const std::vector &args, - const std::string &path) { - std::lock_guard lock(mutex_); - for (auto &[root, folder] : root2folder) { - auto it = folder.path2entry_index.find(path); - if (it != folder.path2entry_index.end()) { - // The entry already exists in the project, just set the flags. - folder.entries[it->second].args = args; - return; - } - } -} - Project::Entry Project::FindEntry(const std::string &path, bool can_be_inferred) { std::lock_guard lock(mutex_);