Clang Project

clang_source_code/test/CodeGenCXX/attr-target-mv-modules.cpp
1// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fmodules -emit-llvm %s -o - | FileCheck %s
2#pragma clang module build A
3module A {}
4#pragma clang module contents
5#pragma clang module begin A
6__attribute__((target("default"))) void f();
7__attribute__((target("sse4.2"))) void f();
8#pragma clang module end
9#pragma clang module endbuild
10
11#pragma clang module build B
12module B {}
13#pragma clang module contents
14#pragma clang module begin B
15__attribute__((target("default"))) void f();
16__attribute__((target("sse4.2"))) void f();
17#pragma clang module end
18#pragma clang module endbuild
19
20#pragma clang module import A
21#pragma clang module import B
22void g() { f(); }
23
24// Negative tests to validate that the resolver only calls each 1x.
25// CHECK: define void ()* @_Z1fv.resolver
26// CHECK: ret void ()* @_Z1fv.sse4.2
27// CHECK-NOT: ret void ()* @_Z1fv.sse4.2
28// CHECK: ret void ()* @_Z1fv
29// CHECK-NOT: ret void ()* @_Z1fv
30