================
@@ -419,6 +419,44 @@ locateASTReferent(SourceLocation CurLoc, const
syntax::Token *TouchedIdentifier,
AST.getASTContext(), nameLocation(*Def, SM), MainFilePath);
};
+ // Special case: if the cursor lands directly on a call expression (i.e.
+ // its enclosing SelectionTree node is the CallExpr itself, not the callee
+ // identifier or an argument), and the call invokes a forwarding wrapper
+ // such as `std::make_unique<T>(...)`, navigate to the constructor of `T`
+ // that the wrapper ultimately calls. This mirrors the existing
+ // constructor-call behaviour: `Abc^()` jumps to the constructor while
+ // `A^bc()` jumps to the type. The hook does not fire when the cursor is
+ // on the wrapper's identifier; that path continues to navigate to the
+ // wrapper itself via the candidate loop below.
+ {
+ unsigned Offset = SM.getDecomposedSpellingLoc(CurLoc).second;
----------------
fitermay wrote:
The functions look similar but they are not trivially mergeable due to
different control flow. I've extracted a findEnclosingCallAt helper in hopes
of making it a little cleaner.
https://github.com/llvm/llvm-project/pull/199480
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits