[llvm-commits] [llvm] r106246 - /llvm/trunk/utils/TableGen/Record.cpp

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Thu Jun 17 16:00:16 PDT 2010


Author: bruno
Date: Thu Jun 17 18:00:16 2010
New Revision: 106246

URL: http://llvm.org/viewvc/llvm-project?rev=106246&view=rev
Log:
In case Rec is a definition and not a class, do the proper comparison!

Modified:
    llvm/trunk/utils/TableGen/Record.cpp

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=106246&r1=106245&r2=106246&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Thu Jun 17 18:00:16 2010
@@ -270,7 +270,15 @@
 }
 
 bool RecordRecTy::baseClassOf(const RecordRecTy *RHS) const {
-  return Rec == RHS->getRecord() || RHS->getRecord()->isSubClassOf(Rec);
+  if (Rec == RHS->getRecord() || RHS->getRecord()->isSubClassOf(Rec))
+    return true;
+
+  const std::vector<Record*> &SC = Rec->getSuperClasses();
+  for (unsigned i = 0, e = SC.size(); i != e; ++i)
+    if (RHS->getRecord()->isSubClassOf(SC[i]))
+      return true;
+
+  return false;
 }
 
 





More information about the llvm-commits mailing list