Skip to content

[CIR][NFC] Fix warning about unhandled Decl #140159

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

andykaylor
Copy link
Contributor

This fixes a warning about an unhandled Decl that was recently introduced. While adding the new decl, I noticed that one of the others that was in the "NYI" group belonged in the "unreachable" group, so I moved it also.

This fixes a warning about an unhandled Decl that was recently introduced.
While adding the new decl, I noticed that one of the others that was on
the "NYI" case belonged on the "unreachable" case, so I moved it also.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels May 15, 2025
@llvmbot
Copy link
Member

llvmbot commented May 15, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clangir

Author: Andy Kaylor (andykaylor)

Changes

This fixes a warning about an unhandled Decl that was recently introduced. While adding the new decl, I noticed that one of the others that was in the "NYI" group belonged in the "unreachable" group, so I moved it also.


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

1 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenDecl.cpp (+2-1)
diff --git a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
index 498d7533c2204..61af33053dc0a 100644
--- a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp
@@ -322,6 +322,8 @@ void CIRGenFunction::emitDecl(const Decl &d) {
   case Decl::ObjCTypeParam:
   case Decl::Binding:
   case Decl::UnresolvedUsingIfExists:
+  case Decl::HLSLBuffer:
+  case Decl::HLSLRootSignature:
     llvm_unreachable("Declaration should not be in declstmts!");
 
   case Decl::Function:     // void X();
@@ -374,7 +376,6 @@ void CIRGenFunction::emitDecl(const Decl &d) {
     return;
   }
   case Decl::ImplicitConceptSpecialization:
-  case Decl::HLSLBuffer:
   case Decl::TopLevelStmt:
   case Decl::UsingPack:
   case Decl::Decomposition: // This could be moved to join Decl::Var

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

Is this fixing this warning?

/local/home/ekeane/llvm-project/clang/lib/CIR/CodeGen/CIRGenDecl.cpp:270:11: warning: enumeration value 'HLSLRootSignature' not handled in switch [-Wswitch]

@andykaylor
Copy link
Contributor Author

Is this fixing this warning?

/local/home/ekeane/llvm-project/clang/lib/CIR/CodeGen/CIRGenDecl.cpp:270:11: warning: enumeration value 'HLSLRootSignature' not handled in switch [-Wswitch]

Yes

@andykaylor andykaylor merged commit 2f5a24d into llvm:main May 16, 2025
14 checks passed
@andykaylor andykaylor deleted the fix-hlsl-warning branch May 16, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants