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. +@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)
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. +@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)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits