Debian Codegraph @

clang/test/Modules/GH170084.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 // RUN: cd %t
5
6 // RUN: %clang_cc1 -fmodule-name=stl -fno-cxx-modules -emit-module -fmodules -xc++ stl.cppmap -o stl.pcm
7 // RUN: %clang_cc1 -fmodule-name=d -fno-cxx-modules -emit-module -fmodules -fmodule-file=stl.pcm -xc++ d.cppmap -o d.pcm
8 // RUN: %clang_cc1 -fmodule-name=b -fno-cxx-modules -emit-module -fmodules -fmodule-file=stl.pcm -xc++ b.cppmap -o b.pcm
9 // RUN: %clang_cc1 -fmodule-name=a -fno-cxx-modules -emit-module -fmodules -fmodule-file=stl.pcm -fmodule-file=d.pcm -fmodule-file=b.pcm -xc++ a.cppmap -o a.pcm
10 // RUN: %clang_cc1 -fno-cxx-modules -fmodules -fmodule-file=a.pcm -emit-llvm -o /dev/null main.cpp
11
12 //--- a.cppmap
13 module "a" {
14 header "a.h"
15 }
16
17 //--- a.h
18 #include "b.h"
19 namespace {
20 void a(absl::set<char> c) {
21 absl::set<int> b;
22 c.end();
23 c.contains();
24 }
25 } // namespace
26
27 //--- b.cppmap
28 module "b" {
29 header "b.h"
30 }
31
32 //--- b.h
33 #include "c.h"
34 void b() { absl::set<char> x; }
35
36 //--- c.h
37 #include "stl.h"
38 namespace absl {
39 template <typename>
40 class set {
41 public:
42 struct iterator {
43 void u() const;
44 };
45 iterator end() const { return {}; }
46 void contains() const { end().u(); }
47 pair<iterator> e();
48 };
49 } // namespace absl
50
51 //--- d.cppmap
52 module "d" {
53 header "d.h"
54 }
55
56 //--- d.h
57 #include "c.h"
58 void d() { absl::set<char> x; }
59
60 //--- stl.cppmap
61 module "stl" {
62 header "stl.h"
63 }
64
65 //--- stl.h
66 #ifndef _STL_H_
67 #define _STL_H_
68 template <class>
69 struct pair;
70 #endif
71
72 //--- main.cpp
73 // expected-no-diagnostics
74 #include "c.h"
75 void f(absl::set<char> o) { o.contains(); }