Clang Project

clang_source_code/test/Modules/global-init.cpp
1// RUN: rm -rf %t
2// RUN: mkdir %t
3//
4// RUN: echo '#pragma once' > %t/a.h
5// RUN: echo 'struct A { A() {} int f() const; } const a;' >> %t/a.h
6//
7// RUN: echo '#include "a.h"' > %t/b.h
8//
9// RUN: echo 'module M { module b { header "b.h" export * } module a { header "a.h" export * } }' > %t/map
10//
11// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%t/map -I%t %s -emit-llvm -o - -triple %itanium_abi_triple | FileCheck %s
12
13#include "b.h"
14
15// CHECK: @_ZL1a = internal global
16// CHECK: call {{.*}} @_ZN1AC1Ev({{.*}}@_ZL1a
17// CHECK: call {{.*}} @_ZNK1A1fEv({{.*}}@_ZL1a
18// CHECK: store {{.*}} @x
19int x = a.f();
20