xref: /llvm-project/clang/test/Modules/enum-codegen.cpp (revision d2c26d82b0395b8b555be384ed778361ec176c14)
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fmodules-cache-path=%t %s -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fmodules-cache-path=%t %s -emit-llvm -o - -fexperimental-new-constant-interpreter | FileCheck %s
4 
5 // CHECK: @{{.*var.*}} = {{.*}} %union.union_type { i8 1 },
6 
7 #pragma clang module build bar
8 module bar {
9   header "bar.h" { size 40 mtime 0 }
10   export *
11 }
12 #pragma clang module contents
13 #pragma clang module begin bar
14 union union_type {
15   char h{1};
16 };
17 #pragma clang module end
18 #pragma clang module endbuild
19 #pragma clang module build foo
20 module foo {
21   header "foo.h" { size 97 mtime 0 }
22   export *
23 }
24 #pragma clang module contents
25 #pragma clang module begin foo
26 union union_type {
27   char h{1};
28 };
29 #pragma clang module import bar
30 template<typename T>
31 union_type var;
32 #pragma clang module end
33 #pragma clang module endbuild
34 #pragma clang module import foo
35 int main() {
36   (void)&var<int>;
37 }
38