19std::pair<const Expr *, bool>
22 if (
auto *tempExpr = dyn_cast<MaterializeTemporaryExpr>(E)) {
23 E = tempExpr->getSubExpr();
26 if (
auto *tempExpr = dyn_cast<CXXBindTemporaryExpr>(E)) {
27 E = tempExpr->getSubExpr();
30 if (
auto *
cast = dyn_cast<CastExpr>(E)) {
31 if (StopAtFirstRefCountedObj) {
32 if (
auto *ConversionFunc =
33 dyn_cast_or_null<FunctionDecl>(
cast->getConversionFunction())) {
40 E =
cast->getSubExpr();
43 if (
auto *call = dyn_cast<CallExpr>(E)) {
44 if (
auto *memberCall = dyn_cast<CXXMemberCallExpr>(call)) {
45 if (
auto *
decl = memberCall->getMethodDecl()) {
47 if (IsGetterOfRefCt && *IsGetterOfRefCt) {
48 E = memberCall->getImplicitObjectArgument();
49 if (StopAtFirstRefCountedObj) {
57 if (
auto *operatorCall = dyn_cast<CXXOperatorCallExpr>(E)) {
58 if (operatorCall->getNumArgs() == 1) {
59 E = operatorCall->getArg(0);
64 if (
auto *callee = call->getDirectCallee()) {
66 if (StopAtFirstRefCountedObj)
85 if (
auto *unaryOp = dyn_cast<UnaryOperator>(E)) {
87 E = unaryOp->getSubExpr();
99 if (
auto *Ref = dyn_cast<DeclRefExpr>(E)) {
100 if (
auto *D = dyn_cast_or_null<VarDecl>(Ref->getFoundDecl())) {
101 if (isa<ParmVarDecl>(D) || D->isLocalVarDecl())
107 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.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
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...
bool isSingleton(const FunctionDecl *F)
bool isReturnValueRefCounted(const clang::FunctionDecl *F)
U cast(CodeGen::Address addr)