summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@imgtec.com>2017-08-09 10:47:52 +0000
committerSimon Dardis <simon.dardis@imgtec.com>2017-08-09 10:47:52 +0000
commitc6be2251b7e9bbced533b13027eeaab83e166bc5 (patch)
tree1f7a1a0511864b28bdbdd211c1837a5a292b1e76 /llvm/lib/Target/Mips
parent18bda5b0f202d92826580ee84c1cd7c006d7a606 (diff)
downloadbcm5719-llvm-c6be2251b7e9bbced533b13027eeaab83e166bc5.tar.gz
bcm5719-llvm-c6be2251b7e9bbced533b13027eeaab83e166bc5.zip
[mips] PR34083 - Wimplicit-fallthrough warning in MipsAsmParser.cpp
Assert that a binary expression is actually a binary expression, rather than potientially incorrectly attempting to handle it as a unary expression. This resolves PR34083. Thanks to Simonn Pilgrim for reporting the issue! llvm-svn: 310460
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index e12188e7060..8a5de0150ad 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -5439,12 +5439,13 @@ bool MipsAsmParser::isEvaluated(const MCExpr *Expr) {
return true;
case MCExpr::SymbolRef:
return (cast<MCSymbolRefExpr>(Expr)->getKind() != MCSymbolRefExpr::VK_None);
- case MCExpr::Binary:
- if (const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr)) {
- if (!isEvaluated(BE->getLHS()))
- return false;
- return isEvaluated(BE->getRHS());
- }
+ case MCExpr::Binary: {
+ const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr);
+ assert(BE && "Binary expression is not a binary expression?");
+ if (!isEvaluated(BE->getLHS()))
+ return false;
+ return isEvaluated(BE->getRHS());
+ }
case MCExpr::Unary:
return isEvaluated(cast<MCUnaryExpr>(Expr)->getSubExpr());
case MCExpr::Target:
OpenPOWER on IntegriCloud