diff options
author | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2019-09-11 16:28:47 +0000 |
---|---|---|
committer | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2019-09-11 16:28:47 +0000 |
commit | 8d0c742a43a76eec372f56595f0269f38bb08b35 (patch) | |
tree | 471e35075781e37b5fe7fae0cb7bff95faeb800e /tools | |
parent | 211daf9ad473f99287380525693084af06ae09cc (diff) | |
download | clang-8d0c742a43a76eec372f56595f0269f38bb08b35.tar.gz |
[Clang][Bundler] Replace std::vector by SmallVector [NFC]
Differential Revision: https://reviews.llvm.org/D67413
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/clang-offload-bundler/ClangOffloadBundler.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 1614abb54e..277c031511 100644 --- a/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/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 @@ static bool BundleFiles() { } // 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 @@ static bool BundleFiles() { 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. |