aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaFunctionEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaFunctionEffects.cpp')
-rw-r--r--clang/lib/Sema/SemaFunctionEffects.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaFunctionEffects.cpp b/clang/lib/Sema/SemaFunctionEffects.cpp
index 8590ee8..4b63eb7 100644
--- a/clang/lib/Sema/SemaFunctionEffects.cpp
+++ b/clang/lib/Sema/SemaFunctionEffects.cpp
@@ -1208,8 +1208,16 @@ private:
return true;
}
- // No Decl, just an Expr. Just check based on its type.
- checkIndirectCall(Call, CalleeExpr->getType());
+ // No Decl, just an Expr. Just check based on its type. Bound member
+ // functions are a special expression type and need to be specially
+ // unpacked.
+ QualType CalleeExprQT = CalleeExpr->getType();
+ if (CalleeExpr->isBoundMemberFunction(Outer.S.getASTContext())) {
+ QualType QT = Expr::findBoundMemberType(CalleeExpr);
+ if (!QT.isNull())
+ CalleeExprQT = QT;
+ }
+ checkIndirectCall(Call, CalleeExprQT);
return true;
}
@@ -1271,7 +1279,15 @@ private:
const CXXConstructorDecl *Ctor = Construct->getConstructor();
CallableInfo CI(*Ctor);
followCall(CI, Construct->getLocation());
+ return true;
+ }
+ bool VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *BTE) override {
+ const CXXDestructorDecl *Dtor = BTE->getTemporary()->getDestructor();
+ if (Dtor != nullptr) {
+ CallableInfo CI(*Dtor);
+ followCall(CI, BTE->getBeginLoc());
+ }
return true;
}