[PATCH] D92506: Remove memory allocation with string
Aditya Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 5 15:15:27 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc4e327a960d2: Remove memory allocation with string (authored by hiraditya).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92506/new/
https://reviews.llvm.org/D92506
Files:
llvm/lib/Option/OptTable.cpp
Index: llvm/lib/Option/OptTable.cpp
===================================================================
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -196,11 +196,13 @@
// Returns true if one of the Prefixes + In.Names matches Option
static bool optionMatches(const OptTable::Info &In, StringRef Option) {
- if (In.Prefixes)
+ if (In.Prefixes) {
+ StringRef InName(In.Name);
for (size_t I = 0; In.Prefixes[I]; I++)
- if (Option.endswith(In.Name))
- if (Option == std::string(In.Prefixes[I]) + In.Name)
+ if (Option.endswith(InName))
+ if (Option.slice(0, Option.size() - InName.size()) == In.Prefixes[I])
return true;
+ }
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92506.309752.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201205/7806ea0d/attachment.bin>
More information about the llvm-commits
mailing list