-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Modules] Add 'no_undeclared_includes' module map attribute
The 'no_undeclared_includes' attribute should be used in a module to tell that only non-modular headers and headers from used modules are accepted. The main motivation behind this is to prevent dep cycles between system libraries (such as darwin) and libc++. Patch by Richard Smith! llvm-svn: 284797
- Loading branch information
1 parent
d15477b
commit ed84df0
Showing
28 changed files
with
196 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
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 +1 @@ | ||
// Testing hack: does not define bool/true/false. | ||
#include_next <stdbool.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,2 @@ | ||
#include_next <math.h> | ||
template<typename T> T abs(T t) { return (t < 0) ? -t : t; } |
4 changes: 4 additions & 0 deletions
4
clang/test/Modules/Inputs/libc-libcxx/include/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 "libc++" { | ||
module math { header "math.h" export * } | ||
module stdlib { header "stdlib.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 @@ | ||
#include_next "stdlib.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 @@ | ||
int abs(int); |
4 changes: 4 additions & 0 deletions
4
clang/test/Modules/Inputs/libc-libcxx/include/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 libc [no_undeclared_includes] { | ||
module math { header "math.h" export * } | ||
module stdlib { header "stdlib.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 @@ | ||
#include <math.h> |
6 changes: 6 additions & 0 deletions
6
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/__config
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 _LIBCPP_CONFIG | ||
#define _LIBCPP_CONFIG | ||
|
||
#define __LIBCXX_CONFIG | ||
|
||
#endif |
7 changes: 7 additions & 0 deletions
7
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.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,7 @@ | ||
#ifndef LIBCXX_MATH_H | ||
#define LIBCXX_MATH_H | ||
|
||
#include_next <math.h> | ||
template<typename T> T abs(T t) { return (t < 0) ? -t : t; } | ||
|
||
#endif |
7 changes: 7 additions & 0 deletions
7
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/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,7 @@ | ||
module "libc++" { | ||
module math { header "math.h" export * } | ||
module stdlib { header "stdlib.h" export * } | ||
module stddef { header "stddef.h" export * } | ||
module stdio { textual header "stdio.h" export * } | ||
module __config { header "__config" export * } | ||
} |
6 changes: 6 additions & 0 deletions
6
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.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,6 @@ | ||
#ifndef LIBCXX_STDDEF_H | ||
#define LIBCXX_STDDEF_H | ||
|
||
#include <__config> | ||
|
||
#endif |
6 changes: 6 additions & 0 deletions
6
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdio.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,6 @@ | ||
#ifndef LIBCXX_STDIO_H | ||
#define LIBCXX_STDIO_H | ||
|
||
#include <__config> | ||
|
||
#endif |
6 changes: 6 additions & 0 deletions
6
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdlib.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,6 @@ | ||
#ifndef LIBCXX_STDLIB_H | ||
#define LIBCXX_STDLIB_H | ||
|
||
#include_next "stdlib.h" | ||
|
||
#endif |
1 change: 1 addition & 0 deletions
1
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/math.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 @@ | ||
int abs(int); |
9 changes: 9 additions & 0 deletions
9
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/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,9 @@ | ||
module libc [no_undeclared_includes] { | ||
module math { header "math.h" export * } | ||
module stdlib { header "stdlib.h" export * } | ||
module stdatomic { header "stdatomic.h" export * } | ||
module stddef { header "stddef.h" export * } | ||
module stdint { header "stdint.h" export * } | ||
module stdio { header "stdio.h" export * } | ||
module util { header "util.h" export * } | ||
} |
2 changes: 2 additions & 0 deletions
2
clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.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,2 @@ | ||
// stddef.h | ||
#include_next "stddef.h" |
Oops, something went wrong.