xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/lookup.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc 
2f4a2713aSLionel Sambuc #define import @import
3f4a2713aSLionel Sambuc import lookup_left_cxx;
4f4a2713aSLionel Sambuc #undef import
5f4a2713aSLionel Sambuc #define IMPORT(X) @import X
6f4a2713aSLionel Sambuc IMPORT(lookup_right_cxx);
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc // expected-warning@Inputs/lookup_left.hpp:3 {{weak identifier 'weak_identifier' never declared}}
9f4a2713aSLionel Sambuc 
test(int i,float f)10f4a2713aSLionel Sambuc void test(int i, float f) {
11f4a2713aSLionel Sambuc   // unqualified lookup
12f4a2713aSLionel Sambuc   f0(&i);
13f4a2713aSLionel Sambuc   f0(&f);
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc   // qualified lookup into the translation unit
16f4a2713aSLionel Sambuc   ::f0(&i);
17f4a2713aSLionel Sambuc   ::f0(&f);
18f4a2713aSLionel Sambuc }
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc int import;
21f4a2713aSLionel Sambuc 
f()22f4a2713aSLionel Sambuc void f() {
23f4a2713aSLionel Sambuc  int import;
24f4a2713aSLionel Sambuc }
25f4a2713aSLionel Sambuc 
26f4a2713aSLionel Sambuc // RUN: rm -rf %t
27f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify
28f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify
29*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify
30*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix=CHECK-PRINT %s
31f4a2713aSLionel Sambuc // FIXME: When we have a syntax for modules in C++, use that.
32f4a2713aSLionel Sambuc 
33f4a2713aSLionel Sambuc // CHECK-PRINT: int *f0(int *);
34f4a2713aSLionel Sambuc // CHECK-PRINT: float *f0(float *);
35f4a2713aSLionel Sambuc // CHECK-PRINT: void test(int i, float f)
36f4a2713aSLionel Sambuc 
37