Skip to content

Commit b415db0

Browse files
authored
[CIR] Add handlers for 'using enum' and namespace alias (#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.
1 parent 78e0c76 commit b415db0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,8 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
12581258
case Decl::Enum:
12591259
case Decl::Using: // using X; [C++]
12601260
case Decl::UsingDirective: // using namespace X; [C++]
1261+
case Decl::UsingEnum: // using enum X; [C++]
1262+
case Decl::NamespaceAlias:
12611263
case Decl::Typedef:
12621264
case Decl::TypeAlias: // using foo = bar; [C++11]
12631265
case Decl::Record:

clang/test/CIR/CodeGen/enum.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@ int f() {
1414

1515
// CHECK: cir.func{{.*}} @_Z1fv
1616
// CHECK: cir.const #cir.int<1> : !u32i
17+
18+
namespace test {
19+
using enum Numbers;
20+
};
21+
22+
int f2() {
23+
return test::Two;
24+
}
25+
26+
// CHECK: cir.func{{.*}} @_Z2f2v
27+
// CHECK: cir.const #cir.int<2> : !u32i

clang/test/CIR/CodeGen/namespace.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,11 @@ void f7() {
9393
}
9494

9595
// CHECK: cir.func{{.*}} @_Z2f7v()
96+
97+
namespace test_alias = test;
98+
99+
int f8() {
100+
return test_alias::g2;
101+
}
102+
103+
// CHECK: cir.func{{.*}} @_Z2f8v()

0 commit comments

Comments
 (0)