[PATCH] D60445: Change cast to dyn_cast to be consistent with other casts within same scope.

Brandon Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 02:32:52 PDT 2019


BrandonTJones created this revision.
BrandonTJones added reviewers: andreadb, grosbach.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

This cast seems incorrect looking at similar and may cause errors.


Repository:
  rL LLVM

https://reviews.llvm.org/D60445

Files:
  llvm/lib/MC/MCExpr.cpp


Index: llvm/lib/MC/MCExpr.cpp
===================================================================
--- llvm/lib/MC/MCExpr.cpp
+++ llvm/lib/MC/MCExpr.cpp
@@ -761,7 +761,7 @@
                                                   Addrs, InSet)) {
       // Check if both are Target Expressions, see if we can compare them.
       if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS()))
-        if (const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS())) {
+        if (const MCTargetExpr *R = dyn_cast<MCTargetExpr>(ABE->getRHS())) {
           switch (ABE->getOpcode()) {
           case MCBinaryExpr::EQ:
             Res = MCValue::get((L->isEqualTo(R)) ? -1 : 0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60445.194270.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190409/f0cd7e11/attachment.bin>


More information about the llvm-commits mailing list