clang/test/CIR/CodeGen/enum.cpp
raw| 1 | // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
| 2 | // RUN: FileCheck %s --input-file=%t.cir |
| 3 | |
| 4 | enum Numbers { |
| 5 | Zero, |
| 6 | One, |
| 7 | Two, |
| 8 | Three |
| 9 | }; |
| 10 | |
| 11 | int f() { |
| 12 | return Numbers::One; |
| 13 | } |
| 14 | |
| 15 | // CHECK: cir.func{{.*}} @_Z1fv |
| 16 | // CHECK: cir.const #cir.int<1> : !s32i |
| 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> : !s32i |