================
@@ -61,9 +69,28 @@ class ContributorFinder : public DynamicRecursiveASTVisitor {
   bool VisitLambdaExpr(LambdaExpr *L) override {
     // TraverseLambdaExpr directly visits the body stmt, skipping the
     // CXXMethodDecl, which is a contributor that needs to be collected.
+    // The system-header gate fires via the delegated VisitFunctionDecl
+    // (the call operator's spelling location is the lambda's source
+    // location), so no separate gate here.
     VisitFunctionDecl(L->getCallOperator());
     return true;
   }
+
+private:
+  // Returns true when the contributor shall be skipped because its location
+  // is in a system header. The `Loc.isValid()` guard matches the in-tree
+  // precedent at `ReferenceBindingEntityExtractor.cpp` — compiler-generated
+  // decls (builtin FunctionDecls, implicit template instantiations) can reach
+  // the visitor with invalid locations and shall NOT be inadvertently skipped.
----------------
steakhal wrote:

IMO this comment does not carry its weight.
I think the only thing we should save is the part explaining why we handle 
invalid source locations - but even that should not be part of documenting the 
API, and should be moved into the implementation, close to the `isValid()` 
call, between the Loc declaration and the return statement.


```suggestion
```

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

Reply via email to