[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 23:21:17 PST 2025


================
@@ -1648,8 +1648,11 @@ SourceLocation CallExpr::getBeginLoc() const {
   if (const auto *Method =
           dyn_cast_if_present<const CXXMethodDecl>(getCalleeDecl());
       Method && Method->isExplicitObjectMemberFunction()) {
-    assert(getNumArgs() > 0 && getArg(0));
-    return getArg(0)->getBeginLoc();
+    if (!isTypeDependent()) {
----------------
HighCommander4 wrote:

Note that there isn't anything remaining to fix -- the fall-through behaviour (returning `getCallee()->getBeginLoc()`) is the correct one for the dependent case, because in the dependent case the callee includes the object argument.

I added a comment to clarify this.

https://github.com/llvm/llvm-project/pull/126868


More information about the cfe-commits mailing list