[llvm] b47cdc6 - [MC] Replace single-case switch with an if (NFC)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 22 17:09:56 PST 2023


Author: Sergei Barannikov
Date: 2023-01-23T04:09:07+03:00
New Revision: b47cdc6ce8c17de4df30e2cc70cb2512b36663bf

URL: https://github.com/llvm/llvm-project/commit/b47cdc6ce8c17de4df30e2cc70cb2512b36663bf
DIFF: https://github.com/llvm/llvm-project/commit/b47cdc6ce8c17de4df30e2cc70cb2512b36663bf.diff

LOG: [MC] Replace single-case switch with an if (NFC)

Same as e5f746e9 but for MasmParser.

Added: 
    

Modified: 
    llvm/lib/MC/MCParser/MasmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index e7e1d598a924..5c78cfe4e743 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -2225,11 +2225,10 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
 
   // FIXME: Recurse on local labels?
 
-  // See what kind of statement we have.
-  switch (Lexer.getKind()) {
-  case AsmToken::Colon: {
-    if (!getTargetParser().isLabel(ID))
-      break;
+  // Check for a label.
+  //   ::= identifier ':'
+  //   ::= number ':'
+  if (Lexer.is(AsmToken::Colon) && getTargetParser().isLabel(ID)) {
     if (checkForValidSection())
       return true;
 
@@ -2295,10 +2294,6 @@ bool MasmParser::parseStatement(ParseStatementInfo &Info,
     return false;
   }
 
-  default: // Normal instruction or directive.
-    break;
-  }
-
   // If macros are enabled, check to see if this is a macro instantiation.
   if (const MCAsmMacro *M = getContext().lookupMacro(IDVal.lower())) {
     return handleMacroEntry(M, IDLoc);


        


More information about the llvm-commits mailing list