[llvm] r310460 - [mips] PR34083 - Wimplicit-fallthrough warning in MipsAsmParser.cpp
Simon Dardis via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 03:47:52 PDT 2017
Author: sdardis
Date: Wed Aug 9 03:47:52 2017
New Revision: 310460
URL: http://llvm.org/viewvc/llvm-project?rev=310460&view=rev
Log:
[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!
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=310460&r1=310459&r2=310460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Wed Aug 9 03:47:52 2017
@@ -5439,12 +5439,13 @@ bool MipsAsmParser::isEvaluated(const MC
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:
More information about the llvm-commits
mailing list