Skip to content

Commit 13b4460

Browse files
git apple-llvm automergerian-twilightcoder
authored andcommitted
[cherry-pick stable/20230725] [Modules] no_undeclared_includes modules (Apple Darwin) don't work the clang modules
llvm#68241 rdar://105819340
1 parent 9978a37 commit 13b4460

File tree

16 files changed

+203
-69
lines changed

16 files changed

+203
-69
lines changed

clang/test/Modules/Inputs/System/usr/include/inttypes.h

Whitespace-only changes.

clang/test/Modules/Inputs/System/usr/include/math.h

Whitespace-only changes.

clang/test/Modules/Inputs/System/usr/include/module.map

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
module cstd [system] {
2-
// Only in system headers directory
3-
module complex {
4-
header "complex.h"
5-
}
6-
72
// Only in compiler support directory
83
module float_constants {
94
header "float.h"
105
}
116

12-
// In both directories (compiler support version wins, forwards)
13-
module inttypes {
14-
header "inttypes.h"
15-
}
16-
17-
// Only in system headers directory
18-
module math {
19-
header "math.h"
20-
}
21-
227
// Only in system headers directory
238
module stdio {
249
header "stdio.h"
Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1 @@
1-
#ifndef STDINT_H
2-
#define STDINT_H
3-
41
typedef int my_awesome_nonstandard_integer_type;
5-
6-
// types needed by stdatomic.h
7-
8-
typedef char int_least8_t;
9-
typedef short int_least16_t;
10-
typedef int int_least32_t;
11-
typedef long long int int_least64_t;
12-
typedef unsigned char uint_least8_t;
13-
typedef unsigned short uint_least16_t;
14-
typedef unsigned int uint_least32_t;
15-
typedef unsigned long long uint_least64_t;
16-
17-
typedef char int_fast8_t;
18-
typedef short int_fast16_t;
19-
typedef int int_fast32_t;
20-
typedef long long int int_fast64_t;
21-
typedef unsigned char uint_fast8_t;
22-
typedef unsigned short uint_fast16_t;
23-
typedef unsigned int uint_fast32_t;
24-
typedef unsigned long long uint_fast64_t;
25-
26-
typedef int intptr_t;
27-
typedef unsigned int uintptr_t;
28-
typedef int intmax_t;
29-
typedef unsigned int uintmax_t;
30-
31-
// additional types for unwind.h
32-
33-
typedef unsigned int uint32_t;
34-
typedef unsigned long long uint64_t;
35-
36-
#endif /* STDINT_H */
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module c_complex [system] {
2+
header "complex.h"
3+
export *
4+
}
5+
6+
module c_float [system] {
7+
header "float.h"
8+
export *
9+
}
10+
11+
module c_inttypes [system] {
12+
header "inttypes.h"
13+
export *
14+
}
15+
16+
module c_limits [system] {
17+
header "limits.h"
18+
export *
19+
}
20+
21+
module c_math [system] {
22+
header "math.h"
23+
export *
24+
}
25+
26+
module c_stdint [system] {
27+
header "stdint.h"
28+
export *
29+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module cpp_stdint [system] {
2+
header "stdint.h"
3+
export *
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef CPP_STDINT_H
2+
#define CPP_STDINT_H
3+
4+
#include_next <stdint.h>
5+
6+
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Required by tgmath.h
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef INTTYPES_H
2+
#define INTTYPES_H
3+
4+
// This creates an include cycle when inttypes.h and stdint.h
5+
// are both part of the cstd module. This include will resolve
6+
// to the C++ stdint.h, which will #include_next eventually to
7+
// the stdint.h in this directory, and thus create the cycle
8+
// cstd (inttypes.h) -> cpp_stdint (stdint.h) -> cstd (stdint.h).
9+
// This cycle is worked around by cstd using [no_undeclared_includes].
10+
#include <stdint.h>
11+
12+
#endif

0 commit comments

Comments
 (0)