21 #include "llvm/ADT/StringSwitch.h"
23 using namespace clang;
98 const_cast<Expr*
>(RHS),
100 C.getLogicalOperationType(),
114 const_cast<VarDecl*>(D),
129 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
134 return const_cast<Expr*>(Arg);
137 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
142 const_cast<Expr*>(Arg),
nullptr,
VK_RValue);
146 QualType Ty =
C.getBOOLDecl() ?
C.getBOOLType() :
C.ObjCBuiltinBoolTy;
217 M.makeLvalueToRvalue(
218 M.makeDeclRefExpr(Predicate), PredicateQPtrTy),
220 M.makeIntegralCast(IL, PredicateTy),
224 Stmt *Stmts[] = { B, CE };
229 M.makeLvalueToRvalue(
231 M.makeLvalueToRvalue(
232 M.makeDeclRefExpr(Predicate),
301 assert(OldValueTy == NewValueTy);
314 M.makeLvalueToRvalue(M.makeDeclRefExpr(OldValue), OldValueTy),
315 M.makeLvalueToRvalue(
317 M.makeLvalueToRvalue(M.makeDeclRefExpr(TheValue), TheValueTy),
327 M.makeLvalueToRvalue(M.makeDeclRefExpr(TheValue), TheValueTy),
329 M.makeLvalueToRvalue(M.makeDeclRefExpr(NewValue), NewValueTy),
332 Expr *BoolVal = M.makeObjCBool(
true);
333 Expr *RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
334 : M.makeIntegralCast(BoolVal, ResultTy);
335 Stmts[1] = M.makeReturn(RetVal);
339 BoolVal = M.makeObjCBool(
false);
340 RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
341 : M.makeIntegralCast(BoolVal, ResultTy);
342 Stmt *Else = M.makeReturn(RetVal);
357 return Val.getValue();
370 if (Name.startswith(
"OSAtomicCompareAndSwap") ||
371 Name.startswith(
"objc_atomicCompareAndSwap")) {
375 FF = llvm::StringSwitch<FunctionFarmer>(
Name)
381 if (FF) { Val = FF(C, D); }
382 else if (Injector) { Val = Injector->
getBody(D); }
383 return Val.getValue();
406 if (
I->getPropertyDecl() != Prop)
409 if (
I->getGetterCXXConstructor()) {
411 return M.makeReturn(
I->getGetterCXXConstructor());
434 M.makeLvalueToRvalue(
435 M.makeDeclRefExpr(selfVar),
440 loadedIVar = M.makeLvalueToRvalue(loadedIVar, IVar->
getType());
442 return M.makeReturn(loadedIVar);
454 return Val.getValue();
467 return Val.getValue();
Defines the clang::ASTContext interface.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
CK_LValueToRValue - A conversion which causes the extraction of an r-value from the operand gl-value...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
IfStmt - This represents an if/then/else.
bool isBooleanType() const
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
static bool isDispatchBlock(QualType Ty)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
CK_IntegralCast - A cast between integral types (other than to boolean).
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ObjCMethodDecl - Represents an instance or class method declaration.
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...
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
CK_IntegralToBoolean - Integral to boolean.
QualType getReturnType() const
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
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
detail::InMemoryDirectory::const_iterator I
PropertyAttributeKind getPropertyAttributes() const
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
virtual Stmt * getBody(const FunctionDecl *D)=0
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents a prototype with parameter type info, e.g.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
unsigned param_size() const
QualType getPointeeType() const
Expr - This represents one expression.
const ParmVarDecl * getParamDecl(unsigned i) const
ImplicitParamDecl * getSelfDecl() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
static Stmt * create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
static Stmt * createObjCPropertyGetter(ASTContext &Ctx, const ObjCPropertyDecl *Prop)
Encodes a location in the source.
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.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
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
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCMethodDecl * getGetterMethodDecl() const
bool isTriviallyCopyableType(ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
const T * getAs() const
Member-template getAs<specific type>'.
ObjCImplementationDecl * getImplementation() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Stmt *(* FunctionFarmer)(ASTContext &C, const FunctionDecl *D)
ObjCIvarDecl - Represents an ObjC instance variable.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
A reference to a declared variable, function, enum, etc.
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
isIntegerType() does not include complex integers (a GCC extension).