More idiomatic

This commit is contained in:
Fangrui Song 2017-12-10 18:59:32 -08:00 committed by Jacob Dufault
parent 0aa832a48c
commit 479c0c59bc
2 changed files with 11 additions and 12 deletions

View File

@ -1657,8 +1657,10 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
// Update dependencies for the file. Do not include the file in its own // Update dependencies for the file. Do not include the file in its own
// dependency set. // dependency set.
entry->dependencies = param.seen_files; entry->dependencies = param.seen_files;
entry->dependencies.erase(std::find( entry->dependencies.erase(
entry->dependencies.begin(), entry->dependencies.end(), entry->path)); std::remove(entry->dependencies.begin(), entry->dependencies.end(),
entry->path),
entry->dependencies.end());
// Make sure we are using correct file contents. // Make sure we are using correct file contents.
for (const CXUnsavedFile& contents : file_contents) { for (const CXUnsavedFile& contents : file_contents) {
@ -1694,14 +1696,12 @@ void ClangSanityCheck() {
void* reserved) -> CXIdxClientFile { void* reserved) -> CXIdxClientFile {
return nullptr; return nullptr;
}; };
callback.ppIncludedFile = callback.ppIncludedFile = [](
[](CXClientData client_data, CXClientData client_data,
const CXIdxIncludedFileInfo* file) -> CXIdxClientFile { const CXIdxIncludedFileInfo* file) -> CXIdxClientFile { return nullptr; };
return nullptr; callback.importedASTFile = [](
}; CXClientData client_data,
callback.importedASTFile = const CXIdxImportedASTFileInfo*) -> CXIdxClientASTFile {
[](CXClientData client_data,
const CXIdxImportedASTFileInfo*) -> CXIdxClientASTFile {
return nullptr; return nullptr;
}; };
callback.startedTranslationUnit = [](CXClientData client_data, callback.startedTranslationUnit = [](CXClientData client_data,

View File

@ -98,8 +98,7 @@ std::unique_ptr<T> MakeUnique(Args&&... args) {
template <typename T> template <typename T>
void AddRange(std::vector<T>* dest, const std::vector<T>& to_add) { void AddRange(std::vector<T>* dest, const std::vector<T>& to_add) {
for (const T& e : to_add) dest->insert(dest->end(), to_add.begin(), to_add.end());
dest->push_back(e);
} }
template <typename T> template <typename T>