================
@@ -3584,12 +3584,31 @@ ASTDeclReader::FindExistingResult 
ASTDeclReader::findExisting(NamedDecl *D) {
   }
 
   ASTContext &C = Reader.getContext();
+  auto IsSameEntity = [&](NamedDecl *Existing) {
+    if (!C.isSameEntity(Existing, D))
+      return false;
+
+    auto *FD = dyn_cast<FunctionDecl>(D);
+    auto *ExistingFD = dyn_cast<FunctionDecl>(Existing);
+    if (!FD || !ExistingFD ||
+        FD->getFormalLinkage() != Linkage::Internal ||
+        ExistingFD->getFormalLinkage() != Linkage::Internal)
+      return true;
+
+    Module *M = FD->getOwningModule();
+    Module *ExistingM = ExistingFD->getOwningModule();
+    if (!M || !ExistingM || !M->isGlobalModule() ||
+        !ExistingM->isGlobalModule())
+      return true;
+
+    return M->getTopLevelModule() == ExistingM->getTopLevelModule();
----------------
ChuanqiXu9 wrote:

Is this change really necessary?

https://github.com/llvm/llvm-project/pull/219238
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to