[llvm] 1d57656 - [NFC][CodeGen] Add braces for else per LLVM coding standard (#181750)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 17 10:00:03 PST 2026
Author: Rahul Joshi
Date: 2026-02-17T09:59:58-08:00
New Revision: 1d57656549fa894b884e4c4d695750acab6378de
URL: https://github.com/llvm/llvm-project/commit/1d57656549fa894b884e4c4d695750acab6378de
DIFF: https://github.com/llvm/llvm-project/commit/1d57656549fa894b884e4c4d695750acab6378de.diff
LOG: [NFC][CodeGen] Add braces for else per LLVM coding standard (#181750)
Add braces for else bodies if the if body has braces.
Added:
Modified:
llvm/lib/CodeGen/MIRParser/MIParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 9329adcb995b8..c90ee21c6750b 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -959,8 +959,9 @@ bool MIParser::parseBasicBlock(MachineBasicBlock &MBB,
return true;
} else if (consumeIfPresent(MIToken::Newline)) {
continue;
- } else
+ } else {
break;
+ }
if (!Token.isNewlineOrEOF())
return error("expected line break at the end of a list");
lex();
@@ -1162,8 +1163,9 @@ bool MIParser::parse(MachineInstr *&MI) {
} else if (Token.is(MIToken::md_dilocation)) {
if (parseDILocation(Node))
return true;
- } else
+ } else {
return error("expected a metadata node after 'debug-location'");
+ }
if (!isa<DILocation>(Node))
return error("referenced metadata is not a DILocation");
DebugLocation = DebugLoc(Node);
@@ -1301,8 +1303,9 @@ bool MIParser::parseStandaloneMDNode(MDNode *&Node) {
} else if (Token.is(MIToken::md_dilocation)) {
if (parseDILocation(Node))
return true;
- } else
+ } else {
return error("expected a metadata node");
+ }
if (Token.isNot(MIToken::Eof))
return error("expected end of string after the metadata node");
return false;
@@ -2039,8 +2042,9 @@ bool MIParser::parseLowLevelType(StringRef::iterator Loc, LLT &Ty) {
return error("invalid address space number");
Ty = LLT::pointer(AS, DL.getPointerSizeInBits(AS));
- } else
+ } else {
return GetError();
+ }
lex();
if (Token.isNot(MIToken::greater))
@@ -2416,8 +2420,9 @@ bool MIParser::parseDILocation(MDNode *&Loc) {
} else if (Token.is(MIToken::md_dilocation)) {
if (parseDILocation(InlinedAt))
return true;
- } else
+ } else {
return error("expected metadata node");
+ }
if (!isa<DILocation>(InlinedAt))
return error("expected DILocation node");
continue;
@@ -2808,8 +2813,9 @@ bool MIParser::parseShuffleMaskOperand(MachineOperand &Dest) {
} else if (Token.is(MIToken::IntegerLiteral)) {
const APSInt &Int = Token.integerValue();
ShufMask.push_back(Int.getExtValue());
- } else
+ } else {
return error("expected integer constant");
+ }
lex();
} while (consumeIfPresent(MIToken::comma));
@@ -3047,8 +3053,9 @@ bool MIParser::parseMachineOperand(const unsigned OpCode, const unsigned OpIdx,
break;
} else if (Token.stringValue() == "CustomRegMask") {
return parseCustomRegisterMaskOperand(Dest);
- } else
+ } else {
return parseTypedImmediateOperand(Dest);
+ }
case MIToken::dot: {
const auto *TII = MF.getSubtarget().getInstrInfo();
if (const auto *Formatter = TII->getMIRFormatter()) {
@@ -3335,8 +3342,9 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {
return error(Loc, Msg);
}))
return true;
- } else
+ } else {
return error("unable to parse target custom pseudo source value");
+ }
break;
}
default:
More information about the llvm-commits
mailing list