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
3 module 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
12 module 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
g()22 void g() { f(); }
23 
24 // Negative tests to validate that the resolver only calls each 1x.
25 // CHECK: define weak_odr 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