Skip to content

Commit 8886dbe

Browse files
committed
reduce module issue
1 parent eeb987f commit 8886dbe

File tree

8 files changed

+161
-0
lines changed

8 files changed

+161
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "flume_test_utils.h"
2+
struct S {};
3+
4+
void foo() {
5+
N::Friend<S>({});
6+
}

module-reproducer/args.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
libA_pcm=$(mktemp)
2+
libB_pcm=$(mktemp)
3+
lib_core_pcm=$(mktemp)
4+
5+
CLANG_BIN="/usr/local/google/home/usx/build/bin/clang++"
6+
7+
${CLANG_BIN} \
8+
-fno-exceptions \
9+
-I . \
10+
-funsigned-char \
11+
-fnew-alignment=8 \
12+
-fcoro-aligned-allocation \
13+
-fmodule-name=lib_core \
14+
-Xclang=-fmodule-map-file-home-is-cwd \
15+
-xc++ \
16+
-Xclang=-emit-module \
17+
-pthread \
18+
-std=gnu++20 \
19+
-c \
20+
module-reproducer/lib_core.cppmap \
21+
-o \
22+
${lib_core_pcm} \
23+
&& \
24+
${CLANG_BIN} \
25+
-iquote \
26+
. \
27+
-fno-exceptions \
28+
-funsigned-char \
29+
-fnew-alignment=8 \
30+
-fcoro-aligned-allocation \
31+
-fmodule-name=libB \
32+
-Xclang=-fmodule-map-file-home-is-cwd \
33+
-xc++ \
34+
-Xclang=-emit-module \
35+
-Xclang=-fmodule-file=${lib_core_pcm} \
36+
-pthread \
37+
-std=gnu++20 \
38+
-c \
39+
module-reproducer/libB.cppmap \
40+
-o \
41+
${libB_pcm} \
42+
&& \
43+
${CLANG_BIN} \
44+
-fno-exceptions \
45+
-funsigned-char \
46+
-fnew-alignment=8 \
47+
-fcoro-aligned-allocation \
48+
-fmodule-name=libA \
49+
-Xclang=-fmodule-map-file-home-is-cwd \
50+
-xc++ \
51+
-Xclang=-emit-module \
52+
-Xclang=-fmodule-file=${libB_pcm} \
53+
-pthread \
54+
-std=gnu++20 \
55+
-c \
56+
module-reproducer/libA.cppmap \
57+
-o \
58+
${libA_pcm} \
59+
&& \
60+
${CLANG_BIN} \
61+
-iquote \
62+
. \
63+
-fno-exceptions \
64+
-funsigned-char \
65+
-fnew-alignment=8 \
66+
-fcoro-aligned-allocation \
67+
-Xclang=-fmodule-file=${libA_pcm} \
68+
-pthread \
69+
-std=gnu++20 \
70+
module-reproducer/access_boundaries_test.cc

module-reproducer/flume.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef FLUME_H_
2+
#define FLUME_H_
3+
4+
#include "stream.h"
5+
6+
#endif // FLUME_H_

module-reproducer/flume_test_utils.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#ifndef FLUME_TEST_UTIL_H_
2+
#define FLUME_TEST_UTIL_H_
3+
4+
// #include <string>
5+
#include <vector>
6+
7+
template <typename T>
8+
class Stream;
9+
10+
namespace N {
11+
template <typename T>
12+
std::vector<T> Friend(Stream<T> stream);
13+
} // namespace N
14+
15+
template <typename T>
16+
class Stream {
17+
template <typename V>
18+
friend std::vector<V> N::Friend(Stream<V> stream);
19+
};
20+
21+
namespace N {
22+
23+
template <typename T>
24+
std::vector<T> Friend(Stream<T> stream) {
25+
std::vector<T> ret;
26+
return ret;
27+
}
28+
29+
} // namespace N
30+
31+
#endif // FLUME_TEST_UTIL_H_

module-reproducer/libA.cppmap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module "libA" {
2+
export *
3+
module "module-reproducer/flume_test_utils.h" {
4+
export *
5+
header "module-reproducer/flume_test_utils.h"
6+
}
7+
}

module-reproducer/libB.cppmap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "libB" {
2+
export *
3+
module "module-reproducer/flume.h" {
4+
export *
5+
header "module-reproducer/flume.h"
6+
}
7+
module "module-reproducer/flume_test_utils.h" {
8+
export *
9+
header "module-reproducer/flume_test_utils.h"
10+
}
11+
}

module-reproducer/lib_core.cppmap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module "lib_core" {
2+
export *
3+
module "module-reproducer/stream.h" {
4+
export *
5+
header "module-reproducer/stream.h"
6+
}
7+
}

module-reproducer/stream.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef STREAM_H_
2+
#define STREAM_H_
3+
4+
#include <string>
5+
#include <vector>
6+
7+
template <typename T>
8+
class Stream;
9+
10+
namespace N {
11+
template <typename T>
12+
std::vector<T> Friend(Stream<T> stream);
13+
} // namespace N
14+
15+
template <typename T>
16+
class Stream {
17+
template <typename V>
18+
friend std::vector<V> N::Friend(Stream<V> stream);
19+
};
20+
21+
Stream<std::string> Bar() { return Stream<std::string>(); }
22+
23+
#endif // STREAM_H_

0 commit comments

Comments
 (0)