-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clangd crash in Namer::VisitCXXMemberCallExpr() in InlayHints.cpp #1873
Comments
Thanks. I think your analysis is right:
We should make a sanity check for the |
Reduced testcase: class A {};
using Predicate = bool(A::*)();
void foo(A* a, Predicate p) {
if ((a->*p)()) {
}
} Note that this is valid code. |
When the call is through a pointer to a member,
|
Proposed fix: llvm/llvm-project#76492 |
…k-end hint For calls through a pointer to member, CXXMemberCallExpr::getCallee() is a BinaryOperator with operator ->* (after unwrapping parens). getMethodDecl() only returns non-null if the callee is a MemberExpr. Fixes clangd/clangd#1873
…k-end hint (#76492) For calls through a pointer to member, CXXMemberCallExpr::getCallee() is a BinaryOperator with operator ->* (after unwrapping parens). getMethodDecl() only returns non-null if the callee is a MemberExpr. Fixes clangd/clangd#1873
I'm getting a crash in this function.
I don't have a reduced test case at the moment, but just eyeballing the function, it's unconditionally dereferencing
E->getMethodDecl()
andE->getImplicitObjectArgument()
, and either of those could potentially be null.This is a regression from https://reviews.llvm.org/D155421 which introduced this code.
cc @sam-mccall, @hokein
The text was updated successfully, but these errors were encountered: