[PATCH] D85538: [Clang options] Optimize optionMatches() runtime by removing mallocs

Nadav Rotem via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 23:10:28 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd54c252bc8a1: [Clang options] Optimize optionMatches() runtime by removing mallocs (authored by nadav).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85538/new/

https://reviews.llvm.org/D85538

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,9 @@
 static bool optionMatches(const OptTable::Info &In, StringRef Option) {
   if (In.Prefixes)
     for (size_t I = 0; In.Prefixes[I]; I++)
-      if (Option == std::string(In.Prefixes[I]) + In.Name)
-        return true;
+      if (Option.endswith(In.Name))
+        if (Option == std::string(In.Prefixes[I]) + In.Name)
+          return true;
   return false;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85538.285257.patch
Type: text/x-patch
Size: 555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/5c749011/attachment.bin>


More information about the llvm-commits mailing list