[clang] [C++20] [Modules] Don't set modules owner ship information for builtin declarations (PR #102115)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 02:38:23 PDT 2024


================
@@ -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);
----------------
cor3ntin wrote:

When is the owning module set?
It would be cleaner to check whether a function is a builtin and never set a module rather than adding it and removing it later, i think

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


More information about the cfe-commits mailing list