================
@@ -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:

Actually, having something like this would be still helpful:

```suggestion
  /// \returns true when the contributor shall be skipped.
```

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