https://github.com/andykaylor created 
https://github.com/llvm/llvm-project/pull/148011

These decl types don't require any code generation, though when debug info is 
implemented, we will need to add handling for that. Until then, we just need to 
have a handler  so they don't generate an NYI error.

>From 624753dd0527e4c879956d45120ebdfa8729c9c8 Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akay...@nvidia.com>
Date: Fri, 6 Jun 2025 14:48:57 -0700
Subject: [PATCH] [CIR] Add handlers for 'using enum' and namespace alias

These decl types don't require any code generation, though when debug info
is implemented, we will need to add handling for that. Until then, we
just need to have a handler  so they don't generate an NYI error.
---
 clang/lib/CIR/CodeGen/CIRGenModule.cpp |  2 ++
 clang/test/CIR/CodeGen/enum.cpp        | 11 +++++++++++
 clang/test/CIR/CodeGen/namespace.cpp   |  8 ++++++++
 3 files changed, 21 insertions(+)

diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp 
b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index c1434ee697f4c..8b2883b50d2e2 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -1258,6 +1258,8 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
   case Decl::Enum:
   case Decl::Using:          // using X; [C++]
   case Decl::UsingDirective: // using namespace X; [C++]
+  case Decl::UsingEnum:      // using enum X; [C++]
+  case Decl::NamespaceAlias:
   case Decl::Typedef:
   case Decl::TypeAlias: // using foo = bar; [C++11]
   case Decl::Record:
diff --git a/clang/test/CIR/CodeGen/enum.cpp b/clang/test/CIR/CodeGen/enum.cpp
index 5d9b1057aaa14..247fa0a3bfd43 100644
--- a/clang/test/CIR/CodeGen/enum.cpp
+++ b/clang/test/CIR/CodeGen/enum.cpp
@@ -14,3 +14,14 @@ int f() {
 
 // CHECK: cir.func{{.*}} @_Z1fv
 // CHECK:    cir.const #cir.int<1> : !u32i
+
+namespace test {
+  using enum Numbers;
+};
+
+int f2() {
+  return test::Two;
+}
+
+// CHECK: cir.func{{.*}} @_Z2f2v
+// CHECK:    cir.const #cir.int<2> : !u32i
diff --git a/clang/test/CIR/CodeGen/namespace.cpp 
b/clang/test/CIR/CodeGen/namespace.cpp
index efae1f2f2f236..4c7812c61bfe4 100644
--- a/clang/test/CIR/CodeGen/namespace.cpp
+++ b/clang/test/CIR/CodeGen/namespace.cpp
@@ -93,3 +93,11 @@ void f7() {
 }
 
 // CHECK: cir.func{{.*}} @_Z2f7v()
+
+namespace test_alias = test;
+
+int f8() {
+  return test_alias::g2;
+}
+
+// CHECK: cir.func{{.*}} @_Z2f8v()

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to