[clang-offload-bundler] Convert std::vector to llvm::SmallVector in OffloadBundlerConfig#192259
Open
StepfenShawn wants to merge 3 commits into
Open
[clang-offload-bundler] Convert std::vector to llvm::SmallVector in OffloadBundlerConfig#192259StepfenShawn wants to merge 3 commits into
std::vector to llvm::SmallVector in OffloadBundlerConfig#192259StepfenShawn wants to merge 3 commits into
Conversation
Member
|
@llvm/pr-subscribers-clang Author: 🍌Shawn (StepfenShawn) ChangesReplace Full diff: https://github.com/llvm/llvm-project/pull/192259.diff 1 Files Affected:
diff --git a/clang/include/clang/Driver/OffloadBundler.h b/clang/include/clang/Driver/OffloadBundler.h
index e7306ce3cc9ab..637c9d146533f 100644
--- a/clang/include/clang/Driver/OffloadBundler.h
+++ b/clang/include/clang/Driver/OffloadBundler.h
@@ -17,12 +17,12 @@
#ifndef LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
#define LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Error.h"
#include "llvm/TargetParser/Triple.h"
#include <llvm/Support/MemoryBuffer.h>
#include <string>
-#include <vector>
namespace clang {
@@ -47,10 +47,9 @@ class OffloadBundlerConfig {
std::string FilesType;
std::string ObjcopyPath;
- // TODO: Convert these to llvm::SmallVector
- std::vector<std::string> TargetNames;
- std::vector<std::string> InputFileNames;
- std::vector<std::string> OutputFileNames;
+ llvm::SmallVector<std::string, 4> TargetNames;
+ llvm::SmallVector<std::string, 4> InputFileNames;
+ llvm::SmallVector<std::string, 4> OutputFileNames;
};
class OffloadBundler {
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
std::vector<std::string>withllvm::SmallVector<std::string, 4>for TargetNames, InputFileNames, and OutputFileNames to avoid heap
allocation for small number of elements.