================
@@ -2376,6 +2376,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, 
unsigned ID,
   FunctionDecl *New = CreateBuiltin(II, R, ID, Loc);
   RegisterLocallyScopedExternCDecl(New, S);
 
+  // Builtin functions shouldn't be owned by any module.
+  if (New->hasOwningModule()) {
+    New->setLocalOwningModule(nullptr);
----------------
mizvekov wrote:
Since as you pointed out we already have this oddness for eagerly created 
implicit declarations, it seems like it would be an incremental improvement to 
have the same non-ideal outcome for both.

But I think the means to achieve it as implemented in the current patch looks 
fragile.

As Corentin suggested, I'd rather change the context around when we lazily 
create the builtin, than not having to forget to change it later.

https://github.com/llvm/llvm-project/pull/102115
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to