[PATCH] D158021: [clang][modules] Mark builtin header 'inttypes.h' for modules
Ben Langmuir via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 14:02:04 PDT 2023
benlangmuir created this revision.
benlangmuir added reviewers: iana, jansvoboda11.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Like the other enumerated builtin headers, inttypes.h can be declared by another system module.
rdar://113924039
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158021
Files:
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/Inputs/System/usr/include/module.map
clang/test/Modules/cstd.m
Index: clang/test/Modules/cstd.m
===================================================================
--- clang/test/Modules/cstd.m
+++ clang/test/Modules/cstd.m
@@ -28,3 +28,11 @@
# error "bool was not defined!"
#endif
+// Supplied by compiler, which forwards to the "/usr/include" version.
+ at import cstd.inttypes;
+#ifndef __CLANG_INTTYPES_H
+#error "__CLANG_INTTYPES_H was not defined!"
+#endif
+#ifndef MY_PRIi32
+#error "MY_PRIi32 was not defined!"
+#endif
Index: clang/test/Modules/Inputs/System/usr/include/module.map
===================================================================
--- clang/test/Modules/Inputs/System/usr/include/module.map
+++ clang/test/Modules/Inputs/System/usr/include/module.map
@@ -4,6 +4,11 @@
header "float.h"
}
+ // In both directories (compiler support version wins, forwards)
+ module inttypes {
+ header "inttypes.h"
+ }
+
// Only in system headers directory
module stdio {
header "stdio.h"
Index: clang/lib/Lex/ModuleMap.cpp
===================================================================
--- clang/lib/Lex/ModuleMap.cpp
+++ clang/lib/Lex/ModuleMap.cpp
@@ -379,6 +379,7 @@
bool ModuleMap::isBuiltinHeader(StringRef FileName) {
return llvm::StringSwitch<bool>(FileName)
.Case("float.h", true)
+ .Case("inttypes.h", true)
.Case("iso646.h", true)
.Case("limits.h", true)
.Case("stdalign.h", true)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158021.550463.patch
Type: text/x-patch
Size: 1433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230815/87b57207/attachment.bin>
More information about the cfe-commits
mailing list