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
// dependency set.
entry->dependencies = param.seen_files;
entry->dependencies.erase(std::find(
entry->dependencies.begin(), entry->dependencies.end(), entry->path));
entry->dependencies.erase(
std::remove(entry->dependencies.begin(), entry->dependencies.end(),
entry->path),
entry->dependencies.end());
// Make sure we are using correct file contents.
for (const CXUnsavedFile& contents : file_contents) {
@ -1694,14 +1696,12 @@ void ClangSanityCheck() {
void* reserved) -> CXIdxClientFile {
return nullptr;
};
callback.ppIncludedFile =
[](CXClientData client_data,
const CXIdxIncludedFileInfo* file) -> CXIdxClientFile {
return nullptr;
};
callback.importedASTFile =
[](CXClientData client_data,
const CXIdxImportedASTFileInfo*) -> CXIdxClientASTFile {
callback.ppIncludedFile = [](
CXClientData client_data,
const CXIdxIncludedFileInfo* file) -> CXIdxClientFile { return nullptr; };
callback.importedASTFile = [](
CXClientData client_data,
const CXIdxImportedASTFileInfo*) -> CXIdxClientASTFile {
return nullptr;
};
callback.startedTranslationUnit = [](CXClientData client_data,

View File

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