================
@@ -34,13 +43,26 @@ template <typename T> bool MapASTVisitor::mapDecl(const T 
*D) {
   // If there is an error generating a USR for the decl, skip this decl.
   if (index::generateUSRForDecl(D, USR))
     return true;
+
+  // Prevent Visiting USR twice
+  {
+    std::lock_guard<llvm::sys::Mutex> Guard(USRVisitedGuard);
+    std::string Visited = USR.str().str();
+    if (USRVisited.count(Visited))
+      return true;
+    // We considered a USR to be visited only when its defined
+    if (IsDefinition)
+      USRVisited.insert(Visited);
----------------
ilovepi wrote:

I don't think this logic makes sense. Why is it unreasonable to expect a USR to 
be valid only when its a definition? Is there some logic that prevents things 
that aren't definitions from being able to hold documentation? What I'm worried 
about, is the case where we have several USRs that contain different 
documentation bits that would have been merged in the past, but now wont.

If there is a concrete reason, please document that here in the comments, and 
in the commit message.

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

Reply via email to