================
@@ -570,9 +573,10 @@ til::SExpr *SExprBuilder::translateCallExpr(const CallExpr
*CE,
til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
const CXXMemberCallExpr *ME, CallingContext *Ctx) {
if (CapabilityExprMode) {
- // Ignore calls to get() on smart pointers.
- if (ME->getMethodDecl()->getNameAsString() == "get" &&
- ME->getNumArgs() == 0) {
+ // Ignore calls to get() on smart pointers. A call through a pointer to
+ // member function has no method declaration.
+ const CXXMethodDecl *MD = ME->getMethodDecl();
+ if (MD && MD->getNameAsString() == "get" && ME->getNumArgs() == 0) {
----------------
melver wrote:
Nit: while touching this condition, checking `ME->getNumArgs() == 0` first and
using `MD->getIdentifier() && MD->getIdentifier()->isStr("get")` (matching
`VarMapBuilder::VisitCallExpr` in `ThreadSafety.cpp`) avoids heap-allocating a
`std::string` via `getNameAsString()` on every member call.
https://github.com/llvm/llvm-project/pull/231995
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits