#include "clang/Analysis/BodyFarm.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/Analysis/CodeInjector.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/OperatorKinds.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE …
usingnamespaceclang;
static bool isDispatchBlock(QualType Ty) { … }
namespace {
class ASTMaker { … };
}
BinaryOperator *ASTMaker::makeAssignment(const Expr *LHS, const Expr *RHS,
QualType Ty) { … }
BinaryOperator *ASTMaker::makeComparison(const Expr *LHS, const Expr *RHS,
BinaryOperator::Opcode Op) { … }
CompoundStmt *ASTMaker::makeCompound(ArrayRef<Stmt *> Stmts) { … }
DeclRefExpr *ASTMaker::makeDeclRefExpr(
const VarDecl *D,
bool RefersToEnclosingVariableOrCapture) { … }
UnaryOperator *ASTMaker::makeDereference(const Expr *Arg, QualType Ty) { … }
ImplicitCastExpr *ASTMaker::makeLvalueToRvalue(const Expr *Arg, QualType Ty) { … }
ImplicitCastExpr *
ASTMaker::makeLvalueToRvalue(const VarDecl *Arg,
bool RefersToEnclosingVariableOrCapture) { … }
ImplicitCastExpr *ASTMaker::makeImplicitCast(const Expr *Arg, QualType Ty,
CastKind CK) { … }
CastExpr *ASTMaker::makeReferenceCast(const Expr *Arg, QualType Ty) { … }
Expr *ASTMaker::makeIntegralCast(const Expr *Arg, QualType Ty) { … }
ImplicitCastExpr *ASTMaker::makeIntegralCastToBoolean(const Expr *Arg) { … }
ObjCBoolLiteralExpr *ASTMaker::makeObjCBool(bool Val) { … }
ObjCIvarRefExpr *ASTMaker::makeObjCIvarRef(const Expr *Base,
const ObjCIvarDecl *IVar) { … }
ReturnStmt *ASTMaker::makeReturn(const Expr *RetVal) { … }
IntegerLiteral *ASTMaker::makeIntegerLiteral(uint64_t Value, QualType Ty) { … }
MemberExpr *ASTMaker::makeMemberExpression(Expr *base, ValueDecl *MemberDecl,
bool IsArrow,
ExprValueKind ValueKind) { … }
ValueDecl *ASTMaker::findMemberField(const RecordDecl *RD, StringRef Name) { … }
FunctionFarmer;
static CallExpr *create_call_once_funcptr_call(ASTContext &C, ASTMaker M,
const ParmVarDecl *Callback,
ArrayRef<Expr *> CallArgs) { … }
static CallExpr *create_call_once_lambda_call(ASTContext &C, ASTMaker M,
const ParmVarDecl *Callback,
CXXRecordDecl *CallbackDecl,
ArrayRef<Expr *> CallArgs) { … }
static Stmt *create_std_move_forward(ASTContext &C, const FunctionDecl *D) { … }
static Stmt *create_call_once(ASTContext &C, const FunctionDecl *D) { … }
static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) { … }
static Stmt *create_dispatch_sync(ASTContext &C, const FunctionDecl *D) { … }
static Stmt *create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D)
{ … }
Stmt *BodyFarm::getBody(const FunctionDecl *D) { … }
static const ObjCIvarDecl *findBackingIvar(const ObjCPropertyDecl *Prop) { … }
static Stmt *createObjCPropertyGetter(ASTContext &Ctx,
const ObjCMethodDecl *MD) { … }
Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) { … }