forked from swiftlang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cherry-pick stable/20230725] [Modules] no_undeclared_includes module…
…s (Apple Darwin) don't work the clang modules llvm#68241 rdar://105819340
- Loading branch information
1 parent
9978a37
commit 13b4460
Showing
16 changed files
with
203 additions
and
69 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1 @@ | ||
#ifndef STDINT_H | ||
#define STDINT_H | ||
|
||
typedef int my_awesome_nonstandard_integer_type; | ||
|
||
// types needed by stdatomic.h | ||
|
||
typedef char int_least8_t; | ||
typedef short int_least16_t; | ||
typedef int int_least32_t; | ||
typedef long long int int_least64_t; | ||
typedef unsigned char uint_least8_t; | ||
typedef unsigned short uint_least16_t; | ||
typedef unsigned int uint_least32_t; | ||
typedef unsigned long long uint_least64_t; | ||
|
||
typedef char int_fast8_t; | ||
typedef short int_fast16_t; | ||
typedef int int_fast32_t; | ||
typedef long long int int_fast64_t; | ||
typedef unsigned char uint_fast8_t; | ||
typedef unsigned short uint_fast16_t; | ||
typedef unsigned int uint_fast32_t; | ||
typedef unsigned long long uint_fast64_t; | ||
|
||
typedef int intptr_t; | ||
typedef unsigned int uintptr_t; | ||
typedef int intmax_t; | ||
typedef unsigned int uintmax_t; | ||
|
||
// additional types for unwind.h | ||
|
||
typedef unsigned int uint32_t; | ||
typedef unsigned long long uint64_t; | ||
|
||
#endif /* STDINT_H */ |
29 changes: 29 additions & 0 deletions
29
clang/test/Modules/Inputs/builtin-headers/builtin-modules.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module c_complex [system] { | ||
header "complex.h" | ||
export * | ||
} | ||
|
||
module c_float [system] { | ||
header "float.h" | ||
export * | ||
} | ||
|
||
module c_inttypes [system] { | ||
header "inttypes.h" | ||
export * | ||
} | ||
|
||
module c_limits [system] { | ||
header "limits.h" | ||
export * | ||
} | ||
|
||
module c_math [system] { | ||
header "math.h" | ||
export * | ||
} | ||
|
||
module c_stdint [system] { | ||
header "stdint.h" | ||
export * | ||
} |
4 changes: 4 additions & 0 deletions
4
clang/test/Modules/Inputs/builtin-headers/c++/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module cpp_stdint [system] { | ||
header "stdint.h" | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef CPP_STDINT_H | ||
#define CPP_STDINT_H | ||
|
||
#include_next <stdint.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Required by tgmath.h |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef INTTYPES_H | ||
#define INTTYPES_H | ||
|
||
// This creates an include cycle when inttypes.h and stdint.h | ||
// are both part of the cstd module. This include will resolve | ||
// to the C++ stdint.h, which will #include_next eventually to | ||
// the stdint.h in this directory, and thus create the cycle | ||
// cstd (inttypes.h) -> cpp_stdint (stdint.h) -> cstd (stdint.h). | ||
// This cycle is worked around by cstd using [no_undeclared_includes]. | ||
#include <stdint.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Required by tgmath.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef STDINT_H | ||
#define STDINT_H | ||
|
||
// types needed by stdatomic.h | ||
|
||
typedef char int_least8_t; | ||
typedef short int_least16_t; | ||
typedef int int_least32_t; | ||
typedef long long int int_least64_t; | ||
typedef unsigned char uint_least8_t; | ||
typedef unsigned short uint_least16_t; | ||
typedef unsigned int uint_least32_t; | ||
typedef unsigned long long uint_least64_t; | ||
|
||
typedef char int_fast8_t; | ||
typedef short int_fast16_t; | ||
typedef int int_fast32_t; | ||
typedef long long int int_fast64_t; | ||
typedef unsigned char uint_fast8_t; | ||
typedef unsigned short uint_fast16_t; | ||
typedef unsigned int uint_fast32_t; | ||
typedef unsigned long long uint_fast64_t; | ||
|
||
typedef int intptr_t; | ||
typedef unsigned int uintptr_t; | ||
typedef int intmax_t; | ||
typedef unsigned int uintmax_t; | ||
|
||
// additional types for unwind.h | ||
|
||
typedef unsigned int uint32_t; | ||
typedef unsigned long long uint64_t; | ||
|
||
#endif |
71 changes: 71 additions & 0 deletions
71
clang/test/Modules/Inputs/builtin-headers/system-modules.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module cstd [system] [no_undeclared_includes] { | ||
module complex { | ||
header "complex.h" | ||
export * | ||
} | ||
|
||
module float { | ||
header "float.h" | ||
export * | ||
} | ||
|
||
module inttypes { | ||
header "inttypes.h" | ||
export * | ||
} | ||
|
||
module iso646 { | ||
header "iso646.h" | ||
export * | ||
} | ||
|
||
module limits { | ||
header "limits.h" | ||
export * | ||
} | ||
|
||
module math { | ||
header "math.h" | ||
export * | ||
} | ||
|
||
module stdalign { | ||
header "stdalign.h" | ||
export * | ||
} | ||
|
||
module stdarg { | ||
header "stdarg.h" | ||
export * | ||
} | ||
|
||
module stdatomic { | ||
header "stdatomic.h" | ||
export * | ||
} | ||
|
||
module stdbool { | ||
header "stdbool.h" | ||
export * | ||
} | ||
|
||
module stddef { | ||
header "stddef.h" | ||
export * | ||
} | ||
|
||
module stdint { | ||
header "stdint.h" | ||
export * | ||
} | ||
|
||
module tgmath { | ||
header "tgmath.h" | ||
export * | ||
} | ||
|
||
module unwind { | ||
header "unwind.h" | ||
export * | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// RUN: rm -rf %t | ||
// RUN: %clang_cc1 -cxx-isystem %S/Inputs/builtin-headers/c++ -internal-isystem %S/Inputs/builtin-headers -fsyntax-only -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/builtin-headers/c++/module.modulemap -fmodule-map-file=%resource_dir/module.modulemap -fmodule-map-file=%S/Inputs/builtin-headers/system-modules.modulemap -fbuiltin-headers-in-system-modules -DSYSTEM_MODULES %s -verify | ||
// RUN: rm -rf %t | ||
// RUN: %clang_cc1 -cxx-isystem %S/Inputs/builtin-headers/c++ -internal-isystem %S/Inputs/builtin-headers -fsyntax-only -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/builtin-headers/c++/module.modulemap -fmodule-map-file=%resource_dir/module.modulemap -fmodule-map-file=%S/Inputs/builtin-headers/builtin-modules.modulemap %s -verify | ||
|
||
// expected-no-diagnostics | ||
|
||
@import cpp_stdint; | ||
|
||
// The builtin modules are always available, though they're mostly | ||
// empty if -fbuiltin-headers-in-system-modules is used. | ||
@import _Builtin_float; | ||
@import _Builtin_inttypes; | ||
@import _Builtin_iso646; | ||
@import _Builtin_limits; | ||
@import _Builtin_stdalign; | ||
@import _Builtin_stdarg; | ||
@import _Builtin_stdatomic; | ||
@import _Builtin_stdbool; | ||
@import _Builtin_stddef; | ||
@import _Builtin_stdint; | ||
@import _Builtin_stdnoreturn; | ||
@import _Builtin_tgmath; | ||
@import _Builtin_unwind; | ||
|
||
#ifdef SYSTEM_MODULES | ||
// system-modules.modulemap uses the "mega module" style with | ||
// -fbuiltin-headers-in-system-modules, and its modules cover | ||
// the clang builtin headers. | ||
@import cstd; | ||
#else | ||
// builtin-modules.modulemap uses top level modules for each | ||
// of its headers, which allows interleaving with the builtin | ||
// modules and libc++ modules. | ||
@import c_complex; | ||
@import c_float; | ||
@import c_inttypes; | ||
@import c_limits; | ||
@import c_math; | ||
@import c_stdint; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters