[llvm] r235469 - Revert "[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced."

Craig Topper craig.topper at gmail.com
Tue Apr 21 19:59:06 PDT 2015


Author: ctopper
Date: Tue Apr 21 21:59:06 2015
New Revision: 235469

URL: http://llvm.org/viewvc/llvm-project?rev=235469&view=rev
Log:
Revert "[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced."

Turns out I misread the parentheses. Though I'm pretty sure its always a RecordRecTy and non of the callers really seem to expect null. But until I'm completely sure I'm going to revert this.

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

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=235469&r1=235468&r2=235469&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Tue Apr 21 21:59:06 2015
@@ -345,7 +345,7 @@ Init *DagRecTy::convertValue(BinOpInit *
 }
 
 RecordRecTy *RecordRecTy::get(Record *R) {
-  return cast<RecordRecTy>(R->getDefInit()->getType());
+  return dyn_cast<RecordRecTy>(R->getDefInit()->getType());
 }
 
 std::string RecordRecTy::getAsString() const {





More information about the llvm-commits mailing list