Fix hierarchical .cquery

This commit is contained in:
Fangrui Song 2018-03-10 19:48:40 -08:00
parent 640f548e7c
commit 2a7117e6e5
2 changed files with 7 additions and 7 deletions

View File

@ -335,15 +335,15 @@ std::vector<Project::Entry> LoadFromDirectoryListing(Config* init_opts,
auto GetCompilerArgumentForFile = [&config,
&folder_args](const std::string& path) {
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];
};

View File

@ -33,10 +33,10 @@ struct MultiQueueLock {
MultiQueueLock(Queue... lockable) : tuple_{lockable...} { lock(); }
~MultiQueueLock() { unlock(); }
void lock() {
lock_impl(typename std::make_index_sequence<sizeof...(Queue)>{});
lock_impl(typename std::index_sequence_for<Queue...>{});
}
void unlock() {
unlock_impl(typename std::make_index_sequence<sizeof...(Queue)>{});
unlock_impl(typename std::index_sequence_for<Queue...>{});
}
private: