diff options
author | Ian Anderson <iana@apple.com> | 2023-09-06 22:57:40 -0700 |
---|---|---|
committer | Ian Anderson <iana@apple.com> | 2023-10-03 12:41:11 -0700 |
commit | 9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4 (patch) | |
tree | 9ad129f68bce41653ece3af54432783cfab7e8a3 /clang/lib/Basic/Module.cpp | |
parent | 8763aa034068f17eb160c8f0b1de92fca136a56f (diff) | |
download | llvm-9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4.zip llvm-9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4.tar.gz llvm-9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4.tar.bz2 |
[Modules] Make clang modules for the C standard library headers
Make top level modules for all the C standard library headers.
The `__stddef` implementation headers need header guards now that they're all modular. stdarg.h and stddef.h will be textual headers in the builtin modules, and so need to be repeatedly included in both the system and builtin module case. Define their header guards for consistency, but ignore them when building with modules.
`__stddef_null.h` needs to ignore its header guard when modules aren't being used to fulfill its redefinition obligation.
`__stddef_nullptr_t.h` needs to add a guard for C23 so that `_Builtin_stddef` can compile in C17 and earlier modes. `_Builtin_stddef.nullptr_t` can't require C23 because it also needs to be usable from C++.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D159064
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 0455304..0fd9c1d 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -299,8 +299,9 @@ bool Module::directlyUses(const Module *Requested) { if (Requested->isSubModuleOf(Use)) return true; - // Anyone is allowed to use our builtin stddef.h and its accompanying module. - if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t") + // Anyone is allowed to use our builtin stdarg.h and stddef.h and their + // accompanying modules. + if (!Requested->Parent && (Requested->Name == "_Builtin_stdarg" || Requested->Name == "_Builtin_stddef")) return true; if (NoUndeclaredIncludes) |