================
@@ -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:
The bug report is unclear to me.
Are you saying this is a bug, or are you just saying the AST representation is
not clean from a user understanding point of view?
The "external C++" linkage affects the VarDecl, but not the builtin
FunctionDecl, so again this is unclear.
Also, would this really only apply to builtin functions?
What about builtin TypedefDecls?
It's also strange that they would belong to the TU, and the TU would belong to
the module, but the builtin itself would not.
Can this situation currently arise for anything else?
If this is a cleanliness issue, can we instead create a builtin module, add all
those builtin declarations to a TU belonging to that module, and then
implicitly import it in every module?
Is that idea workable?
https://github.com/llvm/llvm-project/pull/102115
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits