[PATCH] D88832: [TableGen] Add new getAllDerivedDefinitionsTwo function to RecordKeeper

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 11:00:45 PDT 2020


Paul-C-Anagnostopoulos added inline comments.


================
Comment at: llvm/lib/TableGen/Record.cpp:2493-2500
+    AddDef = true;
+    for (auto *const Class : ClassRecs)
+      if (!OneDef.second->isSubClassOf(Class)) {
+        AddDef = false;
+        break;
+      }
+    if (AddDef)
----------------
Paul-C-Anagnostopoulos wrote:
> Paul-C-Anagnostopoulos wrote:
> > Paul-C-Anagnostopoulos wrote:
> > > jrtc27 wrote:
> > > > This can avoid some boilerplate by using llvm::any_of
> > > Ah, something new to learn. Okay, I'll check it out.
> > I'm sorry, please help me out. I coded:
> > 
> > for (const auto &OneDef : getDefs()) {
> >     if (!any_of(ClassRecs, [OneDef](Record *const Class) {
> >                              return !OneDef.second->isSubClassOf(Class);
> >                            }))
> >   Defs.push_back(OneDef.second.get());
> > 
> > I get a sequence of messages I cannot figure out. Sorry, I can't copy and paste them. The first one is "... attempting to reference a deleted function." It looks like it's about the std::pair class, which would be the OneDef.
> > 
> > 
> A screen capture.
> 
> {F13210870}
Got it. I didn't realize that OneDef would be captured by copying. 


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

https://reviews.llvm.org/D88832



More information about the llvm-commits mailing list