[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 11:09:27 PDT 2024


================
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) {
     if (Requested->isSubModuleOf(Use))
       return true;
 
-  // Anyone is allowed to use our builtin stdarg.h and stddef.h and their
-  // accompanying modules.
-  if (Requested->getTopLevelModuleName() == "_Builtin_stdarg" ||
-      Requested->getTopLevelModuleName() == "_Builtin_stddef")
+  // Anyone is allowed to use our builtin stddef.h and its accompanying modules.
+  if (Requested->fullModuleNameIs({"_Builtin_stddef", "max_align_t"}) ||
+      Requested->fullModuleNameIs({"_Builtin_stddef_wint_t"}))
----------------
ian-twilightcoder wrote:

When `-fbuiltin-headers-in-system-modules` is set, the module map parser doesn't add any headers to the `_Builtin` modules except for __stddef_max_align_t.h and __stddef_wint_t.h.

https://github.com/llvm/llvm-project/pull/84127


More information about the cfe-commits mailing list