diff --git a/src/project.cc b/src/project.cc index 0d600cd3..6a5f8e2b 100644 --- a/src/project.cc +++ b/src/project.cc @@ -334,16 +334,16 @@ std::vector LoadFromDirectoryListing(Config* init_opts, auto GetCompilerArgumentForFile = [&config, &folder_args](const std::string& path) { - for (std::string cur = GetDirName(path); ; cur = GetDirName(cur)) { + for (std::string cur = GetDirName(path);; cur = GetDirName(cur)) { + auto it = folder_args.find(cur); + if (it != folder_args.end()) + return it->second; std::string normalized = NormalizePath(cur); + // Break if outside of the project root. if (normalized.size() <= config->project_dir.size() || normalized.compare(0, config->project_dir.size(), config->project_dir) != 0) break; - auto it = folder_args.find(cur); - if (it != folder_args.end()) { - return it->second; - } } return folder_args[config->project_dir]; }; diff --git a/src/threaded_queue.h b/src/threaded_queue.h index 7b8ffe7e..aeaab5d1 100644 --- a/src/threaded_queue.h +++ b/src/threaded_queue.h @@ -33,10 +33,10 @@ struct MultiQueueLock { MultiQueueLock(Queue... lockable) : tuple_{lockable...} { lock(); } ~MultiQueueLock() { unlock(); } void lock() { - lock_impl(typename std::make_index_sequence{}); + lock_impl(typename std::index_sequence_for{}); } void unlock() { - unlock_impl(typename std::make_index_sequence{}); + unlock_impl(typename std::index_sequence_for{}); } private: