[PATCH] D92506: Remove memory allocation with string

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 13:09:14 PST 2020


hiraditya created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
hiraditya requested review of this revision.

Repository:
  rG LLVM Github Monorepo

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
@@ -198,8 +198,8 @@
 static bool optionMatches(const OptTable::Info &In, StringRef Option) {
   if (In.Prefixes)
     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.consume_back(In.Name))
+        if (Option.equals(In.Prefixes[I]))
           return true;
   return false;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92506.309041.patch
Type: text/x-patch
Size: 556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201202/42a8d2a7/attachment.bin>


More information about the llvm-commits mailing list