[PATCH] D66273: [Tooling] Add a hack to work around issues with matcher binding in r368681.

David L. Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 21:12:58 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368958: [Tooling] Add a hack to work around issues with matcher binding in r368681. (authored by dlj, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66273?vs=215316&id=215317#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66273

Files:
  cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp


Index: cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
===================================================================
--- cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
+++ cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
@@ -98,8 +98,10 @@
   Matchers.reserve(Cases.size());
   for (const auto &Case : Cases) {
     std::string Tag = (TagBase + Twine(Case.first)).str();
-    auto M = Case.second.Matcher.tryBind(Tag);
-    assert(M && "RewriteRule matchers should be bindable.");
+    // HACK: Many matchers are not bindable, so ensure that tryBind will work.
+    DynTypedMatcher BoundMatcher(Case.second.Matcher);
+    BoundMatcher.setAllowBind(true);
+    auto M = BoundMatcher.tryBind(Tag);
     Matchers.push_back(*std::move(M));
   }
   return Matchers;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66273.215317.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190815/cc628eb5/attachment-0001.bin>


More information about the cfe-commits mailing list