diff options
author | Fangrui Song <i@maskray.me> | 2022-07-30 18:11:21 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-07-30 18:11:21 -0700 |
commit | 4b2b68d5abd8981d0a5ca47e2bbc6df3d8360fd1 (patch) | |
tree | 76c9a460099009a0c099fca91f386be6f4974e10 /lld/Common | |
parent | a465e79f19569bca2201e6d71ff8cb89c87dd6fb (diff) | |
download | llvm-4b2b68d5abd8981d0a5ca47e2bbc6df3d8360fd1.tar.gz |
[lld] Change vector to SmallVector. NFC
My lld executable is 1.6KiB smaller and some functions are now more efficient.
Diffstat (limited to 'lld/Common')
-rw-r--r-- | lld/Common/Args.cpp | 5 | ||||
-rw-r--r-- | lld/Common/Strings.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp index fe7300dd597e..388c15b3db3e 100644 --- a/lld/Common/Args.cpp +++ b/lld/Common/Args.cpp @@ -54,8 +54,9 @@ int64_t lld::args::getHex(opt::InputArgList &args, unsigned key, return ::getInteger(args, key, Default, 16); } -std::vector<StringRef> lld::args::getStrings(opt::InputArgList &args, int id) { - std::vector<StringRef> v; +SmallVector<StringRef, 0> lld::args::getStrings(opt::InputArgList &args, + int id) { + SmallVector<StringRef, 0> v; for (auto *arg : args.filtered(id)) v.push_back(arg->getValue()); return v; diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp index 6e5478e335ca..31397b75b295 100644 --- a/lld/Common/Strings.cpp +++ b/lld/Common/Strings.cpp @@ -46,8 +46,8 @@ bool StringMatcher::match(StringRef s) const { } // Converts a hex string (e.g. "deadbeef") to a vector. -std::vector<uint8_t> lld::parseHex(StringRef s) { - std::vector<uint8_t> hex; +SmallVector<uint8_t, 0> lld::parseHex(StringRef s) { + SmallVector<uint8_t, 0> hex; while (!s.empty()) { StringRef b = s.substr(0, 2); s = s.substr(2); |