Skip to content

[NFC][MC][GOFF] Use llvm_unreachable for unreachable case #152930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

abhishek-kaushik22
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the mc Machine (object) code label Aug 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 10, 2025

@llvm/pr-subscribers-mc

Author: Abhishek Kaushik (abhishek-kaushik22)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/152930.diff

1 Files Affected:

  • (modified) llvm/lib/MC/MCAsmInfoGOFF.cpp (+1-1)
diff --git a/llvm/lib/MC/MCAsmInfoGOFF.cpp b/llvm/lib/MC/MCAsmInfoGOFF.cpp
index 0a5d1927b1a22..d0f931d03d532 100644
--- a/llvm/lib/MC/MCAsmInfoGOFF.cpp
+++ b/llvm/lib/MC/MCAsmInfoGOFF.cpp
@@ -72,7 +72,7 @@ static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
       OS << "64";
       break;
     case GOFF::ESD_RMODE_None:
-      break;
+      llvm_unreachable("GOFF::ESD_RMODE_None should not be handled here");
     }
     OS << ')';
   }

@@ -72,7 +72,7 @@ static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
OS << "64";
break;
case GOFF::ESD_RMODE_None:
break;
llvm_unreachable("GOFF::ESD_RMODE_None should not be handled here");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move GOFF::ESD_RMODE_None: above to make it clear that this case has already been handled and use an empty llvm_unreachable as it's obvious.

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title can mention GOFF

@abhishek-kaushik22 abhishek-kaushik22 changed the title [NFC][MC] Use llvm_unreachable for unreachable case [NFC][MC][GOFF] Use llvm_unreachable for unreachable case Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants