[clang] [clang][AST] Handle dependent representation of call to function with explicit object parameter in CallExpr::getBeginLoc() (PR #126868)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 00:17:11 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()) {
+ assert(getNumArgs() > 0 && getArg(0));
+ if (getNumArgs() > 0 && getArg(0))
----------------
shafik wrote:
I don't think we do this elsewhere and in fact I think we prefer a crash we are violating an invariant and we want a hard fail so we can identify and fix ASAP.
Most folks don't run w/ assertions enabled and we could be hiding a latent bug for a long time.
https://github.com/llvm/llvm-project/pull/126868
More information about the cfe-commits
mailing list