19std::pair<const Expr *, bool>
22 if (
auto *
cast = dyn_cast<CastExpr>(E)) {
23 if (StopAtFirstRefCountedObj) {
24 if (
auto *ConversionFunc =
25 dyn_cast_or_null<FunctionDecl>(
cast->getConversionFunction())) {
32 E =
cast->getSubExpr();
35 if (
auto *call = dyn_cast<CallExpr>(E)) {
36 if (
auto *memberCall = dyn_cast<CXXMemberCallExpr>(call)) {
38 if (IsGetterOfRefCt && *IsGetterOfRefCt) {
39 E = memberCall->getImplicitObjectArgument();
40 if (StopAtFirstRefCountedObj) {
47 if (
auto *operatorCall = dyn_cast<CXXOperatorCallExpr>(E)) {
48 if (operatorCall->getNumArgs() == 1) {
49 E = operatorCall->getArg(0);
54 if (
auto *callee = call->getDirectCallee()) {
56 if (StopAtFirstRefCountedObj)
69 if (
auto *unaryOp = dyn_cast<UnaryOperator>(E)) {
71 E = unaryOp->getSubExpr();
83 if (
auto *Ref = dyn_cast<DeclRefExpr>(E)) {
84 if (
auto *D = dyn_cast_or_null<VarDecl>(Ref->getFoundDecl())) {
85 if (isa<ParmVarDecl>(D) || D->isLocalVarDecl())
91 return isa<CXXThisExpr>(E);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
This represents one expression.
std::optional< bool > isGetterOfRefCounted(const CXXMethodDecl *M)
bool isPtrConversion(const FunctionDecl *F)
bool isCtorOfRefCounted(const clang::FunctionDecl *F)
std::pair< const Expr *, bool > tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj)
This function de-facto defines a set of transformations that we consider safe (in heuristical sense).
bool isASafeCallArg(const Expr *E)
For E referring to a ref-countable/-counted pointer/reference we return whether it's a safe call argu...
U cast(CodeGen::Address addr)