clang 20.0.0git
|
#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>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "body-farm" |
Typedefs | |
typedef Stmt *(* | FunctionFarmer) (ASTContext &C, const FunctionDecl *D) |
Functions | |
static bool | isDispatchBlock (QualType Ty) |
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) |
Create a fake body for 'std::move' or 'std::forward'. | |
static Stmt * | create_call_once (ASTContext &C, const FunctionDecl *D) |
Create a fake body for std::call_once. | |
static Stmt * | create_dispatch_once (ASTContext &C, const FunctionDecl *D) |
Create a fake body for dispatch_once. | |
static Stmt * | create_dispatch_sync (ASTContext &C, const FunctionDecl *D) |
Create a fake body for dispatch_sync. | |
static Stmt * | create_OSAtomicCompareAndSwap (ASTContext &C, const FunctionDecl *D) |
static const ObjCIvarDecl * | findBackingIvar (const ObjCPropertyDecl *Prop) |
static Stmt * | createObjCPropertyGetter (ASTContext &Ctx, const ObjCMethodDecl *MD) |
#define DEBUG_TYPE "body-farm" |
Definition at line 29 of file BodyFarm.cpp.
typedef Stmt *(* FunctionFarmer) (ASTContext &C, const FunctionDecl *D) |
Definition at line 259 of file BodyFarm.cpp.
|
static |
Create a fake body for std::call_once.
Emulates the following function body:
Definition at line 346 of file BodyFarm.cpp.
References clang::C, clang::UnaryOperator::Create(), clang::IfStmt::Create(), create_call_once_funcptr_call(), create_call_once_lambda_call(), D, clang::Type::getAs(), clang::Type::getAsCXXRecordDecl(), clang::Type::getAsRecordDecl(), clang::QualType::getCanonicalType(), clang::CXXRecordDecl::getLambdaCallOperator(), clang::QualType::getNonReferenceType(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::ValueDecl::getType(), clang::CXXRecordDecl::isLambda(), clang::QualType::isNull(), clang::Type::isReferenceType(), clang::OK_Ordinary, and clang::VK_PRValue.
Referenced by clang::BodyFarm::getBody().
|
static |
Definition at line 261 of file BodyFarm.cpp.
References clang::C, clang::Call, clang::CallExpr::Create(), clang::QualType::getNonReferenceType(), clang::Type::isLValueReferenceType(), clang::Type::isRValueReferenceType(), and clang::VK_PRValue.
Referenced by create_call_once().
|
static |
Definition at line 287 of file BodyFarm.cpp.
References clang::C, clang::DeclRefExpr::Create(), clang::CXXOperatorCallExpr::Create(), clang::CXXRecordDecl::getLambdaCallOperator(), clang::ValueDecl::getType(), clang::CXXRecordDecl::isLambda(), clang::VK_LValue, and clang::VK_PRValue.
Referenced by create_call_once().
|
static |
Create a fake body for dispatch_once.
Definition at line 508 of file BodyFarm.cpp.
References Block, clang::C, clang::UnaryOperator::Create(), clang::CallExpr::Create(), clang::IfStmt::Create(), D, clang::Type::getAs(), clang::PointerType::getPointeeType(), clang::ValueDecl::getType(), clang::If, isDispatchBlock(), clang::Type::isIntegerType(), clang::OK_Ordinary, and clang::VK_PRValue.
Referenced by clang::BodyFarm::getBody().
|
static |
Create a fake body for dispatch_sync.
Definition at line 592 of file BodyFarm.cpp.
References clang::C, clang::CallExpr::Create(), D, clang::ValueDecl::getType(), isDispatchBlock(), and clang::VK_PRValue.
Referenced by clang::BodyFarm::getBody().
|
static |
Construct the If.
Definition at line 618 of file BodyFarm.cpp.
References clang::C, clang::IfStmt::Create(), D, clang::Type::getAs(), clang::PointerType::getPointeeType(), clang::ValueDecl::getType(), clang::If, clang::Type::isBooleanType(), and clang::Type::isIntegralType().
Referenced by clang::BodyFarm::getBody().
|
static |
Create a fake body for 'std::move' or 'std::forward'.
This is just:
Definition at line 320 of file BodyFarm.cpp.
Referenced by clang::BodyFarm::getBody().
|
static |
Definition at line 785 of file BodyFarm.cpp.
References findBackingIvar(), clang::ObjCMethodDecl::findPropertyDecl(), clang::ObjCMethodDecl::getClassInterface(), clang::ObjCIvarDecl::getContainingInterface(), clang::ObjCInterfaceDecl::getImplementation(), clang::QualType::getNonReferenceType(), clang::ObjCPropertyDecl::getPropertyAttributes(), clang::ObjCPropertyDecl::getPropertyIvarDecl(), clang::ObjCMethodDecl::getReturnType(), clang::ObjCMethodDecl::getSelector(), clang::ObjCMethodDecl::getSelfDecl(), clang::ValueDecl::getType(), clang::ObjCPropertyDecl::getType(), clang::ASTContext::hasSameUnqualifiedType(), I, clang::Type::isObjCLifetimeType(), clang::Type::isReferenceType(), clang::ObjCMethodDecl::isSynthesizedAccessorStub(), clang::QualType::isTriviallyCopyableType(), clang::ObjCPropertyAttribute::kind_weak, and clang::ObjCImplDecl::property_impls().
Referenced by clang::BodyFarm::getBody().
|
static |
Definition at line 746 of file BodyFarm.cpp.
References clang::ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass(), clang::Decl::getDeclContext(), clang::NamedDecl::getIdentifier(), clang::ObjCPropertyDecl::getPropertyIvarDecl(), clang::ObjCPropertyDecl::getQueryKind(), and clang::ObjCPropertyDecl::isReadOnly().
Referenced by createObjCPropertyGetter().
Definition at line 37 of file BodyFarm.cpp.
References clang::Type::getAs(), clang::FunctionProtoType::getNumParams(), clang::BlockPointerType::getPointeeType(), clang::FunctionType::getReturnType(), and clang::Type::isVoidType().
Referenced by create_dispatch_once(), and create_dispatch_sync().