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

Note, I took the approach of falling through if `FirstArgLoc` is invalid for 
any reason; presumably we never want to return an invalid location when we 
might fall through to a valid one in `getCallee()->getBeginLoc()`.

We could alternatively make the check more specific, to e.g. 
`!getArg(0)->isImplicitCXXThis()`.

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

Reply via email to