[PATCH] D67413: [Clang][Bundler] Replace std::vector by SmallVector [NFC]
Sergey Dmitriev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 09:28:09 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371637: [Clang][Bundler] Replace std::vector by SmallVector [NFC] (authored by sdmitriev, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D67413?vs=219590&id=219734#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67413/new/
https://reviews.llvm.org/D67413
Files:
cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Index: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===================================================================
--- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -17,6 +17,7 @@
#include "clang/Basic/Version.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
@@ -41,7 +42,6 @@
#include <memory>
#include <string>
#include <system_error>
-#include <vector>
using namespace llvm;
using namespace llvm::object;
@@ -658,10 +658,8 @@
}
// Open input files.
- std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers(
- InputFileNames.size());
-
- unsigned Idx = 0;
+ SmallVector<std::unique_ptr<MemoryBuffer>, 8u> InputBuffers;
+ InputBuffers.reserve(InputFileNames.size());
for (auto &I : InputFileNames) {
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
MemoryBuffer::getFileOrSTDIN(I);
@@ -669,7 +667,7 @@
errs() << "error: Can't open file " << I << ": " << EC.message() << "\n";
return true;
}
- InputBuffers[Idx++] = std::move(CodeOrErr.get());
+ InputBuffers.emplace_back(std::move(CodeOrErr.get()));
}
// Get the file handler. We use the host buffer as reference.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67413.219734.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190911/b7f26af3/attachment.bin>
More information about the llvm-commits
mailing list