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