21 #include "llvm/ADT/StringSwitch.h"
23 using namespace clang;
101 const_cast<Expr*
>(RHS),
103 C.getLogicalOperationType(),
117 const_cast<VarDecl*>(D),
132 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
137 return const_cast<Expr*>(Arg);
140 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
145 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
149 QualType Ty =
C.getBOOLDecl() ?
C.getBOOLType() :
C.ObjCBuiltinBoolTy;
220 M.makeLvalueToRvalue(
221 M.makeDeclRefExpr(Predicate), PredicateQPtrTy),
223 M.makeIntegralCast(IL, PredicateTy),
227 Stmt *Stmts[] = { B, CE };
232 M.makeLvalueToRvalue(
234 M.makeLvalueToRvalue(
235 M.makeDeclRefExpr(Predicate),
304 assert(OldValueTy == NewValueTy);
317 M.makeLvalueToRvalue(M.makeDeclRefExpr(OldValue), OldValueTy),
318 M.makeLvalueToRvalue(
320 M.makeLvalueToRvalue(M.makeDeclRefExpr(TheValue), TheValueTy),
330 M.makeLvalueToRvalue(M.makeDeclRefExpr(TheValue), TheValueTy),
332 M.makeLvalueToRvalue(M.makeDeclRefExpr(NewValue), NewValueTy),
335 Expr *BoolVal = M.makeObjCBool(
true);
336 Expr *RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
337 : M.makeIntegralCast(BoolVal, ResultTy);
338 Stmts[1] = M.makeReturn(RetVal);
342 BoolVal = M.makeObjCBool(
false);
343 RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
344 : M.makeIntegralCast(BoolVal, ResultTy);
345 Stmt *Else = M.makeReturn(RetVal);
360 return Val.getValue();
373 if (Name.startswith(
"OSAtomicCompareAndSwap") ||
374 Name.startswith(
"objc_atomicCompareAndSwap")) {
378 FF = llvm::StringSwitch<FunctionFarmer>(Name)
384 if (FF) { Val = FF(C, D); }
385 else if (Injector) { Val = Injector->
getBody(D); }
386 return Val.getValue();
409 if (I->getPropertyDecl() != Prop)
412 if (I->getGetterCXXConstructor()) {
414 return M.makeReturn(I->getGetterCXXConstructor());
437 M.makeLvalueToRvalue(
438 M.makeDeclRefExpr(selfVar),
443 loadedIVar = M.makeLvalueToRvalue(loadedIVar, IVar->
getType());
445 return M.makeReturn(loadedIVar);
457 return Val.getValue();
470 return Val.getValue();
Defines the clang::ASTContext interface.
StringRef getName() const
IdentifierInfo * getIdentifier() const
bool isBooleanType() const
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
static bool isDispatchBlock(QualType Ty)
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
unsigned param_size() const
ParmVarDecl - Represents a parameter to a function.
unsigned getNumParams() const
bool isComparisonOp() const
const ObjCInterfaceDecl * getContainingInterface() const
Return the class interface that this ivar is logically contained in; this is either the interface whe...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
bool isReferenceType() const
Defines the clang::CodeInjector interface which is responsible for injecting AST of function definiti...
QualType getReturnType() const
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
QualType getReturnType() const
bool isObjCLifetimeType() const
A builtin binary operation expression such as "x + y" or "x <= y".
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
An ordinary object is located at an address in memory.
propimpl_range property_impls() const
PropertyAttributeKind getPropertyAttributes() const
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
virtual Stmt * getBody(const FunctionDecl *D)=0
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
unsigned param_size() const
QualType getPointeeType() const
const ParmVarDecl * getParamDecl(unsigned i) const
ImplicitParamDecl * getSelfDecl() const
static Stmt * create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D)
static Stmt * createObjCPropertyGetter(ASTContext &Ctx, const ObjCPropertyDecl *Prop)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
static Stmt * create_dispatch_sync(ASTContext &C, const FunctionDecl *D)
Create a fake body for dispatch_sync.
bool isPropertyAccessor() const
Represents one property declaration in an Objective-C interface.
QualType getPointeeType() const
static Stmt * create_dispatch_once(ASTContext &C, const FunctionDecl *D)
Create a fake body for dispatch_once.
ObjCIvarDecl * getPropertyIvarDecl() const
Stmt * getBody(const FunctionDecl *D)
Factory method for creating bodies for ordinary functions.
QualType getNonReferenceType() const
ObjCMethodDecl * getGetterMethodDecl() const
bool isTriviallyCopyableType(ASTContext &Context) const
ObjCImplementationDecl * getImplementation() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Stmt *(* FunctionFarmer)(ASTContext &C, const FunctionDecl *D)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
An l-value expression is a reference to an object with independent storage.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isIntegralType(ASTContext &Ctx) const
Determine whether this type is an integral type.
bool isIntegerType() const