18 using namespace clang;
24 NumElements(Elements.size()), Range(SR), ArrayWithObjectsMethod(Method) {
25 Expr **SaveElements = getElements();
26 for (
unsigned I = 0, N = Elements.size();
I != N; ++
I) {
27 if (Elements[
I]->isTypeDependent() || Elements[
I]->isValueDependent())
28 ExprBits.ValueDependent =
true;
29 if (Elements[
I]->isInstantiationDependent())
30 ExprBits.InstantiationDependent =
true;
31 if (Elements[
I]->containsUnexpandedParameterPack())
32 ExprBits.ContainsUnexpandedParameterPack =
true;
34 SaveElements[
I] = Elements[
I];
42 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(Elements.size()));
47 unsigned NumElements) {
49 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(NumElements));
59 NumElements(VK.size()), HasPackExpansions(HasPackExpansions), Range(SR),
60 DictWithObjectsMethod(method) {
61 KeyValuePair *KeyValues = getTrailingObjects<KeyValuePair>();
62 ExpansionData *Expansions =
63 HasPackExpansions ? getTrailingObjects<ExpansionData>() :
nullptr;
64 for (
unsigned I = 0;
I < NumElements;
I++) {
65 if (VK[
I].Key->isTypeDependent() || VK[
I].Key->isValueDependent() ||
66 VK[
I].Value->isTypeDependent() || VK[
I].Value->isValueDependent())
67 ExprBits.ValueDependent =
true;
68 if (VK[
I].Key->isInstantiationDependent() ||
69 VK[
I].Value->isInstantiationDependent())
70 ExprBits.InstantiationDependent =
true;
71 if (VK[
I].EllipsisLoc.isInvalid() &&
72 (VK[
I].Key->containsUnexpandedParameterPack() ||
73 VK[
I].Value->containsUnexpandedParameterPack()))
74 ExprBits.ContainsUnexpandedParameterPack =
true;
76 KeyValues[
I].Key = VK[
I].Key;
77 KeyValues[
I].Value = VK[
I].Value;
79 Expansions[
I].EllipsisLoc = VK[
I].EllipsisLoc;
80 if (VK[
I].NumExpansions)
81 Expansions[
I].NumExpansionsPlusOne = *VK[
I].NumExpansions + 1;
83 Expansions[
I].NumExpansionsPlusOne = 0;
93 void *Mem = C.
Allocate(totalSizeToAlloc<KeyValuePair, ExpansionData>(
94 VK.size(), HasPackExpansions ? VK.size() : 0));
100 bool HasPackExpansions) {
101 void *Mem = C.
Allocate(totalSizeToAlloc<KeyValuePair, ExpansionData>(
102 NumElements, HasPackExpansions ? NumElements : 0));
130 reinterpret_cast<
uintptr_t>(Method ? Method : Sel.getAsOpaquePtr())),
131 Kind(IsInstanceSuper ? SuperInstance : SuperClass),
132 HasMethod(Method != nullptr), IsDelegateInitCall(
false),
133 IsImplicit(isImplicit), SuperLoc(SuperLoc), LBracLoc(LBracLoc),
135 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
147 T->isDependentType(), T->isInstantiationDependentType(),
148 T->containsUnexpandedParameterPack()),
150 reinterpret_cast<
uintptr_t>(Method ? Method : Sel.getAsOpaquePtr())),
151 Kind(Class), HasMethod(Method != nullptr), IsDelegateInitCall(
false),
152 IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc) {
153 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
154 setReceiverPointer(Receiver);
164 Receiver->isTypeDependent(), Receiver->isTypeDependent(),
165 Receiver->isInstantiationDependent(),
166 Receiver->containsUnexpandedParameterPack()),
168 reinterpret_cast<
uintptr_t>(Method ? Method : Sel.getAsOpaquePtr())),
169 Kind(Instance), HasMethod(Method != nullptr), IsDelegateInitCall(
false),
170 IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc) {
171 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
172 setReceiverPointer(Receiver);
178 setNumArgs(Args.size());
180 for (
unsigned I = 0;
I != Args.size(); ++
I) {
182 ExprBits.TypeDependent =
true;
184 ExprBits.ValueDependent =
true;
186 ExprBits.InstantiationDependent =
true;
188 ExprBits.ContainsUnexpandedParameterPack =
true;
193 SelLocsKind = SelLocsK;
196 std::copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
208 "No selector locs for non-implicit message");
212 Mem = alloc(Context, Args.size(), 0);
214 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
215 return new (Mem)
ObjCMessageExpr(T, VK, LBracLoc, SuperLoc, IsInstanceSuper,
216 SuperType, Sel, SelLocs, SelLocsK, Method,
217 Args, RBracLoc, isImplicit);
227 "No selector locs for non-implicit message");
231 Mem = alloc(Context, Args.size(), 0);
233 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
235 ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel, SelLocs, SelLocsK, Method,
236 Args, RBracLoc, isImplicit);
246 "No selector locs for non-implicit message");
250 Mem = alloc(Context, Args.size(), 0);
252 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
254 ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel, SelLocs, SelLocsK, Method,
255 Args, RBracLoc, isImplicit);
260 unsigned NumStoredSelLocs) {
272 unsigned NumStoredSelLocs =
274 return alloc(C, Args.size(), NumStoredSelLocs);
278 unsigned NumStoredSelLocs) {
280 totalSizeToAlloc<void *, SourceLocation>(NumArgs + 1, NumStoredSelLocs),
281 llvm::AlignOf<ObjCMessageExpr>::Alignment);
303 llvm_unreachable(
"Invalid ReceiverKind!");
324 llvm_unreachable(
"unexpected receiver kind");
331 return Ptr->getInterfaceDecl();
334 return Ty->getInterface();
342 begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<void *>());
345 return child_range(begin,
354 return "__bridge_transfer";
356 return "__bridge_retained";
359 llvm_unreachable(
"Invalid BridgeKind!");
The receiver is the instance of the superclass object.
Defines the clang::ASTContext interface.
The receiver is an object instance.
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Bridging via __bridge, which does nothing but reinterpret the bits.
static ObjCMessageExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, SourceLocation LBracLoc, SourceLocation SuperLoc, bool IsInstanceSuper, QualType SuperType, Selector Sel, ArrayRef< SourceLocation > SelLocs, ObjCMethodDecl *Method, ArrayRef< Expr * > Args, SourceLocation RBracLoc, bool isImplicit)
Create a message send to super.
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
unsigned getNumSelectorLocs() const
A container of type source information.
static ObjCDictionaryLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements, bool HasPackExpansions)
void * getAsOpaquePtr() const
ObjCMethodDecl - Represents an instance or class method declaration.
QualType getReceiverType() const
Retrieve the receiver type to which this message is being directed.
Represents a class type in Objective C.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ObjCInterfaceDecl * getClassReceiver() const
static ObjCMessageExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs, unsigned NumStoredSelLocs)
Create an empty Objective-C message expression, to be filled in by subsequent calls.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, ArrayRef< SourceLocation > SelLocs, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Returns true if all SelLocs are in a "standard" location.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super', otherwise an invalid source location.
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
QualType getSuperType() const
Retrieve the type referred to by 'super'.
bool isSuperReceiver() const
Selector getSelector() const
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
An ordinary object is located at an address in memory.
const Expr * getBase() const
Represents an ObjC class declaration.
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC...
detail::InMemoryDirectory::const_iterator I
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
Expr - This represents one expression.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
SourceRange getReceiverRange() const
Source range of the receiver.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
Expr ** getArgs()
Retrieve the arguments to this message, not including the receiver.
static ObjCDictionaryLiteral * Create(const ASTContext &C, ArrayRef< ObjCDictionaryElement > VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, SourceRange SR)
An expression that sends a message to the given Objective-C object or class.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Encodes a location in the source.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
QualType getReceiverType(const ASTContext &ctx) const
Determine the type of the base, regardless of the kind of receiver.
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or NULL if the message is not a class mess...
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
SourceLocation getSelectorLoc(unsigned Index) const
bool isClassReceiver() const
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
Represents a pointer to an Objective C object.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
const T * getAs() const
Member-template getAs<specific type>'.
QualType getSuperReceiverType() const
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
void * Allocate(size_t Size, unsigned Align=8) const
bool isImplicit() const
Indicates whether the message send was implicitly generated by the implementation.
static ObjCArrayLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements)
A trivial tuple used to represent a source range.
The receiver is a superclass.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.