clang 8.0.0

Expr.h
Go to the documentation of this file.
1 //===--- Expr.h - Classes for representing expressions ----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the Expr interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_AST_EXPR_H
15 #define LLVM_CLANG_AST_EXPR_H
16
17 #include "clang/AST/APValue.h"
18 #include "clang/AST/ASTVector.h"
19 #include "clang/AST/Decl.h"
20 #include "clang/AST/DeclAccessPair.h"
21 #include "clang/AST/OperationKinds.h"
22 #include "clang/AST/Stmt.h"
23 #include "clang/AST/TemplateBase.h"
24 #include "clang/AST/Type.h"
25 #include "clang/Basic/CharInfo.h"
26 #include "clang/Basic/LangOptions.h"
27 #include "clang/Basic/SyncScope.h"
28 #include "clang/Basic/TypeTraits.h"
29 #include "llvm/ADT/APFloat.h"
30 #include "llvm/ADT/APSInt.h"
31 #include "llvm/ADT/SmallVector.h"
32 #include "llvm/ADT/StringRef.h"
33 #include "llvm/Support/AtomicOrdering.h"
34 #include "llvm/Support/Compiler.h"
35 #include "llvm/Support/TrailingObjects.h"
36
37 namespace clang {
38 class APValue;
39 class ASTContext;
40 class BlockDecl;
41 class CXXBaseSpecifier;
42 class CXXMemberCallExpr;
43 class CXXOperatorCallExpr;
44 class CastExpr;
45 class Decl;
46 class IdentifierInfo;
47 class MaterializeTemporaryExpr;
48 class NamedDecl;
49 class ObjCPropertyRefExpr;
50 class OpaqueValueExpr;
51 class ParmVarDecl;
52 class StringLiteral;
53 class TargetInfo;
54 class ValueDecl;
55
56 /// A simple array of base specifiers.
57 typedef SmallVector<CXXBaseSpecifier*, 4> CXXCastPath;
58
59 /// An adjustment to be made to the temporary created when emitting a
60 /// reference binding, which accesses a particular subobject of that temporary.
61 struct SubobjectAdjustment {
62 enum {
63 DerivedToBaseAdjustment,
64 FieldAdjustment,
65 MemberPointerAdjustment
66 } Kind;
67
68 struct DTB {
69 const CastExpr *BasePath;
70 const CXXRecordDecl *DerivedClass;
71 };
72
73 struct P {
74 const MemberPointerType *MPT;
75 Expr *RHS;
76 };
77
78 union {
79 struct DTB DerivedToBase;
80 FieldDecl *Field;
81 struct P Ptr;
82 };
83
84 SubobjectAdjustment(const CastExpr *BasePath,
85 const CXXRecordDecl *DerivedClass)
86 : Kind(DerivedToBaseAdjustment) {
87 DerivedToBase.BasePath = BasePath;
88 DerivedToBase.DerivedClass = DerivedClass;
89 }
90
91 SubobjectAdjustment(FieldDecl *Field)
92 : Kind(FieldAdjustment) {
93 this->Field = Field;
94 }
95
96 SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
97 : Kind(MemberPointerAdjustment) {
98 this->Ptr.MPT = MPT;
99 this->Ptr.RHS = RHS;
100 }
101 };
102
103 /// This represents one expression. Note that Expr's are subclasses of Stmt.
104 /// This allows an expression to be transparently used any place a Stmt is
105 /// required.
106 class Expr : public Stmt {
107 QualType TR;
108
109 protected:
110 Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK,
111 bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
112 : Stmt(SC)
113 {
114 ExprBits.TypeDependent = TD;
115 ExprBits.ValueDependent = VD;
116 ExprBits.InstantiationDependent = ID;
117 ExprBits.ValueKind = VK;
118 ExprBits.ObjectKind = OK;
119 assert(ExprBits.ObjectKind == OK && "truncated kind");
120 ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
121 setType(T);
122 }
123
124 /// Construct an empty expression.
125 explicit Expr(StmtClass SC, EmptyShell) : Stmt(SC) { }
126
127 public:
128 QualType getType() const { return TR; }
129 void setType(QualType t) {
130 // In C++, the type of an expression is always adjusted so that it
131 // will not have reference type (C++ [expr]p6). Use
132 // QualType::getNonReferenceType() to retrieve the non-reference
133 // type. Additionally, inspect Expr::isLvalue to determine whether
134 // an expression that is adjusted in this manner should be
135 // considered an lvalue.
136 assert((t.isNull() || !t->isReferenceType()) &&
137 "Expressions can't have reference type");
138
139 TR = t;
140 }
141
142 /// isValueDependent - Determines whether this expression is
143 /// value-dependent (C++ [temp.dep.constexpr]). For example, the
144 /// array bound of "Chars" in the following example is
145 /// value-dependent.
146 /// @code
147 /// template<int Size, char (&Chars)[Size]> struct meta_string;
148 /// @endcode
149 bool isValueDependent() const { return ExprBits.ValueDependent; }
150
151 /// Set whether this expression is value-dependent or not.
152 void setValueDependent(bool VD) {
153 ExprBits.ValueDependent = VD;
154 }
155
156 /// isTypeDependent - Determines whether this expression is
157 /// type-dependent (C++ [temp.dep.expr]), which means that its type
158 /// could change from one template instantiation to the next. For
159 /// example, the expressions "x" and "x + y" are type-dependent in
160 /// the following code, but "y" is not type-dependent:
161 /// @code
162 /// template<typename T>
163 /// void add(T x, int y) {
164 /// x + y;
165 /// }
166 /// @endcode
167 bool isTypeDependent() const { return ExprBits.TypeDependent; }
168
169 /// Set whether this expression is type-dependent or not.
170 void setTypeDependent(bool TD) {
171 ExprBits.TypeDependent = TD;
172 }
173
174 /// Whether this expression is instantiation-dependent, meaning that
175 /// it depends in some way on a template parameter, even if neither its type
176 /// nor (constant) value can change due to the template instantiation.
177 ///
178 /// In the following example, the expression \c sizeof(sizeof(T() + T())) is
179 /// instantiation-dependent (since it involves a template parameter \c T), but
180 /// is neither type- nor value-dependent, since the type of the inner
181 /// \c sizeof is known (\c std::size_t) and therefore the size of the outer
182 /// \c sizeof is known.
183 ///
184 /// \code
185 /// template<typename T>
186 /// void f(T x, T y) {
187 /// sizeof(sizeof(T() + T());
188 /// }
189 /// \endcode
190 ///
191 bool isInstantiationDependent() const {
192 return ExprBits.InstantiationDependent;
193 }
194
195 /// Set whether this expression is instantiation-dependent or not.
196 void setInstantiationDependent(bool ID) {
197 ExprBits.InstantiationDependent = ID;
198 }
199
200 /// Whether this expression contains an unexpanded parameter
201 /// pack (for C++11 variadic templates).
202 ///
203 /// Given the following function template:
204 ///
205 /// \code
206 /// template<typename F, typename ...Types>
207 /// void forward(const F &f, Types &&...args) {
208 /// f(static_cast<Types&&>(args)...);
209 /// }
210 /// \endcode
211 ///
212 /// The expressions \c args and \c static_cast<Types&&>(args) both
213 /// contain parameter packs.
214 bool containsUnexpandedParameterPack() const {
215 return ExprBits.ContainsUnexpandedParameterPack;
216 }
217
218 /// Set the bit that describes whether this expression
219 /// contains an unexpanded parameter pack.
220 void setContainsUnexpandedParameterPack(bool PP = true) {
221 ExprBits.ContainsUnexpandedParameterPack = PP;
222 }
223
224 /// getExprLoc - Return the preferred location for the arrow when diagnosing
225 /// a problem with a generic expression.
226 SourceLocation getExprLoc() const LLVM_READONLY;
227
228 /// isUnusedResultAWarning - Return true if this immediate expression should
229 /// be warned about if the result is unused. If so, fill in expr, location,
230 /// and ranges with expr to warn on and source locations/ranges appropriate
231 /// for a warning.
232 bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc,
233 SourceRange &R1, SourceRange &R2,
234 ASTContext &Ctx) const;
235
236 /// isLValue - True if this expression is an "l-value" according to
237 /// the rules of the current language. C and C++ give somewhat
238 /// different rules for this concept, but in general, the result of
239 /// an l-value expression identifies a specific object whereas the
240 /// result of an r-value expression is a value detached from any
241 /// specific storage.
242 ///
243 /// C++11 divides the concept of "r-value" into pure r-values
244 /// ("pr-values") and so-called expiring values ("x-values"), which
245 /// identify specific objects that can be safely cannibalized for
246 /// their resources. This is an unfortunate abuse of terminology on
247 /// the part of the C++ committee. In Clang, when we say "r-value",
248 /// we generally mean a pr-value.
249 bool isLValue() const { return getValueKind() == VK_LValue; }
250 bool isRValue() const { return getValueKind() == VK_RValue; }
251 bool isXValue() const { return getValueKind() == VK_XValue; }
252 bool isGLValue() const { return getValueKind() != VK_RValue; }
253
254 enum LValueClassification {
255 LV_Valid,
256 LV_NotObjectType,
257 LV_IncompleteVoidType,
258 LV_DuplicateVectorComponents,
259 LV_InvalidExpression,
260 LV_InvalidMessageExpression,
261 LV_MemberFunction,
262 LV_SubObjCPropertySetting,
263 LV_ClassTemporary,
264 LV_ArrayTemporary
265 };
266 /// Reasons why an expression might not be an l-value.
267 LValueClassification ClassifyLValue(ASTContext &Ctx) const;
268
269 enum isModifiableLvalueResult {
270 MLV_Valid,
271 MLV_NotObjectType,
272 MLV_IncompleteVoidType,
273 MLV_DuplicateVectorComponents,
274 MLV_InvalidExpression,
275 MLV_LValueCast, // Specialized form of MLV_InvalidExpression.
276 MLV_IncompleteType,
277 MLV_ConstQualified,
278 MLV_ConstQualifiedField,
279 MLV_ConstAddrSpace,
280 MLV_ArrayType,
281 MLV_NoSetterProperty,
282 MLV_MemberFunction,
283 MLV_SubObjCPropertySetting,
284 MLV_InvalidMessageExpression,
285 MLV_ClassTemporary,
286 MLV_ArrayTemporary
287 };
288 /// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
289 /// does not have an incomplete type, does not have a const-qualified type,
290 /// and if it is a structure or union, does not have any member (including,
291 /// recursively, any member or element of all contained aggregates or unions)
292 /// with a const-qualified type.
293 ///
294 /// \param Loc [in,out] - A source location which *may* be filled
295 /// in with the location of the expression making this a
296 /// non-modifiable lvalue, if specified.
297 isModifiableLvalueResult
298 isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc = nullptr) const;
299
300 /// The return type of classify(). Represents the C++11 expression
301 /// taxonomy.
302 class Classification {
303 public:
304 /// The various classification results. Most of these mean prvalue.
305 enum Kinds {
306 CL_LValue,
307 CL_XValue,
308 CL_Function, // Functions cannot be lvalues in C.
309 CL_Void, // Void cannot be an lvalue in C.
310 CL_AddressableVoid, // Void expression whose address can be taken in C.
311 CL_DuplicateVectorComponents, // A vector shuffle with dupes.
312 CL_MemberFunction, // An expression referring to a member function
313 CL_SubObjCPropertySetting,
314 CL_ClassTemporary, // A temporary of class type, or subobject thereof.
315 CL_ArrayTemporary, // A temporary of array type.
316 CL_ObjCMessageRValue, // ObjC message is an rvalue
317 CL_PRValue // A prvalue for any other reason, of any other type
318 };
319 /// The results of modification testing.
320 enum ModifiableType {
321 CM_Untested, // testModifiable was false.
322 CM_Modifiable,
323 CM_RValue, // Not modifiable because it's an rvalue
324 CM_Function, // Not modifiable because it's a function; C++ only
325 CM_LValueCast, // Same as CM_RValue, but indicates GCC cast-as-lvalue ext
326 CM_NoSetterProperty,// Implicit assignment to ObjC property without setter
327 CM_ConstQualified,
328 CM_ConstQualifiedField,
329 CM_ConstAddrSpace,
330 CM_ArrayType,
331 CM_IncompleteType
332 };
333
334 private:
335 friend class Expr;
336
337 unsigned short Kind;
338 unsigned short Modifiable;
339
340 explicit Classification(Kinds k, ModifiableType m)
341 : Kind(k), Modifiable(m)
342 {}
343
344 public:
345 Classification() {}
346
347 Kinds getKind() const { return static_cast<Kinds>(Kind); }
348 ModifiableType getModifiable() const {
349 assert(Modifiable != CM_Untested && "Did not test for modifiability.");
350 return static_cast<ModifiableType>(Modifiable);
351 }
352 bool isLValue() const { return Kind == CL_LValue; }
353 bool isXValue() const { return Kind == CL_XValue; }
354 bool isGLValue() const { return Kind <= CL_XValue; }
355 bool isPRValue() const { return Kind >= CL_Function; }
356 bool isRValue() const { return Kind >= CL_XValue; }
357 bool isModifiable() const { return getModifiable() == CM_Modifiable; }
358
359 /// Create a simple, modifiably lvalue
360 static Classification makeSimpleLValue() {
361 return Classification(CL_LValue, CM_Modifiable);
362 }
363
364 };
365 /// Classify - Classify this expression according to the C++11
366 /// expression taxonomy.
367 ///
368 /// C++11 defines ([basic.lval]) a new taxonomy of expressions to replace the
369 /// old lvalue vs rvalue. This function determines the type of expression this
370 /// is. There are three expression types:
371 /// - lvalues are classical lvalues as in C++03.
372 /// - prvalues are equivalent to rvalues in C++03.
373 /// - xvalues are expressions yielding unnamed rvalue references, e.g. a
374 /// function returning an rvalue reference.
375 /// lvalues and xvalues are collectively referred to as glvalues, while
376 /// prvalues and xvalues together form rvalues.
377 Classification Classify(ASTContext &Ctx) const {
378 return ClassifyImpl(Ctx, nullptr);
379 }
380
381 /// ClassifyModifiable - Classify this expression according to the
382 /// C++11 expression taxonomy, and see if it is valid on the left side
383 /// of an assignment.
384 ///
385 /// This function extends classify in that it also tests whether the
386 /// expression is modifiable (C99 6.3.2.1p1).
387 /// \param Loc A source location that might be filled with a relevant location
388 /// if the expression is not modifiable.
389 Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const{
390 return ClassifyImpl(Ctx, &Loc);
391 }
392
393 /// getValueKindForType - Given a formal return or parameter type,
394 /// give its value kind.
395 static ExprValueKind getValueKindForType(QualType T) {
396 if (const ReferenceType *RT = T->getAs<ReferenceType>())
397 return (isa<LValueReferenceType>(RT)
398 ? VK_LValue
399 : (RT->getPointeeType()->isFunctionType()
400 ? VK_LValue : VK_XValue));
401 return VK_RValue;
402 }
403
404 /// getValueKind - The value kind that this expression produces.
405 ExprValueKind getValueKind() const {
406 return static_cast<ExprValueKind>(ExprBits.ValueKind);
407 }
408
409 /// getObjectKind - The object kind that this expression produces.
410 /// Object kinds are meaningful only for expressions that yield an
411 /// l-value or x-value.
412 ExprObjectKind getObjectKind() const {
413 return static_cast<ExprObjectKind>(ExprBits.ObjectKind);
414 }
415
416 bool isOrdinaryOrBitFieldObject() const {
417 ExprObjectKind OK = getObjectKind();
418 return (OK == OK_Ordinary || OK == OK_BitField);
419 }
420
421 /// setValueKind - Set the value kind produced by this expression.
422 void setValueKind(ExprValueKind Cat) { ExprBits.ValueKind = Cat; }
423
424 /// setObjectKind - Set the object kind produced by this expression.
425 void setObjectKind(ExprObjectKind Cat) { ExprBits.ObjectKind = Cat; }
426
427 private:
428 Classification ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const;
429
430 public:
431
432 /// Returns true if this expression is a gl-value that
433 /// potentially refers to a bit-field.
434 ///
435 /// In C++, whether a gl-value refers to a bitfield is essentially
436 /// an aspect of the value-kind type system.
437 bool refersToBitField() const { return getObjectKind() == OK_BitField; }
438
439 /// If this expression refers to a bit-field, retrieve the
440 /// declaration of that bit-field.
441 ///
442 /// Note that this returns a non-null pointer in subtly different
443 /// places than refersToBitField returns true. In particular, this can
444 /// return a non-null pointer even for r-values loaded from
445 /// bit-fields, but it will return null for a conditional bit-field.
446 FieldDecl *getSourceBitField();
447
448 const FieldDecl *getSourceBitField() const {
449 return const_cast<Expr*>(this)->getSourceBitField();
450 }
451
452 Decl *getReferencedDeclOfCallee();
453 const Decl *getReferencedDeclOfCallee() const {
454 return const_cast<Expr*>(this)->getReferencedDeclOfCallee();
455 }
456
457 /// If this expression is an l-value for an Objective C
458 /// property, find the underlying property reference expression.
459 const ObjCPropertyRefExpr *getObjCProperty() const;
460
461 /// Check if this expression is the ObjC 'self' implicit parameter.
462 bool isObjCSelfExpr() const;
463
464 /// Returns whether this expression refers to a vector element.
465 bool refersToVectorElement() const;
466
467 /// Returns whether this expression refers to a global register
468 /// variable.
469 bool refersToGlobalRegisterVar() const;
470
471 /// Returns whether this expression has a placeholder type.
472 bool hasPlaceholderType() const {
473 return getType()->isPlaceholderType();
474 }
475
476 /// Returns whether this expression has a specific placeholder type.
477 bool hasPlaceholderType(BuiltinType::Kind K) const {
478 assert(BuiltinType::isPlaceholderTypeKind(K));
479 if (const BuiltinType *BT = dyn_cast<BuiltinType>(getType()))
480 return BT->getKind() == K;
481 return false;
482 }
483
484 /// isKnownToHaveBooleanValue - Return true if this is an integer expression
485 /// that is known to return 0 or 1. This happens for _Bool/bool expressions
486 /// but also int expressions which are produced by things like comparisons in
487 /// C.
488 bool isKnownToHaveBooleanValue() const;
489
490 /// isIntegerConstantExpr - Return true if this expression is a valid integer
491 /// constant expression, and, if so, return its value in Result. If not a
492 /// valid i-c-e, return false and fill in Loc (if specified) with the location
493 /// of the invalid expression.
494 ///
495 /// Note: This does not perform the implicit conversions required by C++11
496 /// [expr.const]p5.
497 bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx,
498 SourceLocation *Loc = nullptr,
499 bool isEvaluated = true) const;
500 bool isIntegerConstantExpr(const ASTContext &Ctx,
501 SourceLocation *Loc = nullptr) const;
502
503 /// isCXX98IntegralConstantExpr - Return true if this expression is an
504 /// integral constant expression in C++98. Can only be used in C++.
505 bool isCXX98IntegralConstantExpr(const ASTContext &Ctx) const;
506
507 /// isCXX11ConstantExpr - Return true if this expression is a constant
508 /// expression in C++11. Can only be used in C++.
509 ///
510 /// Note: This does not perform the implicit conversions required by C++11
511 /// [expr.const]p5.
512 bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result = nullptr,
513 SourceLocation *Loc = nullptr) const;
514
515 /// isPotentialConstantExpr - Return true if this function's definition
516 /// might be usable in a constant expression in C++11, if it were marked
517 /// constexpr. Return false if the function can never produce a constant
518 /// expression, along with diagnostics describing why not.
519 static bool isPotentialConstantExpr(const FunctionDecl *FD,
520 SmallVectorImpl<
521 PartialDiagnosticAt> &Diags);
522
523 /// isPotentialConstantExprUnevaluted - Return true if this expression might
524 /// be usable in a constant expression in C++11 in an unevaluated context, if
525 /// it were in function FD marked constexpr. Return false if the function can
526 /// never produce a constant expression, along with diagnostics describing
527 /// why not.
528 static bool isPotentialConstantExprUnevaluated(Expr *E,
529 const FunctionDecl *FD,
530 SmallVectorImpl<
531 PartialDiagnosticAt> &Diags);
532
533 /// isConstantInitializer - Returns true if this expression can be emitted to
534 /// IR as a constant, and thus can be used as a constant initializer in C.
535 /// If this expression is not constant and Culprit is non-null,
536 /// it is used to store the address of first non constant expr.
537 bool isConstantInitializer(ASTContext &Ctx, bool ForRef,
538 const Expr **Culprit = nullptr) const;
539
540 /// EvalStatus is a struct with detailed info about an evaluation in progress.
541 struct EvalStatus {
542 /// Whether the evaluated expression has side effects.
543 /// For example, (f() && 0) can be folded, but it still has side effects.
544 bool HasSideEffects;
545
546 /// Whether the evaluation hit undefined behavior.
547 /// For example, 1.0 / 0.0 can be folded to Inf, but has undefined behavior.
548 /// Likewise, INT_MAX + 1 can be folded to INT_MIN, but has UB.
549 bool HasUndefinedBehavior;
550
551 /// Diag - If this is non-null, it will be filled in with a stack of notes
552 /// indicating why evaluation failed (or why it failed to produce a constant
553 /// expression).
554 /// If the expression is unfoldable, the notes will indicate why it's not
555 /// foldable. If the expression is foldable, but not a constant expression,
556 /// the notes will describes why it isn't a constant expression. If the
557 /// expression *is* a constant expression, no notes will be produced.
558 SmallVectorImpl<PartialDiagnosticAt> *Diag;
559
560 EvalStatus()
561 : HasSideEffects(false), HasUndefinedBehavior(false), Diag(nullptr) {}
562
563 // hasSideEffects - Return true if the evaluated expression has
564 // side effects.
565 bool hasSideEffects() const {
566 return HasSideEffects;
567 }
568 };
569
570 /// EvalResult is a struct with detailed info about an evaluated expression.
571 struct EvalResult : EvalStatus {
572 /// Val - This is the value the expression can be folded to.
573 APValue Val;
574
575 // isGlobalLValue - Return true if the evaluated lvalue expression
576 // is global.
577 bool isGlobalLValue() const;
578 };
579
580 /// EvaluateAsRValue - Return true if this is a constant which we can fold to
581 /// an rvalue using any crazy technique (that has nothing to do with language
582 /// standards) that we want to, even if the expression has side-effects. If
583 /// this function returns true, it returns the folded constant in Result. If
584 /// the expression is a glvalue, an lvalue-to-rvalue conversion will be
585 /// applied.
586 bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx,
587 bool InConstantContext = false) const;
588
589 /// EvaluateAsBooleanCondition - Return true if this is a constant
590 /// which we can fold and convert to a boolean condition using
591 /// any crazy technique that we want to, even if the expression has
592 /// side-effects.
593 bool EvaluateAsBooleanCondition(bool &Result, const ASTContext &Ctx) const;
594
595 enum SideEffectsKind {
596 SE_NoSideEffects, ///< Strictly evaluate the expression.
597 SE_AllowUndefinedBehavior, ///< Allow UB that we can give a value, but not
598 ///< arbitrary unmodeled side effects.
599 SE_AllowSideEffects ///< Allow any unmodeled side effect.
600 };
601
602 /// EvaluateAsInt - Return true if this is a constant which we can fold and
603 /// convert to an integer, using any crazy technique that we want to.
604 bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx,
605 SideEffectsKind AllowSideEffects = SE_NoSideEffects) const;
606
607 /// EvaluateAsFloat - Return true if this is a constant which we can fold and
608 /// convert to a floating point value, using any crazy technique that we
609 /// want to.
610 bool
611 EvaluateAsFloat(llvm::APFloat &Result, const ASTContext &Ctx,
612 SideEffectsKind AllowSideEffects = SE_NoSideEffects) const;
613
614 /// isEvaluatable - Call EvaluateAsRValue to see if this expression can be
615 /// constant folded without side-effects, but discard the result.
616 bool isEvaluatable(const ASTContext &Ctx,
617 SideEffectsKind AllowSideEffects = SE_NoSideEffects) const;
618
619 /// HasSideEffects - This routine returns true for all those expressions
620 /// which have any effect other than producing a value. Example is a function
621 /// call, volatile variable read, or throwing an exception. If
622 /// IncludePossibleEffects is false, this call treats certain expressions with
623 /// potential side effects (such as function call-like expressions,
624 /// instantiation-dependent expressions, or invocations from a macro) as not
625 /// having side effects.
626 bool HasSideEffects(const ASTContext &Ctx,
627 bool IncludePossibleEffects = true) const;
628
629 /// Determine whether this expression involves a call to any function
630 /// that is not trivial.
631 bool hasNonTrivialCall(const ASTContext &Ctx) const;
632
633 /// EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded
634 /// integer. This must be called on an expression that constant folds to an
635 /// integer.
636 llvm::APSInt EvaluateKnownConstInt(
637 const ASTContext &Ctx,
638 SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr) const;
639
640 llvm::APSInt EvaluateKnownConstIntCheckOverflow(
641 const ASTContext &Ctx,
642 SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr) const;
643
644 void EvaluateForOverflow(const ASTContext &Ctx) const;
645
646 /// EvaluateAsLValue - Evaluate an expression to see if we can fold it to an
647 /// lvalue with link time known address, with no side-effects.
648 bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx) const;
649
650 /// EvaluateAsInitializer - Evaluate an expression as if it were the
651 /// initializer of the given declaration. Returns true if the initializer
652 /// can be folded to a constant, and produces any relevant notes. In C++11,
653 /// notes will be produced if the expression is not a constant expression.
654 bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx,
655 const VarDecl *VD,
656 SmallVectorImpl<PartialDiagnosticAt> &Notes) const;
657
658 /// EvaluateWithSubstitution - Evaluate an expression as if from the context
659 /// of a call to the given function with the given arguments, inside an
660 /// unevaluated context. Returns true if the expression could be folded to a
661 /// constant.
662 bool EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx,
663 const FunctionDecl *Callee,
664 ArrayRef<const Expr*> Args,
665 const Expr *This = nullptr) const;
666
667 /// Indicates how the constant expression will be used.
668 enum ConstExprUsage { EvaluateForCodeGen, EvaluateForMangling };
669
670 /// Evaluate an expression that is required to be a constant expression.
671 bool EvaluateAsConstantExpr(EvalResult &Result, ConstExprUsage Usage,
672 const ASTContext &Ctx) const;
673
674 /// If the current Expr is a pointer, this will try to statically
675 /// determine the number of bytes available where the pointer is pointing.
676 /// Returns true if all of the above holds and we were able to figure out the
677 /// size, false otherwise.
678 ///
679 /// \param Type - How to evaluate the size of the Expr, as defined by the
680 /// "type" parameter of __builtin_object_size
681 bool tryEvaluateObjectSize(uint64_t &Result, ASTContext &Ctx,
682 unsigned Type) const;
683
684 /// Enumeration used to describe the kind of Null pointer constant
685 /// returned from \c isNullPointerConstant().
686 enum NullPointerConstantKind {
687 /// Expression is not a Null pointer constant.
688 NPCK_NotNull = 0,
689
690 /// Expression is a Null pointer constant built from a zero integer
691 /// expression that is not a simple, possibly parenthesized, zero literal.
692 /// C++ Core Issue 903 will classify these expressions as "not pointers"
693 /// once it is adopted.
694 /// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#903
695 NPCK_ZeroExpression,
696
697 /// Expression is a Null pointer constant built from a literal zero.
698 NPCK_ZeroLiteral,
699
700 /// Expression is a C++11 nullptr.
701 NPCK_CXX11_nullptr,
702
703 /// Expression is a GNU-style __null constant.
704 NPCK_GNUNull
705 };
706
707 /// Enumeration used to describe how \c isNullPointerConstant()
708 /// should cope with value-dependent expressions.
709 enum NullPointerConstantValueDependence {
710 /// Specifies that the expression should never be value-dependent.
711 NPC_NeverValueDependent = 0,
712
713 /// Specifies that a value-dependent expression of integral or
714 /// dependent type should be considered a null pointer constant.
715 NPC_ValueDependentIsNull,
716
717 /// Specifies that a value-dependent expression should be considered
718 /// to never be a null pointer constant.
719 NPC_ValueDependentIsNotNull
720 };
721
722 /// isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to
723 /// a Null pointer constant. The return value can further distinguish the
724 /// kind of NULL pointer constant that was detected.
725 NullPointerConstantKind isNullPointerConstant(
726 ASTContext &Ctx,
727 NullPointerConstantValueDependence NPC) const;
728
729 /// isOBJCGCCandidate - Return true if this expression may be used in a read/
730 /// write barrier.
731 bool isOBJCGCCandidate(ASTContext &Ctx) const;
732
733 /// Returns true if this expression is a bound member function.
734 bool isBoundMemberFunction(ASTContext &Ctx) const;
735
736 /// Given an expression of bound-member type, find the type
737 /// of the member. Returns null if this is an *overloaded* bound
738 /// member expression.
739 static QualType findBoundMemberType(const Expr *expr);
740
741 /// IgnoreImpCasts - Skip past any implicit casts which might
742 /// surround this expression. Only skips ImplicitCastExprs.
743 Expr *IgnoreImpCasts() LLVM_READONLY;
744
745 /// IgnoreImplicit - Skip past any implicit AST nodes which might
746 /// surround this expression.
747 Expr *IgnoreImplicit() LLVM_READONLY {
748 return cast<Expr>(Stmt::IgnoreImplicit());
749 }
750
751 const Expr *IgnoreImplicit() const LLVM_READONLY {
752 return const_cast<Expr*>(this)->IgnoreImplicit();
753 }
754
755 /// IgnoreParens - Ignore parentheses. If this Expr is a ParenExpr, return
756 /// its subexpression. If that subexpression is also a ParenExpr,
757 /// then this method recursively returns its subexpression, and so forth.
758 /// Otherwise, the method returns the current Expr.
759 Expr *IgnoreParens() LLVM_READONLY;
760
761 /// IgnoreParenCasts - Ignore parentheses and casts. Strip off any ParenExpr
762 /// or CastExprs, returning their operand.
763 Expr *IgnoreParenCasts() LLVM_READONLY;
764
765 /// Ignore casts. Strip off any CastExprs, returning their operand.
766 Expr *IgnoreCasts() LLVM_READONLY;
767
768 /// IgnoreParenImpCasts - Ignore parentheses and implicit casts. Strip off
769 /// any ParenExpr or ImplicitCastExprs, returning their operand.
770 Expr *IgnoreParenImpCasts() LLVM_READONLY;
771
772 /// IgnoreConversionOperator - Ignore conversion operator. If this Expr is a
773 /// call to a conversion operator, return the argument.
774 Expr *IgnoreConversionOperator() LLVM_READONLY;
775
776 const Expr *IgnoreConversionOperator() const LLVM_READONLY {
777 return const_cast<Expr*>(this)->IgnoreConversionOperator();
778 }
779
780 const Expr *IgnoreParenImpCasts() const LLVM_READONLY {
781 return const_cast<Expr*>(this)->IgnoreParenImpCasts();
782 }
783
784 /// Ignore parentheses and lvalue casts. Strip off any ParenExpr and
785 /// CastExprs that represent lvalue casts, returning their operand.
786 Expr *IgnoreParenLValueCasts() LLVM_READONLY;
787
788 const Expr *IgnoreParenLValueCasts() const LLVM_READONLY {
789 return const_cast<Expr*>(this)->IgnoreParenLValueCasts();
790 }
791
792 /// IgnoreParenNoopCasts - Ignore parentheses and casts that do not change the
793 /// value (including ptr->int casts of the same size). Strip off any
794 /// ParenExpr or CastExprs, returning their operand.
795 Expr *IgnoreParenNoopCasts(ASTContext &Ctx) LLVM_READONLY;
796
797 /// Ignore parentheses and derived-to-base casts.
798 Expr *ignoreParenBaseCasts() LLVM_READONLY;
799
800 const Expr *ignoreParenBaseCasts() const LLVM_READONLY {
801 return const_cast<Expr*>(this)->ignoreParenBaseCasts();
802 }
803
804 /// Determine whether this expression is a default function argument.
805 ///
806 /// Default arguments are implicitly generated in the abstract syntax tree
807 /// by semantic analysis for function calls, object constructions, etc. in
808 /// C++. Default arguments are represented by \c CXXDefaultArgExpr nodes;
809 /// this routine also looks through any implicit casts to determine whether
810 /// the expression is a default argument.
811 bool isDefaultArgument() const;
812
813 /// Determine whether the result of this expression is a
814 /// temporary object of the given class type.
815 bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const;
816
817 /// Whether this expression is an implicit reference to 'this' in C++.
818 bool isImplicitCXXThis() const;
819
820 const Expr *IgnoreImpCasts() const LLVM_READONLY {
821 return const_cast<Expr*>(this)->IgnoreImpCasts();
822 }
823 const Expr *IgnoreParens() const LLVM_READONLY {
824 return const_cast<Expr*>(this)->IgnoreParens();
825 }
826 const Expr *IgnoreParenCasts() const LLVM_READONLY {
827 return const_cast<Expr*>(this)->IgnoreParenCasts();
828 }
829 /// Strip off casts, but keep parentheses.
830 const Expr *IgnoreCasts() const LLVM_READONLY {
831 return const_cast<Expr*>(this)->IgnoreCasts();
832 }
833
834 const Expr *IgnoreParenNoopCasts(ASTContext &Ctx) const LLVM_READONLY {
835 return const_cast<Expr*>(this)->IgnoreParenNoopCasts(Ctx);
836 }
837
838 static bool hasAnyTypeDependentArguments(ArrayRef<Expr *> Exprs);
839
840 /// For an expression of class type or pointer to class type,
841 /// return the most derived class decl the expression is known to refer to.
842 ///
843 /// If this expression is a cast, this method looks through it to find the
844 /// most derived decl that can be inferred from the expression.
845 /// This is valid because derived-to-base conversions have undefined
846 /// behavior if the object isn't dynamically of the derived type.
847 const CXXRecordDecl *getBestDynamicClassType() const;
848
849 /// Get the inner expression that determines the best dynamic class.
850 /// If this is a prvalue, we guarantee that it is of the most-derived type
851 /// for the object itself.
852 const Expr *getBestDynamicClassTypeExpr() const;
853
854 /// Walk outwards from an expression we want to bind a reference to and
855 /// find the expression whose lifetime needs to be extended. Record
856 /// the LHSs of comma expressions and adjustments needed along the path.
857 const Expr *skipRValueSubobjectAdjustments(
858 SmallVectorImpl<const Expr *> &CommaLHS,
859 SmallVectorImpl<SubobjectAdjustment> &Adjustments) const;
860 const Expr *skipRValueSubobjectAdjustments() const {
861 SmallVector<const Expr *, 8> CommaLHSs;
862 SmallVector<SubobjectAdjustment, 8> Adjustments;
863 return skipRValueSubobjectAdjustments(CommaLHSs, Adjustments);
864 }
865
866 static bool classof(const Stmt *T) {
867 return T->getStmtClass() >= firstExprConstant &&
868 T->getStmtClass() <= lastExprConstant;
869 }
870 };
871
872 //===----------------------------------------------------------------------===//
873 // Wrapper Expressions.
874 //===----------------------------------------------------------------------===//
875
876 /// FullExpr - Represents a "full-expression" node.
877 class FullExpr : public Expr {
878 protected:
879 Stmt *SubExpr;
880
881 FullExpr(StmtClass SC, Expr *subexpr)
882 : Expr(SC, subexpr->getType(),
883 subexpr->getValueKind(), subexpr->getObjectKind(),
884 subexpr->isTypeDependent(), subexpr->isValueDependent(),
885 subexpr->isInstantiationDependent(),
886 subexpr->containsUnexpandedParameterPack()), SubExpr(subexpr) {}
887 FullExpr(StmtClass SC, EmptyShell Empty)
888 : Expr(SC, Empty) {}
889 public:
890 const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
891 Expr *getSubExpr() { return cast<Expr>(SubExpr); }
892
893 /// As with any mutator of the AST, be very careful when modifying an
894 /// existing AST to preserve its invariants.
895 void setSubExpr(Expr *E) { SubExpr = E; }
896
897 static bool classof(const Stmt *T) {
898 return T->getStmtClass() >= firstFullExprConstant &&
899 T->getStmtClass() <= lastFullExprConstant;
900 }
901 };
902
903 /// ConstantExpr - An expression that occurs in a constant context.
904 class ConstantExpr : public FullExpr {
905 ConstantExpr(Expr *subexpr)
906 : FullExpr(ConstantExprClass, subexpr) {}
907
908 public:
909 static ConstantExpr *Create(const ASTContext &Context, Expr *E) {
910 assert(!isa<ConstantExpr>(E));
911 return new (Context) ConstantExpr(E);
912 }
913
914 /// Build an empty constant expression wrapper.
915 explicit ConstantExpr(EmptyShell Empty)
916 : FullExpr(ConstantExprClass, Empty) {}
917
918 SourceLocation getBeginLoc() const LLVM_READONLY {
919 return SubExpr->getBeginLoc();
920 }
921 SourceLocation getEndLoc() const LLVM_READONLY {
922 return SubExpr->getEndLoc();
923 }
924
925 static bool classof(const Stmt *T) {
926 return T->getStmtClass() == ConstantExprClass;
927 }
928
929 // Iterators
930 child_range children() { return child_range(&SubExpr, &SubExpr+1); }
931 const_child_range children() const {
932 return const_child_range(&SubExpr, &SubExpr + 1);
933 }
934 };
935
936 //===----------------------------------------------------------------------===//
937 // Primary Expressions.
938 //===----------------------------------------------------------------------===//
939
940 /// OpaqueValueExpr - An expression referring to an opaque object of a
941 /// fixed type and value class. These don't correspond to concrete
942 /// syntax; instead they're used to express operations (usually copy
943 /// operations) on values whose source is generally obvious from
944 /// context.
945 class OpaqueValueExpr : public Expr {
946 friend class ASTStmtReader;
947 Expr *SourceExpr;
948
949 public:
950 OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK,
951 ExprObjectKind OK = OK_Ordinary,
952 Expr *SourceExpr = nullptr)
953 : Expr(OpaqueValueExprClass, T, VK, OK,
954 T->isDependentType() ||
955 (SourceExpr && SourceExpr->isTypeDependent()),
956 T->isDependentType() ||
957 (SourceExpr && SourceExpr->isValueDependent()),
958 T->isInstantiationDependentType() ||
959 (SourceExpr && SourceExpr->isInstantiationDependent()),
960 false),
961 SourceExpr(SourceExpr) {
962 setIsUnique(false);
963 OpaqueValueExprBits.Loc = Loc;
964 }
965
966 /// Given an expression which invokes a copy constructor --- i.e. a
967 /// CXXConstructExpr, possibly wrapped in an ExprWithCleanups ---
968 /// find the OpaqueValueExpr that's the source of the construction.
969 static const OpaqueValueExpr *findInCopyConstruct(const Expr *expr);
970
971 explicit OpaqueValueExpr(EmptyShell Empty)
972 : Expr(OpaqueValueExprClass, Empty) {}
973
974 /// Retrieve the location of this expression.
975 SourceLocation getLocation() const { return OpaqueValueExprBits.Loc; }
976
977 SourceLocation getBeginLoc() const LLVM_READONLY {
978 return SourceExpr ? SourceExpr->getBeginLoc() : getLocation();
979 }
980 SourceLocation getEndLoc() const LLVM_READONLY {
981 return SourceExpr ? SourceExpr->getEndLoc() : getLocation();
982 }
983 SourceLocation getExprLoc() const LLVM_READONLY {
984 return SourceExpr ? SourceExpr->getExprLoc() : getLocation();
985 }
986
987 child_range children() {
988 return child_range(child_iterator(), child_iterator());
989 }
990
991 const_child_range children() const {
992 return const_child_range(const_child_iterator(), const_child_iterator());
993 }
994
995 /// The source expression of an opaque value expression is the
996 /// expression which originally generated the value. This is
997 /// provided as a convenience for analyses that don't wish to
998 /// precisely model the execution behavior of the program.
999 ///
1000 /// The source expression is typically set when building the
1001 /// expression which binds the opaque value expression in the first
1002 /// place.
1003 Expr *getSourceExpr() const { return SourceExpr; }
1004
1005 void setIsUnique(bool V) {
1006 assert((!V || SourceExpr) &&
1007 "unique OVEs are expected to have source expressions");
1008 OpaqueValueExprBits.IsUnique = V;
1009 }
1010
1011 bool isUnique() const { return OpaqueValueExprBits.IsUnique; }
1012
1013 static bool classof(const Stmt *T) {
1014 return T->getStmtClass() == OpaqueValueExprClass;
1015 }
1016 };
1017
1018 /// A reference to a declared variable, function, enum, etc.
1019 /// [C99 6.5.1p2]
1020 ///
1021 /// This encodes all the information about how a declaration is referenced
1022 /// within an expression.
1023 ///
1024 /// There are several optional constructs attached to DeclRefExprs only when
1025 /// they apply in order to conserve memory. These are laid out past the end of
1026 /// the object, and flags in the DeclRefExprBitfield track whether they exist:
1027 ///
1028 /// DeclRefExprBits.HasQualifier:
1029 /// Specifies when this declaration reference expression has a C++
1030 /// nested-name-specifier.
1031 /// DeclRefExprBits.HasFoundDecl:
1032 /// Specifies when this declaration reference expression has a record of
1033 /// a NamedDecl (different from the referenced ValueDecl) which was found
1034 /// during name lookup and/or overload resolution.
1035 /// DeclRefExprBits.HasTemplateKWAndArgsInfo:
1036 /// Specifies when this declaration reference expression has an explicit
1037 /// C++ template keyword and/or template argument list.
1038 /// DeclRefExprBits.RefersToEnclosingVariableOrCapture
1039 /// Specifies when this declaration reference expression (validly)
1040 /// refers to an enclosed local or a captured variable.
1041 class DeclRefExpr final
1042 : public Expr,
1043 private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
1044 NamedDecl *, ASTTemplateKWAndArgsInfo,
1045 TemplateArgumentLoc> {
1046 friend class ASTStmtReader;
1047 friend class ASTStmtWriter;
1048 friend TrailingObjects;
1049
1050 /// The declaration that we are referencing.
1051 ValueDecl *D;
1052
1053 /// Provides source/type location info for the declaration name
1054 /// embedded in D.
1055 DeclarationNameLoc DNLoc;
1056
1057 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>) const {
1058 return hasQualifier();
1059 }
1060
1061 size_t numTrailingObjects(OverloadToken<NamedDecl *>) const {
1062 return hasFoundDecl();
1063 }
1064
1065 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
1066 return hasTemplateKWAndArgsInfo();
1067 }
1068
1069 /// Test whether there is a distinct FoundDecl attached to the end of
1070 /// this DRE.
1071 bool hasFoundDecl() const { return DeclRefExprBits.HasFoundDecl; }
1072
1073 DeclRefExpr(const ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc,
1074 SourceLocation TemplateKWLoc, ValueDecl *D,
1075 bool RefersToEnlosingVariableOrCapture,
1076 const DeclarationNameInfo &NameInfo, NamedDecl *FoundD,
1077 const TemplateArgumentListInfo *TemplateArgs, QualType T,
1078 ExprValueKind VK);
1079
1080 /// Construct an empty declaration reference expression.
1081 explicit DeclRefExpr(EmptyShell Empty) : Expr(DeclRefExprClass, Empty) {}
1082
1083 /// Computes the type- and value-dependence flags for this
1084 /// declaration reference expression.
1085 void computeDependence(const ASTContext &Ctx);
1086
1087 public:
1088 DeclRefExpr(const ASTContext &Ctx, ValueDecl *D,
1089 bool RefersToEnclosingVariableOrCapture, QualType T,
1090 ExprValueKind VK, SourceLocation L,
1091 const DeclarationNameLoc &LocInfo = DeclarationNameLoc());
1092
1093 static DeclRefExpr *
1094 Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1095 SourceLocation TemplateKWLoc, ValueDecl *D,
1096 bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
1097 QualType T, ExprValueKind VK, NamedDecl *FoundD = nullptr,
1098 const TemplateArgumentListInfo *TemplateArgs = nullptr);
1099
1100 static DeclRefExpr *
1101 Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
1102 SourceLocation TemplateKWLoc, ValueDecl *D,
1103 bool RefersToEnclosingVariableOrCapture,
1104 const DeclarationNameInfo &NameInfo, QualType T, ExprValueKind VK,
1105 NamedDecl *FoundD = nullptr,
1106 const TemplateArgumentListInfo *TemplateArgs = nullptr);
1107
1108 /// Construct an empty declaration reference expression.
1109 static DeclRefExpr *CreateEmpty(const ASTContext &Context, bool HasQualifier,
1110 bool HasFoundDecl,
1111 bool HasTemplateKWAndArgsInfo,
1112 unsigned NumTemplateArgs);
1113
1114 ValueDecl *getDecl() { return D; }
1115 const ValueDecl *getDecl() const { return D; }
1116 void setDecl(ValueDecl *NewD) { D = NewD; }
1117
1118 DeclarationNameInfo getNameInfo() const {
1119 return DeclarationNameInfo(getDecl()->getDeclName(), getLocation(), DNLoc);
1120 }
1121
1122 SourceLocation getLocation() const { return DeclRefExprBits.Loc; }
1123 void setLocation(SourceLocation L) { DeclRefExprBits.Loc = L; }
1124 SourceLocation getBeginLoc() const LLVM_READONLY;
1125 SourceLocation getEndLoc() const LLVM_READONLY;
1126
1127 /// Determine whether this declaration reference was preceded by a
1128 /// C++ nested-name-specifier, e.g., \c N::foo.
1129 bool hasQualifier() const { return DeclRefExprBits.HasQualifier; }
1130
1131 /// If the name was qualified, retrieves the nested-name-specifier
1132 /// that precedes the name, with source-location information.
1133 NestedNameSpecifierLoc getQualifierLoc() const {
1134 if (!hasQualifier())
1135 return NestedNameSpecifierLoc();
1136 return *getTrailingObjects<NestedNameSpecifierLoc>();
1137 }
1138
1139 /// If the name was qualified, retrieves the nested-name-specifier
1140 /// that precedes the name. Otherwise, returns NULL.
1141 NestedNameSpecifier *getQualifier() const {
1142 return getQualifierLoc().getNestedNameSpecifier();
1143 }
1144
1145 /// Get the NamedDecl through which this reference occurred.
1146 ///
1147 /// This Decl may be different from the ValueDecl actually referred to in the
1148 /// presence of using declarations, etc. It always returns non-NULL, and may
1149 /// simple return the ValueDecl when appropriate.
1150
1151 NamedDecl *getFoundDecl() {
1152 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1153 }
1154
1155 /// Get the NamedDecl through which this reference occurred.
1156 /// See non-const variant.
1157 const NamedDecl *getFoundDecl() const {
1158 return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
1159 }
1160
1161 bool hasTemplateKWAndArgsInfo() const {
1162 return DeclRefExprBits.HasTemplateKWAndArgsInfo;
1163 }
1164
1165 /// Retrieve the location of the template keyword preceding
1166 /// this name, if any.
1167 SourceLocation getTemplateKeywordLoc() const {
1168 if (!hasTemplateKWAndArgsInfo())
1169 return SourceLocation();
1170 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
1171 }
1172
1173 /// Retrieve the location of the left angle bracket starting the
1174 /// explicit template argument list following the name, if any.
1175 SourceLocation getLAngleLoc() const {
1176 if (!hasTemplateKWAndArgsInfo())
1177 return SourceLocation();
1178 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
1179 }
1180
1181 /// Retrieve the location of the right angle bracket ending the
1182 /// explicit template argument list following the name, if any.
1183 SourceLocation getRAngleLoc() const {
1184 if (!hasTemplateKWAndArgsInfo())
1185 return SourceLocation();
1186 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
1187 }
1188
1189 /// Determines whether the name in this declaration reference
1190 /// was preceded by the template keyword.
1191 bool hasTemplateKeyword() const { return getTemplateKeywordLoc().isValid(); }
1192
1193 /// Determines whether this declaration reference was followed by an
1194 /// explicit template argument list.
1195 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
1196
1197 /// Copies the template arguments (if present) into the given
1198 /// structure.
1199 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
1200 if (hasExplicitTemplateArgs())
1201 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
1202 getTrailingObjects<TemplateArgumentLoc>(), List);
1203 }
1204
1205 /// Retrieve the template arguments provided as part of this
1206 /// template-id.
1207 const TemplateArgumentLoc *getTemplateArgs() const {
1208 if (!hasExplicitTemplateArgs())
1209 return nullptr;
1210 return getTrailingObjects<TemplateArgumentLoc>();
1211 }
1212
1213 /// Retrieve the number of template arguments provided as part of this
1214 /// template-id.
1215 unsigned getNumTemplateArgs() const {
1216 if (!hasExplicitTemplateArgs())
1217 return 0;
1218 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
1219 }
1220
1221 ArrayRef<TemplateArgumentLoc> template_arguments() const {
1222 return {getTemplateArgs(), getNumTemplateArgs()};
1223 }
1224
1225 /// Returns true if this expression refers to a function that
1226 /// was resolved from an overloaded set having size greater than 1.
1227 bool hadMultipleCandidates() const {
1228 return DeclRefExprBits.HadMultipleCandidates;
1229 }
1230 /// Sets the flag telling whether this expression refers to
1231 /// a function that was resolved from an overloaded set having size
1232 /// greater than 1.
1233 void setHadMultipleCandidates(bool V = true) {
1234 DeclRefExprBits.HadMultipleCandidates = V;
1235 }
1236
1237 /// Does this DeclRefExpr refer to an enclosing local or a captured
1238 /// variable?
1239 bool refersToEnclosingVariableOrCapture() const {
1240 return DeclRefExprBits.RefersToEnclosingVariableOrCapture;
1241 }
1242
1243 static bool classof(const Stmt *T) {
1244 return T->getStmtClass() == DeclRefExprClass;
1245 }
1246
1247 // Iterators
1248 child_range children() {
1249 return child_range(child_iterator(), child_iterator());
1250 }
1251
1252 const_child_range children() const {
1253 return const_child_range(const_child_iterator(), const_child_iterator());
1254 }
1255 };
1256
1257 /// Used by IntegerLiteral/FloatingLiteral to store the numeric without
1258 /// leaking memory.
1259 ///
1260 /// For large floats/integers, APFloat/APInt will allocate memory from the heap
1261 /// to represent these numbers. Unfortunately, when we use a BumpPtrAllocator
1262 /// to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
1263 /// the APFloat/APInt values will never get freed. APNumericStorage uses
1264 /// ASTContext's allocator for memory allocation.
1265 class APNumericStorage {
1266 union {
1267 uint64_t VAL; ///< Used to store the <= 64 bits integer value.
1268 uint64_t *pVal; ///< Used to store the >64 bits integer value.
1269 };
1270 unsigned BitWidth;
1271
1272 bool hasAllocation() const { return llvm::APInt::getNumWords(BitWidth) > 1; }
1273
1274 APNumericStorage(const APNumericStorage &) = delete;
1275 void operator=(const APNumericStorage &) = delete;
1276
1277 protected:
1278 APNumericStorage() : VAL(0), BitWidth(0) { }
1279
1280 llvm::APInt getIntValue() const {
1281 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
1282 if (NumWords > 1)
1283 return llvm::APInt(BitWidth, NumWords, pVal);
1284 else
1285 return llvm::APInt(BitWidth, VAL);
1286 }
1287 void setIntValue(const ASTContext &C, const llvm::APInt &Val);
1288 };
1289
1290 class APIntStorage : private APNumericStorage {
1291 public:
1292 llvm::APInt getValue() const { return getIntValue(); }
1293 void setValue(const ASTContext &C, const llvm::APInt &Val) {
1294 setIntValue(C, Val);
1295 }
1296 };
1297
1298 class APFloatStorage : private APNumericStorage {
1299 public:
1300 llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const {
1301 return llvm::APFloat(Semantics, getIntValue());
1302 }
1303 void setValue(const ASTContext &C, const llvm::APFloat &Val) {
1304 setIntValue(C, Val.bitcastToAPInt());
1305 }
1306 };
1307
1308 class IntegerLiteral : public Expr, public APIntStorage {
1309 SourceLocation Loc;
1310
1311 /// Construct an empty integer literal.
1312 explicit IntegerLiteral(EmptyShell Empty)
1313 : Expr(IntegerLiteralClass, Empty) { }
1314
1315 public:
1316 // type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
1317 // or UnsignedLongLongTy
1318 IntegerLiteral(const ASTContext &C, const llvm::APInt &V, QualType type,
1319 SourceLocation l);
1320
1321 /// Returns a new integer literal with value 'V' and type 'type'.
1322 /// \param type - either IntTy, LongTy, LongLongTy, UnsignedIntTy,
1323 /// UnsignedLongTy, or UnsignedLongLongTy which should match the size of V
1324 /// \param V - the value that the returned integer literal contains.
1325 static IntegerLiteral *Create(const ASTContext &C, const llvm::APInt &V,
1326 QualType type, SourceLocation l);
1327 /// Returns a new empty integer literal.
1328 static IntegerLiteral *Create(const ASTContext &C, EmptyShell Empty);
1329
1330 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1331 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1332
1333 /// Retrieve the location of the literal.
1334 SourceLocation getLocation() const { return Loc; }
1335
1336 void setLocation(SourceLocation Location) { Loc = Location; }
1337
1338 static bool classof(const Stmt *T) {
1339 return T->getStmtClass() == IntegerLiteralClass;
1340 }
1341
1342 // Iterators
1343 child_range children() {
1344 return child_range(child_iterator(), child_iterator());
1345 }
1346 const_child_range children() const {
1347 return const_child_range(const_child_iterator(), const_child_iterator());
1348 }
1349 };
1350
1351 class FixedPointLiteral : public Expr, public APIntStorage {
1352 SourceLocation Loc;
1353 unsigned Scale;
1354
1355 /// \brief Construct an empty integer literal.
1356 explicit FixedPointLiteral(EmptyShell Empty)
1357 : Expr(FixedPointLiteralClass, Empty) {}
1358
1359 public:
1360 FixedPointLiteral(const ASTContext &C, const llvm::APInt &V, QualType type,
1361 SourceLocation l, unsigned Scale);
1362
1363 // Store the int as is without any bit shifting.
1364 static FixedPointLiteral *CreateFromRawInt(const ASTContext &C,
1365 const llvm::APInt &V,
1366 QualType type, SourceLocation l,
1367 unsigned Scale);
1368
1369 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1370 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1371
1372 /// \brief Retrieve the location of the literal.
1373 SourceLocation getLocation() const { return Loc; }
1374
1375 void setLocation(SourceLocation Location) { Loc = Location; }
1376
1377 static bool classof(const Stmt *T) {
1378 return T->getStmtClass() == FixedPointLiteralClass;
1379 }
1380
1381 std::string getValueAsString(unsigned Radix) const;
1382
1383 // Iterators
1384 child_range children() {
1385 return child_range(child_iterator(), child_iterator());
1386 }
1387 const_child_range children() const {
1388 return const_child_range(const_child_iterator(), const_child_iterator());
1389 }
1390 };
1391
1392 class CharacterLiteral : public Expr {
1393 public:
1394 enum CharacterKind {
1395 Ascii,
1396 Wide,
1397 UTF8,
1398 UTF16,
1399 UTF32
1400 };
1401
1402 private:
1403 unsigned Value;
1404 SourceLocation Loc;
1405 public:
1406 // type should be IntTy
1407 CharacterLiteral(unsigned value, CharacterKind kind, QualType type,
1408 SourceLocation l)
1409 : Expr(CharacterLiteralClass, type, VK_RValue, OK_Ordinary, false, false,
1410 false, false),
1411 Value(value), Loc(l) {
1412 CharacterLiteralBits.Kind = kind;
1413 }
1414
1415 /// Construct an empty character literal.
1416 CharacterLiteral(EmptyShell Empty) : Expr(CharacterLiteralClass, Empty) { }
1417
1418 SourceLocation getLocation() const { return Loc; }
1419 CharacterKind getKind() const {
1420 return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
1421 }
1422
1423 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1424 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1425
1426 unsigned getValue() const { return Value; }
1427
1428 void setLocation(SourceLocation Location) { Loc = Location; }
1429 void setKind(CharacterKind kind) { CharacterLiteralBits.Kind = kind; }
1430 void setValue(unsigned Val) { Value = Val; }
1431
1432 static bool classof(const Stmt *T) {
1433 return T->getStmtClass() == CharacterLiteralClass;
1434 }
1435
1436 // Iterators
1437 child_range children() {
1438 return child_range(child_iterator(), child_iterator());
1439 }
1440 const_child_range children() const {
1441 return const_child_range(const_child_iterator(), const_child_iterator());
1442 }
1443 };
1444
1445 class FloatingLiteral : public Expr, private APFloatStorage {
1446 SourceLocation Loc;
1447
1448 FloatingLiteral(const ASTContext &C, const llvm::APFloat &V, bool isexact,
1449 QualType Type, SourceLocation L);
1450
1451 /// Construct an empty floating-point literal.
1452 explicit FloatingLiteral(const ASTContext &C, EmptyShell Empty);
1453
1454 public:
1455 static FloatingLiteral *Create(const ASTContext &C, const llvm::APFloat &V,
1456 bool isexact, QualType Type, SourceLocation L);
1457 static FloatingLiteral *Create(const ASTContext &C, EmptyShell Empty);
1458
1459 llvm::APFloat getValue() const {
1460 return APFloatStorage::getValue(getSemantics());
1461 }
1462 void setValue(const ASTContext &C, const llvm::APFloat &Val) {
1463 assert(&getSemantics() == &Val.getSemantics() && "Inconsistent semantics");
1464 APFloatStorage::setValue(C, Val);
1465 }
1466
1467 /// Get a raw enumeration value representing the floating-point semantics of
1468 /// this literal (32-bit IEEE, x87, ...), suitable for serialisation.
1469 APFloatSemantics getRawSemantics() const {
1470 return static_cast<APFloatSemantics>(FloatingLiteralBits.Semantics);
1471 }
1472
1473 /// Set the raw enumeration value representing the floating-point semantics of
1474 /// this literal (32-bit IEEE, x87, ...), suitable for serialisation.
1475 void setRawSemantics(APFloatSemantics Sem) {
1476 FloatingLiteralBits.Semantics = Sem;
1477 }
1478
1479 /// Return the APFloat semantics this literal uses.
1480 const llvm::fltSemantics &getSemantics() const;
1481
1482 /// Set the APFloat semantics this literal uses.
1483 void setSemantics(const llvm::fltSemantics &Sem);
1484
1485 bool isExact() const { return FloatingLiteralBits.IsExact; }
1486 void setExact(bool E) { FloatingLiteralBits.IsExact = E; }
1487
1488 /// getValueAsApproximateDouble - This returns the value as an inaccurate
1489 /// double. Note that this may cause loss of precision, but is useful for
1490 /// debugging dumps, etc.
1491 double getValueAsApproximateDouble() const;
1492
1493 SourceLocation getLocation() const { return Loc; }
1494 void setLocation(SourceLocation L) { Loc = L; }
1495
1496 SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
1497 SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
1498
1499 static bool classof(const Stmt *T) {
1500 return T->getStmtClass() == FloatingLiteralClass;
1501 }
1502
1503 // Iterators
1504 child_range children() {
1505 return child_range(child_iterator(), child_iterator());
1506 }
1507 const_child_range children() const {
1508 return const_child_range(const_child_iterator(), const_child_iterator());
1509 }
1510 };
1511
1512 /// ImaginaryLiteral - We support imaginary integer and floating point literals,
1513 /// like "1.0i". We represent these as a wrapper around FloatingLiteral and
1514 /// IntegerLiteral classes. Instances of this class always have a Complex type
1515 /// whose element type matches the subexpression.
1516 ///
1517 class ImaginaryLiteral : public Expr {
1518 Stmt *Val;
1519 public:
1520 ImaginaryLiteral(Expr *val, QualType Ty)
1521 : Expr(ImaginaryLiteralClass, Ty, VK_RValue, OK_Ordinary, false, false,
1522 false, false),
1523 Val(val) {}
1524
1525 /// Build an empty imaginary literal.
1526 explicit ImaginaryLiteral(EmptyShell Empty)
1527 : Expr(ImaginaryLiteralClass, Empty) { }
1528
1529 const Expr *getSubExpr() const { return cast<Expr>(Val); }
1530 Expr *getSubExpr() { return cast<Expr>(Val); }
1531 void setSubExpr(Expr *E) { Val = E; }
1532
1533 SourceLocation getBeginLoc() const LLVM_READONLY {
1534 return Val->getBeginLoc();
1535 }
1536 SourceLocation getEndLoc() const LLVM_READONLY { return Val->getEndLoc(); }
1537
1538 static bool classof(const Stmt *T) {
1539 return T->getStmtClass() == ImaginaryLiteralClass;
1540 }
1541
1542 // Iterators
1543 child_range children() { return child_range(&Val, &Val+1); }
1544 const_child_range children() const {
1545 return const_child_range(&Val, &Val + 1);
1546 }
1547 };
1548
1549 /// StringLiteral - This represents a string literal expression, e.g. "foo"
1550 /// or L"bar" (wide strings). The actual string data can be obtained with
1551 /// getBytes() and is NOT null-terminated. The length of the string data is
1552 /// determined by calling getByteLength().
1553 ///
1554 /// The C type for a string is always a ConstantArrayType. In C++, the char
1555 /// type is const qualified, in C it is not.
1556 ///
1557 /// Note that strings in C can be formed by concatenation of multiple string
1558 /// literal pptokens in translation phase #6. This keeps track of the locations
1559 /// of each of these pieces.
1560 ///
1561 /// Strings in C can also be truncated and extended by assigning into arrays,
1562 /// e.g. with constructs like:
1563 /// char X[2] = "foobar";
1564 /// In this case, getByteLength() will return 6, but the string literal will
1565 /// have type "char[2]".
1566 class StringLiteral final
1567 : public Expr,
1568 private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
1569 char> {
1570 friend class ASTStmtReader;
1571 friend TrailingObjects;
1572
1573 /// StringLiteral is followed by several trailing objects. They are in order:
1574 ///
1575 /// * A single unsigned storing the length in characters of this string. The
1576 /// length in bytes is this length times the width of a single character.
1577 /// Always present and stored as a trailing objects because storing it in
1578 /// StringLiteral would increase the size of StringLiteral by sizeof(void *)
1579 /// due to alignment requirements. If you add some data to StringLiteral,
1580 /// consider moving it inside StringLiteral.
1581 ///
1582 /// * An array of getNumConcatenated() SourceLocation, one for each of the
1583 /// token this string is made of.
1584 ///
1585 /// * An array of getByteLength() char used to store the string data.
1586
1587 public:
1588 enum StringKind { Ascii, Wide, UTF8, UTF16, UTF32 };
1589
1590 private:
1591 unsigned numTrailingObjects(OverloadToken<unsigned>) const { return 1; }
1592 unsigned numTrailingObjects(OverloadToken<SourceLocation>) const {
1593 return getNumConcatenated();
1594 }
1595
1596 unsigned numTrailingObjects(OverloadToken<char>) const {
1597 return getByteLength();
1598 }
1599
1600 char *getStrDataAsChar() { return getTrailingObjects<char>(); }
1601 const char *getStrDataAsChar() const { return getTrailingObjects<char>(); }
1602
1603 const uint16_t *getStrDataAsUInt16() const {
1604 return reinterpret_cast<const uint16_t *>(getTrailingObjects<char>());
1605 }
1606
1607 const uint32_t *getStrDataAsUInt32() const {
1608 return reinterpret_cast<const uint32_t *>(getTrailingObjects<char>());
1609 }
1610
1611 /// Build a string literal.
1612 StringLiteral(const ASTContext &Ctx, StringRef Str, StringKind Kind,
1613 bool Pascal, QualType Ty, const SourceLocation *Loc,
1614 unsigned NumConcatenated);
1615
1616 /// Build an empty string literal.
1617 StringLiteral(EmptyShell Empty, unsigned NumConcatenated, unsigned Length,
1618 unsigned CharByteWidth);
1619
1620 /// Map a target and string kind to the appropriate character width.
1621 static unsigned mapCharByteWidth(TargetInfo const &Target, StringKind SK);
1622
1623 /// Set one of the string literal token.
1624 void setStrTokenLoc(unsigned TokNum, SourceLocation L) {
1625 assert(TokNum < getNumConcatenated() && "Invalid tok number");
1626 getTrailingObjects<SourceLocation>()[TokNum] = L;
1627 }
1628
1629 public:
1630 /// This is the "fully general" constructor that allows representation of
1631 /// strings formed from multiple concatenated tokens.
1632 static StringLiteral *Create(const ASTContext &Ctx, StringRef Str,
1633 StringKind Kind, bool Pascal, QualType Ty,
1634 const SourceLocation *Loc,
1635 unsigned NumConcatenated);
1636
1637 /// Simple constructor for string literals made from one token.
1638 static StringLiteral *Create(const ASTContext &Ctx, StringRef Str,
1639 StringKind Kind, bool Pascal, QualType Ty,
1640 SourceLocation Loc) {
1641 return Create(Ctx, Str, Kind, Pascal, Ty, &Loc, 1);
1642 }
1643
1644 /// Construct an empty string literal.
1645 static StringLiteral *CreateEmpty(const ASTContext &Ctx,
1646 unsigned NumConcatenated, unsigned Length,
1647 unsigned CharByteWidth);
1648
1649 StringRef getString() const {
1650 assert(getCharByteWidth() == 1 &&
1651 "This function is used in places that assume strings use char");
1652 return StringRef(getStrDataAsChar(), getByteLength());
1653 }
1654
1655 /// Allow access to clients that need the byte representation, such as
1656 /// ASTWriterStmt::VisitStringLiteral().
1657 StringRef getBytes() const {
1658 // FIXME: StringRef may not be the right type to use as a result for this.
1659 return StringRef(getStrDataAsChar(), getByteLength());
1660 }
1661
1662 void outputString(raw_ostream &OS) const;
1663
1664 uint32_t getCodeUnit(size_t i) const {
1665 assert(i < getLength() && "out of bounds access");
1666 switch (getCharByteWidth()) {
1667 case 1:
1668 return static_cast<unsigned char>(getStrDataAsChar()[i]);
1669 case 2:
1670 return getStrDataAsUInt16()[i];
1671 case 4:
1672 return getStrDataAsUInt32()[i];
1673 }
1674 llvm_unreachable("Unsupported character width!");
1675 }
1676
1677 unsigned getByteLength() const { return getCharByteWidth() * getLength(); }
1678 unsigned getLength() const { return *getTrailingObjects<unsigned>(); }
1679 unsigned getCharByteWidth() const { return StringLiteralBits.CharByteWidth; }
1680
1681 StringKind getKind() const {
1682 return static_cast<StringKind>(StringLiteralBits.Kind);
1683 }
1684
1685 bool isAscii() const { return getKind() == Ascii; }
1686 bool isWide() const { return getKind() == Wide; }
1687 bool isUTF8() const { return getKind() == UTF8; }
1688 bool isUTF16() const { return getKind() == UTF16; }
1689 bool isUTF32() const { return getKind() == UTF32; }
1690 bool isPascal() const { return StringLiteralBits.IsPascal; }
1691
1692 bool containsNonAscii() const {
1693 for (auto c : getString())
1694 if (!isASCII(c))
1695 return true;
1696 return false;
1697 }
1698
1699 bool containsNonAsciiOrNull() const {
1700 for (auto c : getString())
1701 if (!isASCII(c) || !c)
1702 return true;
1703 return false;
1704 }
1705
1706 /// getNumConcatenated - Get the number of string literal tokens that were
1707 /// concatenated in translation phase #6 to form this string literal.
1708 unsigned getNumConcatenated() const {
1709 return StringLiteralBits.NumConcatenated;
1710 }
1711
1712 /// Get one of the string literal token.
1713 SourceLocation getStrTokenLoc(unsigned TokNum) const {
1714 assert(TokNum < getNumConcatenated() && "Invalid tok number");
1715 return getTrailingObjects<SourceLocation>()[TokNum];
1716 }
1717
1718 /// getLocationOfByte - Return a source location that points to the specified
1719 /// byte of this string literal.
1720 ///
1721 /// Strings are amazingly complex. They can be formed from multiple tokens
1722 /// and can have escape sequences in them in addition to the usual trigraph
1723 /// and escaped newline business. This routine handles this complexity.
1724 ///
1725 SourceLocation
1726 getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
1727 const LangOptions &Features, const TargetInfo &Target,
1728 unsigned *StartToken = nullptr,
1729 unsigned *StartTokenByteOffset = nullptr) const;
1730
1731 typedef const SourceLocation *tokloc_iterator;
1732
1733 tokloc_iterator tokloc_begin() const {
1734 return getTrailingObjects<SourceLocation>();
1735 }
1736
1737 tokloc_iterator tokloc_end() const {
1738 return getTrailingObjects<SourceLocation>() + getNumConcatenated();
1739 }
1740
1741 SourceLocation getBeginLoc() const LLVM_READONLY { return *tokloc_begin(); }
1742 SourceLocation getEndLoc() const LLVM_READONLY { return *(tokloc_end() - 1); }
1743
1744 static bool classof(const Stmt *T) {
1745 return T->getStmtClass() == StringLiteralClass;
1746 }
1747
1748 // Iterators
1749 child_range children() {
1750 return child_range(child_iterator(), child_iterator());
1751 }
1752 const_child_range children() const {
1753 return const_child_range(const_child_iterator(), const_child_iterator());
1754 }
1755 };
1756
1757 /// [C99 6.4.2.2] - A predefined identifier such as __func__.
1758 class PredefinedExpr final
1759 : public Expr,
1760 private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
1761 friend class ASTStmtReader;
1762 friend TrailingObjects;
1763
1764 // PredefinedExpr is optionally followed by a single trailing
1765 // "Stmt *" for the predefined identifier. It is present if and only if
1766 // hasFunctionName() is true and is always a "StringLiteral *".
1767
1768 public:
1769 enum IdentKind {
1770 Func,
1771 Function,
1772 LFunction, // Same as Function, but as wide string.
1773 FuncDName,
1774 FuncSig,
1775 LFuncSig, // Same as FuncSig, but as as wide string
1776 PrettyFunction,
1777 /// The same as PrettyFunction, except that the
1778 /// 'virtual' keyword is omitted for virtual member functions.
1779 PrettyFunctionNoVirtual
1780 };
1781
1782 private:
1783 PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK,
1784 StringLiteral *SL);
1785
1786 explicit PredefinedExpr(EmptyShell Empty, bool HasFunctionName);
1787
1788 /// True if this PredefinedExpr has storage for a function name.
1789 bool hasFunctionName() const { return PredefinedExprBits.HasFunctionName; }
1790
1791 void setFunctionName(StringLiteral *SL) {
1792 assert(hasFunctionName() &&
1793 "This PredefinedExpr has no storage for a function name!");
1794 *getTrailingObjects<Stmt *>() = SL;
1795 }
1796
1797 public:
1798 /// Create a PredefinedExpr.
1799 static PredefinedExpr *Create(const ASTContext &Ctx, SourceLocation L,
1800 QualType FNTy, IdentKind IK, StringLiteral *SL);
1801
1802 /// Create an empty PredefinedExpr.
1803 static PredefinedExpr *CreateEmpty(const ASTContext &Ctx,
1804 bool HasFunctionName);
1805
1806 IdentKind getIdentKind() const {
1807 return static_cast<IdentKind>(PredefinedExprBits.Kind);
1808 }
1809
1810 SourceLocation getLocation() const { return PredefinedExprBits.Loc; }
1811 void setLocation(SourceLocation L) { PredefinedExprBits.Loc = L; }
1812
1813 StringLiteral *getFunctionName() {
1814 return hasFunctionName()
1815 ? static_cast<StringLiteral *>(*getTrailingObjects<Stmt *>())
1816 : nullptr;
1817 }
1818
1819 const StringLiteral *getFunctionName() const {
1820 return hasFunctionName()
1821 ? static_cast<StringLiteral *>(*getTrailingObjects<Stmt *>())
1822 : nullptr;
1823 }
1824
1825 static StringRef getIdentKindName(IdentKind IK);
1826 static std::string ComputeName(IdentKind IK, const Decl *CurrentDecl);
1827
1828 SourceLocation getBeginLoc() const { return getLocation(); }
1829 SourceLocation getEndLoc() const { return getLocation(); }
1830
1831 static bool classof(const Stmt *T) {
1832 return T->getStmtClass() == PredefinedExprClass;
1833 }
1834
1835 // Iterators
1836 child_range children() {
1837 return child_range(getTrailingObjects<Stmt *>(),
1838 getTrailingObjects<Stmt *>() + hasFunctionName());
1839 }
1840 };
1841
1842 /// ParenExpr - This represents a parethesized expression, e.g. "(1)". This
1843 /// AST node is only formed if full location information is requested.
1844 class ParenExpr : public Expr {
1845 SourceLocation L, R;
1846 Stmt *Val;
1847 public:
1848 ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
1849 : Expr(ParenExprClass, val->getType(),
1850 val->getValueKind(), val->getObjectKind(),
1851 val->isTypeDependent(), val->isValueDependent(),
1852 val->isInstantiationDependent(),
1853 val->containsUnexpandedParameterPack()),
1854 L(l), R(r), Val(val) {}
1855
1856 /// Construct an empty parenthesized expression.
1857 explicit ParenExpr(EmptyShell Empty)
1858 : Expr(ParenExprClass, Empty) { }
1859
1860 const Expr *getSubExpr() const { return cast<Expr>(Val); }
1861 Expr *getSubExpr() { return cast<Expr>(Val); }
1862 void setSubExpr(Expr *E) { Val = E; }
1863
1864 SourceLocation getBeginLoc() const LLVM_READONLY { return L; }
1865 SourceLocation getEndLoc() const LLVM_READONLY { return R; }
1866
1867 /// Get the location of the left parentheses '('.
1868 SourceLocation getLParen() const { return L; }
1869 void setLParen(SourceLocation Loc) { L = Loc; }
1870
1871 /// Get the location of the right parentheses ')'.
1872 SourceLocation getRParen() const { return R; }
1873 void setRParen(SourceLocation Loc) { R = Loc; }
1874
1875 static bool classof(const Stmt *T) {
1876 return T->getStmtClass() == ParenExprClass;
1877 }
1878
1879 // Iterators
1880 child_range children() { return child_range(&Val, &Val+1); }
1881 const_child_range children() const {
1882 return const_child_range(&Val, &Val + 1);
1883 }
1884 };
1885
1886 /// UnaryOperator - This represents the unary-expression's (except sizeof and
1887 /// alignof), the postinc/postdec operators from postfix-expression, and various
1888 /// extensions.
1889 ///
1890 /// Notes on various nodes:
1891 ///
1892 /// Real/Imag - These return the real/imag part of a complex operand. If
1893 /// applied to a non-complex value, the former returns its operand and the
1894 /// later returns zero in the type of the operand.
1895 ///
1896 class UnaryOperator : public Expr {
1897 Stmt *Val;
1898
1899 public:
1900 typedef UnaryOperatorKind Opcode;
1901
1902 UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK,
1903 ExprObjectKind OK, SourceLocation l, bool CanOverflow)
1904 : Expr(UnaryOperatorClass, type, VK, OK,
1905 input->isTypeDependent() || type->isDependentType(),
1906 input->isValueDependent(),
1907 (input->isInstantiationDependent() ||
1908 type->isInstantiationDependentType()),
1909 input->containsUnexpandedParameterPack()),
1910 Val(input) {
1911 UnaryOperatorBits.Opc = opc;
1912 UnaryOperatorBits.CanOverflow = CanOverflow;
1913 UnaryOperatorBits.Loc = l;
1914 }
1915
1916 /// Build an empty unary operator.
1917 explicit UnaryOperator(EmptyShell Empty) : Expr(UnaryOperatorClass, Empty) {
1918 UnaryOperatorBits.Opc = UO_AddrOf;
1919 }
1920
1921 Opcode getOpcode() const {
1922 return static_cast<Opcode>(UnaryOperatorBits.Opc);
1923 }
1924 void setOpcode(Opcode Opc) { UnaryOperatorBits.Opc = Opc; }
1925
1926 Expr *getSubExpr() const { return cast<Expr>(Val); }
1927 void setSubExpr(Expr *E) { Val = E; }
1928
1929 /// getOperatorLoc - Return the location of the operator.
1930 SourceLocation getOperatorLoc() const { return UnaryOperatorBits.Loc; }
1931 void setOperatorLoc(SourceLocation L) { UnaryOperatorBits.Loc = L; }
1932
1933 /// Returns true if the unary operator can cause an overflow. For instance,
1934 /// signed int i = INT_MAX; i++;
1935 /// signed char c = CHAR_MAX; c++;
1936 /// Due to integer promotions, c++ is promoted to an int before the postfix
1937 /// increment, and the result is an int that cannot overflow. However, i++
1938 /// can overflow.
1939 bool canOverflow() const { return UnaryOperatorBits.CanOverflow; }
1940 void setCanOverflow(bool C) { UnaryOperatorBits.CanOverflow = C; }
1941
1942 /// isPostfix - Return true if this is a postfix operation, like x++.
1943 static bool isPostfix(Opcode Op) {
1944 return Op == UO_PostInc || Op == UO_PostDec;
1945 }
1946
1947 /// isPrefix - Return true if this is a prefix operation, like --x.
1948 static bool isPrefix(Opcode Op) {
1949 return Op == UO_PreInc || Op == UO_PreDec;
1950 }
1951
1952 bool isPrefix() const { return isPrefix(getOpcode()); }
1953 bool isPostfix() const { return isPostfix(getOpcode()); }
1954
1955 static bool isIncrementOp(Opcode Op) {
1956 return Op == UO_PreInc || Op == UO_PostInc;
1957 }
1958 bool isIncrementOp() const {
1959 return isIncrementOp(getOpcode());
1960 }
1961
1962 static bool isDecrementOp(Opcode Op) {
1963 return Op == UO_PreDec || Op == UO_PostDec;
1964 }
1965 bool isDecrementOp() const {
1966 return isDecrementOp(getOpcode());
1967 }
1968
1969 static bool isIncrementDecrementOp(Opcode Op) { return Op <= UO_PreDec; }
1970 bool isIncrementDecrementOp() const {
1971 return isIncrementDecrementOp(getOpcode());
1972 }
1973
1974 static bool isArithmeticOp(Opcode Op) {
1975 return Op >= UO_Plus && Op <= UO_LNot;
1976 }
1977 bool isArithmeticOp() const { return isArithmeticOp(getOpcode()); }
1978
1979 /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
1980 /// corresponds to, e.g. "sizeof" or "[pre]++"
1981 static StringRef getOpcodeStr(Opcode Op);
1982
1983 /// Retrieve the unary opcode that corresponds to the given
1984 /// overloaded operator.
1985 static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix);
1986
1987 /// Retrieve the overloaded operator kind that corresponds to
1988 /// the given unary opcode.
1989 static OverloadedOperatorKind getOverloadedOperator(Opcode Opc);
1990
1991 SourceLocation getBeginLoc() const LLVM_READONLY {
1992 return isPostfix() ? Val->getBeginLoc() : getOperatorLoc();
1993 }
1994 SourceLocation getEndLoc() const LLVM_READONLY {
1995 return isPostfix() ? getOperatorLoc() : Val->getEndLoc();
1996 }
1997 SourceLocation getExprLoc() const { return getOperatorLoc(); }
1998
1999 static bool classof(const Stmt *T) {
2000 return T->getStmtClass() == UnaryOperatorClass;
2001 }
2002
2003 // Iterators
2004 child_range children() { return child_range(&Val, &Val+1); }
2005 const_child_range children() const {
2006 return const_child_range(&Val, &Val + 1);
2007 }
2008 };
2009
2010 /// Helper class for OffsetOfExpr.
2011
2012 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
2013 class OffsetOfNode {
2014 public:
2015 /// The kind of offsetof node we have.
2016 enum Kind {
2017 /// An index into an array.
2018 Array = 0x00,
2019 /// A field.
2020 Field = 0x01,
2021 /// A field in a dependent type, known only by its name.
2022 Identifier = 0x02,
2023 /// An implicit indirection through a C++ base class, when the
2024 /// field found is in a base class.
2025 Base = 0x03
2026 };
2027
2028 private:
2029 enum { MaskBits = 2, Mask = 0x03 };
2030
2031 /// The source range that covers this part of the designator.
2032 SourceRange Range;
2033
2034 /// The data describing the designator, which comes in three
2035 /// different forms, depending on the lower two bits.
2036 /// - An unsigned index into the array of Expr*'s stored after this node
2037 /// in memory, for [constant-expression] designators.
2038 /// - A FieldDecl*, for references to a known field.
2039 /// - An IdentifierInfo*, for references to a field with a given name
2040 /// when the class type is dependent.
2041 /// - A CXXBaseSpecifier*, for references that look at a field in a
2042 /// base class.
2043 uintptr_t Data;
2044
2045 public:
2046 /// Create an offsetof node that refers to an array element.
2047 OffsetOfNode(SourceLocation LBracketLoc, unsigned Index,
2048 SourceLocation RBracketLoc)
2049 : Range(LBracketLoc, RBracketLoc), Data((Index << 2) | Array) {}
2050
2051 /// Create an offsetof node that refers to a field.
2052 OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
2053 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2054 Data(reinterpret_cast<uintptr_t>(Field) | OffsetOfNode::Field) {}
2055
2056 /// Create an offsetof node that refers to an identifier.
2057 OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name,
2058 SourceLocation NameLoc)
2059 : Range(DotLoc.isValid() ? DotLoc : NameLoc, NameLoc),
2060 Data(reinterpret_cast<uintptr_t>(Name) | Identifier) {}
2061
2062 /// Create an offsetof node that refers into a C++ base class.
2063 explicit OffsetOfNode(const CXXBaseSpecifier *Base)
2064 : Range(), Data(reinterpret_cast<uintptr_t>(Base) | OffsetOfNode::Base) {}
2065
2066 /// Determine what kind of offsetof node this is.
2067 Kind getKind() const { return static_cast<Kind>(Data & Mask); }
2068
2069 /// For an array element node, returns the index into the array
2070 /// of expressions.
2071 unsigned getArrayExprIndex() const {
2072 assert(getKind() == Array);
2073 return Data >> 2;
2074 }
2075
2076 /// For a field offsetof node, returns the field.
2077 FieldDecl *getField() const {
2078 assert(getKind() == Field);
2079 return reinterpret_cast<FieldDecl *>(Data & ~(uintptr_t)Mask);
2080 }
2081
2082 /// For a field or identifier offsetof node, returns the name of
2083 /// the field.
2084 IdentifierInfo *getFieldName() const;
2085
2086 /// For a base class node, returns the base specifier.
2087 CXXBaseSpecifier *getBase() const {
2088 assert(getKind() == Base);
2089 return reinterpret_cast<CXXBaseSpecifier *>(Data & ~(uintptr_t)Mask);
2090 }
2091
2092 /// Retrieve the source range that covers this offsetof node.
2093 ///
2094 /// For an array element node, the source range contains the locations of
2095 /// the square brackets. For a field or identifier node, the source range
2096 /// contains the location of the period (if there is one) and the
2097 /// identifier.
2098 SourceRange getSourceRange() const LLVM_READONLY { return Range; }
2099 SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
2100 SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
2101 };
2102
2103 /// OffsetOfExpr - [C99 7.17] - This represents an expression of the form
2104 /// offsetof(record-type, member-designator). For example, given:
2105 /// @code
2106 /// struct S {
2107 /// float f;
2108 /// double d;
2109 /// };
2110 /// struct T {
2111 /// int i;
2112 /// struct S s[10];
2113 /// };
2114 /// @endcode
2115 /// we can represent and evaluate the expression @c offsetof(struct T, s[2].d).
2116
2117 class OffsetOfExpr final
2118 : public Expr,
2119 private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
2120 SourceLocation OperatorLoc, RParenLoc;
2121 // Base type;
2122 TypeSourceInfo *TSInfo;
2123 // Number of sub-components (i.e. instances of OffsetOfNode).
2124 unsigned NumComps;
2125 // Number of sub-expressions (i.e. array subscript expressions).
2126 unsigned NumExprs;
2127
2128 size_t numTrailingObjects(OverloadToken<OffsetOfNode>) const {
2129 return NumComps;
2130 }
2131
2132 OffsetOfExpr(const ASTContext &C, QualType type,
2133 SourceLocation OperatorLoc, TypeSourceInfo *tsi,
2134 ArrayRef<OffsetOfNode> comps, ArrayRef<Expr*> exprs,
2135 SourceLocation RParenLoc);
2136
2137 explicit OffsetOfExpr(unsigned numComps, unsigned numExprs)
2138 : Expr(OffsetOfExprClass, EmptyShell()),
2139 TSInfo(nullptr), NumComps(numComps), NumExprs(numExprs) {}
2140
2141 public:
2142
2143 static OffsetOfExpr *Create(const ASTContext &C, QualType type,
2144 SourceLocation OperatorLoc, TypeSourceInfo *tsi,
2145 ArrayRef<OffsetOfNode> comps,
2146 ArrayRef<Expr*> exprs, SourceLocation RParenLoc);
2147
2148 static OffsetOfExpr *CreateEmpty(const ASTContext &C,
2149 unsigned NumComps, unsigned NumExprs);
2150
2151 /// getOperatorLoc - Return the location of the operator.
2152 SourceLocation getOperatorLoc() const { return OperatorLoc; }
2153 void setOperatorLoc(SourceLocation L) { OperatorLoc = L; }
2154
2155 /// Return the location of the right parentheses.
2156 SourceLocation getRParenLoc() const { return RParenLoc; }
2157 void setRParenLoc(SourceLocation R) { RParenLoc = R; }
2158
2159 TypeSourceInfo *getTypeSourceInfo() const {
2160 return TSInfo;
2161 }
2162 void setTypeSourceInfo(TypeSourceInfo *tsi) {
2163 TSInfo = tsi;
2164 }
2165
2166 const OffsetOfNode &getComponent(unsigned Idx) const {
2167 assert(Idx < NumComps && "Subscript out of range");
2168 return getTrailingObjects<OffsetOfNode>()[Idx];
2169 }
2170
2171 void setComponent(unsigned Idx, OffsetOfNode ON) {
2172 assert(Idx < NumComps && "Subscript out of range");
2173 getTrailingObjects<OffsetOfNode>()[Idx] = ON;
2174 }
2175
2176 unsigned getNumComponents() const {
2177 return NumComps;
2178 }
2179
2180 Expr* getIndexExpr(unsigned Idx) {
2181 assert(Idx < NumExprs && "Subscript out of range");
2182 return getTrailingObjects<Expr *>()[Idx];
2183 }
2184
2185 const Expr *getIndexExpr(unsigned Idx) const {
2186 assert(Idx < NumExprs && "Subscript out of range");
2187 return getTrailingObjects<Expr *>()[Idx];
2188 }
2189
2190 void setIndexExpr(unsigned Idx, Expr* E) {
2191 assert(Idx < NumComps && "Subscript out of range");
2192 getTrailingObjects<Expr *>()[Idx] = E;
2193 }
2194
2195 unsigned getNumExpressions() const {
2196 return NumExprs;
2197 }
2198
2199 SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
2200 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
2201
2202 static bool classof(const Stmt *T) {
2203 return T->getStmtClass() == OffsetOfExprClass;
2204 }
2205
2206 // Iterators
2207 child_range children() {
2208 Stmt **begin = reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>());
2209 return child_range(begin, begin + NumExprs);
2210 }
2211 const_child_range children() const {
2212 Stmt *const *begin =
2213 reinterpret_cast<Stmt *const *>(getTrailingObjects<Expr *>());
2214 return const_child_range(begin, begin + NumExprs);
2215 }
2216 friend TrailingObjects;
2217 };
2218
2219 /// UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated)
2220 /// expression operand. Used for sizeof/alignof (C99 6.5.3.4) and
2221 /// vec_step (OpenCL 1.1 6.11.12).
2222 class UnaryExprOrTypeTraitExpr : public Expr {
2223 union {
2224 TypeSourceInfo *Ty;
2225 Stmt *Ex;
2226 } Argument;
2227 SourceLocation OpLoc, RParenLoc;
2228
2229 public:
2230 UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo,
2231 QualType resultType, SourceLocation op,
2232 SourceLocation rp) :
2233 Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary,
2234 false, // Never type-dependent (C++ [temp.dep.expr]p3).
2235 // Value-dependent if the argument is type-dependent.
2236 TInfo->getType()->isDependentType(),
2237 TInfo->getType()->isInstantiationDependentType(),
2238 TInfo->getType()->containsUnexpandedParameterPack()),
2239 OpLoc(op), RParenLoc(rp) {
2240 UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
2241 UnaryExprOrTypeTraitExprBits.IsType = true;
2242 Argument.Ty = TInfo;
2243 }
2244
2245 UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, Expr *E,
2246 QualType resultType, SourceLocation op,
2247 SourceLocation rp);
2248
2249 /// Construct an empty sizeof/alignof expression.
2250 explicit UnaryExprOrTypeTraitExpr(EmptyShell Empty)
2251 : Expr(UnaryExprOrTypeTraitExprClass, Empty) { }
2252
2253 UnaryExprOrTypeTrait getKind() const {
2254 return static_cast<UnaryExprOrTypeTrait>(UnaryExprOrTypeTraitExprBits.Kind);
2255 }
2256 void setKind(UnaryExprOrTypeTrait K) { UnaryExprOrTypeTraitExprBits.Kind = K;}
2257
2258 bool isArgumentType() const { return UnaryExprOrTypeTraitExprBits.IsType; }
2259 QualType getArgumentType() const {
2260 return getArgumentTypeInfo()->getType();
2261 }
2262 TypeSourceInfo *getArgumentTypeInfo() const {
2263 assert(isArgumentType() && "calling getArgumentType() when arg is expr");
2264 return Argument.Ty;
2265 }
2266 Expr *getArgumentExpr() {
2267 assert(!isArgumentType() && "calling getArgumentExpr() when arg is type");
2268 return static_cast<Expr*>(Argument.Ex);
2269 }
2270 const Expr *getArgumentExpr() const {
2271 return const_cast<UnaryExprOrTypeTraitExpr*>(this)->getArgumentExpr();
2272 }
2273
2274 void setArgument(Expr *E) {
2275 Argument.Ex = E;
2276 UnaryExprOrTypeTraitExprBits.IsType = false;
2277 }
2278 void setArgument(TypeSourceInfo *TInfo) {
2279 Argument.Ty = TInfo;
2280 UnaryExprOrTypeTraitExprBits.IsType = true;
2281 }
2282
2283 /// Gets the argument type, or the type of the argument expression, whichever
2284 /// is appropriate.
2285 QualType getTypeOfArgument() const {
2286 return isArgumentType() ? getArgumentType() : getArgumentExpr()->getType();
2287 }
2288
2289 SourceLocation getOperatorLoc() const { return OpLoc; }
2290 void setOperatorLoc(SourceLocation L) { OpLoc = L; }
2291
2292 SourceLocation getRParenLoc() const { return RParenLoc; }
2293 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
2294
2295 SourceLocation getBeginLoc() const LLVM_READONLY { return OpLoc; }
2296 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
2297
2298 static bool classof(const Stmt *T) {
2299 return T->getStmtClass() == UnaryExprOrTypeTraitExprClass;
2300 }
2301
2302 // Iterators
2303 child_range children();
2304 const_child_range children() const;
2305 };
2306
2307 //===----------------------------------------------------------------------===//
2308 // Postfix Operators.
2309 //===----------------------------------------------------------------------===//
2310
2311 /// ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
2312 class ArraySubscriptExpr : public Expr {
2313 enum { LHS, RHS, END_EXPR };
2314 Stmt *SubExprs[END_EXPR];
2315
2316 bool lhsIsBase() const { return getRHS()->getType()->isIntegerType(); }
2317
2318 public:
2319 ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t,
2320 ExprValueKind VK, ExprObjectKind OK,
2321 SourceLocation rbracketloc)
2322 : Expr(ArraySubscriptExprClass, t, VK, OK,
2323 lhs->isTypeDependent() || rhs->isTypeDependent(),
2324 lhs->isValueDependent() || rhs->isValueDependent(),
2325 (lhs->isInstantiationDependent() ||
2326 rhs->isInstantiationDependent()),
2327 (lhs->containsUnexpandedParameterPack() ||
2328 rhs->containsUnexpandedParameterPack())) {
2329 SubExprs[LHS] = lhs;
2330 SubExprs[RHS] = rhs;
2331 ArraySubscriptExprBits.RBracketLoc = rbracketloc;
2332 }
2333
2334 /// Create an empty array subscript expression.
2335 explicit ArraySubscriptExpr(EmptyShell Shell)
2336 : Expr(ArraySubscriptExprClass, Shell) { }
2337
2338 /// An array access can be written A[4] or 4[A] (both are equivalent).
2339 /// - getBase() and getIdx() always present the normalized view: A[4].
2340 /// In this case getBase() returns "A" and getIdx() returns "4".
2341 /// - getLHS() and getRHS() present the syntactic view. e.g. for
2342 /// 4[A] getLHS() returns "4".
2343 /// Note: Because vector element access is also written A[4] we must
2344 /// predicate the format conversion in getBase and getIdx only on the
2345 /// the type of the RHS, as it is possible for the LHS to be a vector of
2346 /// integer type
2347 Expr *getLHS() { return cast<Expr>(SubExprs[LHS]); }
2348 const Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); }
2349 void setLHS(Expr *E) { SubExprs[LHS] = E; }
2350
2351 Expr *getRHS() { return cast<Expr>(SubExprs[RHS]); }
2352 const Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
2353 void setRHS(Expr *E) { SubExprs[RHS] = E; }
2354
2355 Expr *getBase() { return lhsIsBase() ? getLHS() : getRHS(); }
2356 const Expr *getBase() const { return lhsIsBase() ? getLHS() : getRHS(); }
2357
2358 Expr *getIdx() { return lhsIsBase() ? getRHS() : getLHS(); }
2359 const Expr *getIdx() const { return lhsIsBase() ? getRHS() : getLHS(); }
2360
2361 SourceLocation getBeginLoc() const LLVM_READONLY {
2362 return getLHS()->getBeginLoc();
2363 }
2364 SourceLocation getEndLoc() const { return getRBracketLoc(); }
2365
2366 SourceLocation getRBracketLoc() const {
2367 return ArraySubscriptExprBits.RBracketLoc;
2368 }
2369 void setRBracketLoc(SourceLocation L) {
2370 ArraySubscriptExprBits.RBracketLoc = L;
2371 }
2372
2373 SourceLocation getExprLoc() const LLVM_READONLY {
2374 return getBase()->getExprLoc();
2375 }
2376
2377 static bool classof(const Stmt *T) {
2378 return T->getStmtClass() == ArraySubscriptExprClass;
2379 }
2380
2381 // Iterators
2382 child_range children() {
2383 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2384 }
2385 const_child_range children() const {
2386 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2387 }
2388 };
2389
2390 /// CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
2391 /// CallExpr itself represents a normal function call, e.g., "f(x, 2)",
2392 /// while its subclasses may represent alternative syntax that (semantically)
2393 /// results in a function call. For example, CXXOperatorCallExpr is
2394 /// a subclass for overloaded operator calls that use operator syntax, e.g.,
2395 /// "str1 + str2" to resolve to a function call.
2396 class CallExpr : public Expr {
2397 enum { FN = 0, PREARGS_START = 1 };
2398
2399 /// The number of arguments in the call expression.
2400 unsigned NumArgs;
2401
2402 /// The location of the right parenthese. This has a different meaning for
2403 /// the derived classes of CallExpr.
2404 SourceLocation RParenLoc;
2405
2406 void updateDependenciesFromArg(Expr *Arg);
2407
2408 // CallExpr store some data in trailing objects. However since CallExpr
2409 // is used a base of other expression classes we cannot use
2410 // llvm::TrailingObjects. Instead we manually perform the pointer arithmetic
2411 // and casts.
2412 //
2413 // The trailing objects are in order:
2414 //
2415 // * A single "Stmt *" for the callee expression.
2416 //
2417 // * An array of getNumPreArgs() "Stmt *" for the pre-argument expressions.
2418 //
2419 // * An array of getNumArgs() "Stmt *" for the argument expressions.
2420 //
2421 // Note that we store the offset in bytes from the this pointer to the start
2422 // of the trailing objects. It would be perfectly possible to compute it
2423 // based on the dynamic kind of the CallExpr. However 1.) we have plenty of
2424 // space in the bit-fields of Stmt. 2.) It was benchmarked to be faster to
2425 // compute this once and then load the offset from the bit-fields of Stmt,
2426 // instead of re-computing the offset each time the trailing objects are
2427 // accessed.
2428
2429 /// Return a pointer to the start of the trailing array of "Stmt *".
2430 Stmt **getTrailingStmts() {
2431 return reinterpret_cast<Stmt **>(reinterpret_cast<char *>(this) +
2432 CallExprBits.OffsetToTrailingObjects);
2433 }
2434 Stmt *const *getTrailingStmts() const {
2435 return const_cast<CallExpr *>(this)->getTrailingStmts();
2436 }
2437
2438 /// Map a statement class to the appropriate offset in bytes from the
2439 /// this pointer to the trailing objects.
2440 static unsigned offsetToTrailingObjects(StmtClass SC);
2441
2442 public:
2443 enum class ADLCallKind : bool { NotADL, UsesADL };
2444 static constexpr ADLCallKind NotADL = ADLCallKind::NotADL;
2445 static constexpr ADLCallKind UsesADL = ADLCallKind::UsesADL;
2446
2447 protected:
2448 /// Build a call expression, assuming that appropriate storage has been
2449 /// allocated for the trailing objects.
2450 CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
2451 ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK,
2452 SourceLocation RParenLoc, unsigned MinNumArgs, ADLCallKind UsesADL);
2453
2454 /// Build an empty call expression, for deserialization.
2455 CallExpr(StmtClass SC, unsigned NumPreArgs, unsigned NumArgs,
2456 EmptyShell Empty);
2457
2458 /// Return the size in bytes needed for the trailing objects.
2459 /// Used by the derived classes to allocate the right amount of storage.
2460 static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs) {
2461 return (1 + NumPreArgs + NumArgs) * sizeof(Stmt *);
2462 }
2463
2464 Stmt *getPreArg(unsigned I) {
2465 assert(I < getNumPreArgs() && "Prearg access out of range!");
2466 return getTrailingStmts()[PREARGS_START + I];
2467 }
2468 const Stmt *getPreArg(unsigned I) const {
2469 assert(I < getNumPreArgs() && "Prearg access out of range!");
2470 return getTrailingStmts()[PREARGS_START + I];
2471 }
2472 void setPreArg(unsigned I, Stmt *PreArg) {
2473 assert(I < getNumPreArgs() && "Prearg access out of range!");
2474 getTrailingStmts()[PREARGS_START + I] = PreArg;
2475 }
2476
2477 unsigned getNumPreArgs() const { return CallExprBits.NumPreArgs; }
2478
2479 public:
2480 /// Create a call expression. Fn is the callee expression, Args is the
2481 /// argument array, Ty is the type of the call expression (which is *not*
2482 /// the return type in general), VK is the value kind of the call expression
2483 /// (lvalue, rvalue, ...), and RParenLoc is the location of the right
2484 /// parenthese in the call expression. MinNumArgs specifies the minimum
2485 /// number of arguments. The actual number of arguments will be the greater
2486 /// of Args.size() and MinNumArgs. This is used in a few places to allocate
2487 /// enough storage for the default arguments. UsesADL specifies whether the
2488 /// callee was found through argument-dependent lookup.
2489 ///
2490 /// Note that you can use CreateTemporary if you need a temporary call
2491 /// expression on the stack.
2492 static CallExpr *Create(const ASTContext &Ctx, Expr *Fn,
2493 ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK,
2494 SourceLocation RParenLoc, unsigned MinNumArgs = 0,
2495 ADLCallKind UsesADL = NotADL);
2496
2497 /// Create a temporary call expression with no arguments in the memory
2498 /// pointed to by Mem. Mem must points to at least sizeof(CallExpr)
2499 /// + sizeof(Stmt *) bytes of storage, aligned to alignof(CallExpr):
2500 ///
2501 /// \code{.cpp}
2502 /// llvm::AlignedCharArray<alignof(CallExpr),
2503 /// sizeof(CallExpr) + sizeof(Stmt *)> Buffer;
2504 /// CallExpr *TheCall = CallExpr::CreateTemporary(Buffer.buffer, etc);
2505 /// \endcode
2506 static CallExpr *CreateTemporary(void *Mem, Expr *Fn, QualType Ty,
2507 ExprValueKind VK, SourceLocation RParenLoc,
2508 ADLCallKind UsesADL = NotADL);
2509
2510 /// Create an empty call expression, for deserialization.
2511 static CallExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs,
2512 EmptyShell Empty);
2513
2514 Expr *getCallee() { return cast<Expr>(getTrailingStmts()[FN]); }
2515 const Expr *getCallee() const { return cast<Expr>(getTrailingStmts()[FN]); }
2516 void setCallee(Expr *F) { getTrailingStmts()[FN] = F; }
2517
2518 ADLCallKind getADLCallKind() const {
2519 return static_cast<ADLCallKind>(CallExprBits.UsesADL);
2520 }
2521 void setADLCallKind(ADLCallKind V = UsesADL) {
2522 CallExprBits.UsesADL = static_cast<bool>(V);
2523 }
2524 bool usesADL() const { return getADLCallKind() == UsesADL; }
2525
2526 Decl *getCalleeDecl() { return getCallee()->getReferencedDeclOfCallee(); }
2527 const Decl *getCalleeDecl() const {
2528 return getCallee()->getReferencedDeclOfCallee();
2529 }
2530
2531 /// If the callee is a FunctionDecl, return it. Otherwise return null.
2532 FunctionDecl *getDirectCallee() {
2533 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2534 }
2535 const FunctionDecl *getDirectCallee() const {
2536 return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
2537 }
2538
2539 /// getNumArgs - Return the number of actual arguments to this call.
2540 unsigned getNumArgs() const { return NumArgs; }
2541
2542 /// Retrieve the call arguments.
2543 Expr **getArgs() {
2544 return reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START +
2545 getNumPreArgs());
2546 }
2547 const Expr *const *getArgs() const {
2548 return reinterpret_cast<const Expr *const *>(
2549 getTrailingStmts() + PREARGS_START + getNumPreArgs());
2550 }
2551
2552 /// getArg - Return the specified argument.
2553 Expr *getArg(unsigned Arg) {
2554 assert(Arg < getNumArgs() && "Arg access out of range!");
2555 return getArgs()[Arg];
2556 }
2557 const Expr *getArg(unsigned Arg) const {
2558 assert(Arg < getNumArgs() && "Arg access out of range!");
2559 return getArgs()[Arg];
2560 }
2561
2562 /// setArg - Set the specified argument.
2563 void setArg(unsigned Arg, Expr *ArgExpr) {
2564 assert(Arg < getNumArgs() && "Arg access out of range!");
2565 getArgs()[Arg] = ArgExpr;
2566 }
2567
2568 /// Reduce the number of arguments in this call expression. This is used for
2569 /// example during error recovery to drop extra arguments. There is no way
2570 /// to perform the opposite because: 1.) We don't track how much storage
2571 /// we have for the argument array 2.) This would potentially require growing
2572 /// the argument array, something we cannot support since the arguments are
2573 /// stored in a trailing array.
2574 void shrinkNumArgs(unsigned NewNumArgs) {
2575 assert((NewNumArgs <= getNumArgs()) &&
2576 "shrinkNumArgs cannot increase the number of arguments!");
2577 NumArgs = NewNumArgs;
2578 }
2579
2580 /// Bluntly set a new number of arguments without doing any checks whatsoever.
2581 /// Only used during construction of a CallExpr in a few places in Sema.
2582 /// FIXME: Find a way to remove it.
2583 void setNumArgsUnsafe(unsigned NewNumArgs) { NumArgs = NewNumArgs; }
2584
2585 typedef ExprIterator arg_iterator;
2586 typedef ConstExprIterator const_arg_iterator;
2587 typedef llvm::iterator_range<arg_iterator> arg_range;
2588 typedef llvm::iterator_range<const_arg_iterator> const_arg_range;
2589
2590 arg_range arguments() { return arg_range(arg_begin(), arg_end()); }
2591 const_arg_range arguments() const {
2592 return const_arg_range(arg_begin(), arg_end());
2593 }
2594
2595 arg_iterator arg_begin() {
2596 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2597 }
2598 arg_iterator arg_end() { return arg_begin() + getNumArgs(); }
2599
2600 const_arg_iterator arg_begin() const {
2601 return getTrailingStmts() + PREARGS_START + getNumPreArgs();
2602 }
2603 const_arg_iterator arg_end() const { return arg_begin() + getNumArgs(); }
2604
2605 /// This method provides fast access to all the subexpressions of
2606 /// a CallExpr without going through the slower virtual child_iterator
2607 /// interface. This provides efficient reverse iteration of the
2608 /// subexpressions. This is currently used for CFG construction.
2609 ArrayRef<Stmt *> getRawSubExprs() {
2610 return llvm::makeArrayRef(getTrailingStmts(),
2611 PREARGS_START + getNumPreArgs() + getNumArgs());
2612 }
2613
2614 /// getNumCommas - Return the number of commas that must have been present in
2615 /// this function call.
2616 unsigned getNumCommas() const { return getNumArgs() ? getNumArgs() - 1 : 0; }
2617
2618 /// getBuiltinCallee - If this is a call to a builtin, return the builtin ID
2619 /// of the callee. If not, return 0.
2620 unsigned getBuiltinCallee() const;
2621
2622 /// Returns \c true if this is a call to a builtin which does not
2623 /// evaluate side-effects within its arguments.
2624 bool isUnevaluatedBuiltinCall(const ASTContext &Ctx) const;
2625
2626 /// getCallReturnType - Get the return type of the call expr. This is not
2627 /// always the type of the expr itself, if the return type is a reference
2628 /// type.
2629 QualType getCallReturnType(const ASTContext &Ctx) const;
2630
2631 /// Returns the WarnUnusedResultAttr that is either declared on the called
2632 /// function, or its return type declaration.
2633 const Attr *getUnusedResultAttr(const ASTContext &Ctx) const;
2634
2635 /// Returns true if this call expression should warn on unused results.
2636 bool hasUnusedResultAttr(const ASTContext &Ctx) const {
2637 return getUnusedResultAttr(Ctx) != nullptr;
2638 }
2639
2640 SourceLocation getRParenLoc() const { return RParenLoc; }
2641 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
2642
2643 SourceLocation getBeginLoc() const LLVM_READONLY;
2644 SourceLocation getEndLoc() const LLVM_READONLY;
2645
2646 /// Return true if this is a call to __assume() or __builtin_assume() with
2647 /// a non-value-dependent constant parameter evaluating as false.
2648 bool isBuiltinAssumeFalse(const ASTContext &Ctx) const;
2649
2650 bool isCallToStdMove() const {
2651 const FunctionDecl *FD = getDirectCallee();
2652 return getNumArgs() == 1 && FD && FD->isInStdNamespace() &&
2653 FD->getIdentifier() && FD->getIdentifier()->isStr("move");
2654 }
2655
2656 static bool classof(const Stmt *T) {
2657 return T->getStmtClass() >= firstCallExprConstant &&
2658 T->getStmtClass() <= lastCallExprConstant;
2659 }
2660
2661 // Iterators
2662 child_range children() {
2663 return child_range(getTrailingStmts(), getTrailingStmts() + PREARGS_START +
2664 getNumPreArgs() + getNumArgs());
2665 }
2666
2667 const_child_range children() const {
2668 return const_child_range(getTrailingStmts(),
2669 getTrailingStmts() + PREARGS_START +
2670 getNumPreArgs() + getNumArgs());
2671 }
2672 };
2673
2674 /// Extra data stored in some MemberExpr objects.
2675 struct MemberExprNameQualifier {
2676 /// The nested-name-specifier that qualifies the name, including
2677 /// source-location information.
2678 NestedNameSpecifierLoc QualifierLoc;
2679
2680 /// The DeclAccessPair through which the MemberDecl was found due to
2681 /// name qualifiers.
2682 DeclAccessPair FoundDecl;
2683 };
2684
2685 /// MemberExpr - [C99 6.5.2.3] Structure and Union Members. X->F and X.F.
2686 ///
2687 class MemberExpr final
2688 : public Expr,
2689 private llvm::TrailingObjects<MemberExpr, MemberExprNameQualifier,
2690 ASTTemplateKWAndArgsInfo,
2691 TemplateArgumentLoc> {
2692 friend class ASTReader;
2693 friend class ASTStmtWriter;
2694 friend TrailingObjects;
2695
2696 /// Base - the expression for the base pointer or structure references. In
2697 /// X.F, this is "X".
2698 Stmt *Base;
2699
2700 /// MemberDecl - This is the decl being referenced by the field/member name.
2701 /// In X.F, this is the decl referenced by F.
2702 ValueDecl *MemberDecl;
2703
2704 /// MemberDNLoc - Provides source/type location info for the
2705 /// declaration name embedded in MemberDecl.
2706 DeclarationNameLoc MemberDNLoc;
2707
2708 /// MemberLoc - This is the location of the member name.
2709 SourceLocation MemberLoc;
2710
2711 size_t numTrailingObjects(OverloadToken<MemberExprNameQualifier>) const {
2712 return hasQualifierOrFoundDecl();
2713 }
2714
2715 size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const {
2716 return hasTemplateKWAndArgsInfo();
2717 }
2718
2719 bool hasQualifierOrFoundDecl() const {
2720 return MemberExprBits.HasQualifierOrFoundDecl;
2721 }
2722
2723 bool hasTemplateKWAndArgsInfo() const {
2724 return MemberExprBits.HasTemplateKWAndArgsInfo;
2725 }
2726
2727 public:
2728 MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc,
2729 ValueDecl *memberdecl, const DeclarationNameInfo &NameInfo,
2730 QualType ty, ExprValueKind VK, ExprObjectKind OK)
2731 : Expr(MemberExprClass, ty, VK, OK, base->isTypeDependent(),
2732 base->isValueDependent(), base->isInstantiationDependent(),
2733 base->containsUnexpandedParameterPack()),
2734 Base(base), MemberDecl(memberdecl), MemberDNLoc(NameInfo.getInfo()),
2735 MemberLoc(NameInfo.getLoc()) {
2736 assert(memberdecl->getDeclName() == NameInfo.getName());
2737 MemberExprBits.IsArrow = isarrow;
2738 MemberExprBits.HasQualifierOrFoundDecl = false;
2739 MemberExprBits.HasTemplateKWAndArgsInfo = false;
2740 MemberExprBits.HadMultipleCandidates = false;
2741 MemberExprBits.OperatorLoc = operatorloc;
2742 }
2743
2744 // NOTE: this constructor should be used only when it is known that
2745 // the member name can not provide additional syntactic info
2746 // (i.e., source locations for C++ operator names or type source info
2747 // for constructors, destructors and conversion operators).
2748 MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc,
2749 ValueDecl *memberdecl, SourceLocation l, QualType ty,
2750 ExprValueKind VK, ExprObjectKind OK)
2751 : Expr(MemberExprClass, ty, VK, OK, base->isTypeDependent(),
2752 base->isValueDependent(), base->isInstantiationDependent(),
2753 base->containsUnexpandedParameterPack()),
2754 Base(base), MemberDecl(memberdecl), MemberDNLoc(), MemberLoc(l) {
2755 MemberExprBits.IsArrow = isarrow;
2756 MemberExprBits.HasQualifierOrFoundDecl = false;
2757 MemberExprBits.HasTemplateKWAndArgsInfo = false;
2758 MemberExprBits.HadMultipleCandidates = false;
2759 MemberExprBits.OperatorLoc = operatorloc;
2760 }
2761
2762 static MemberExpr *Create(const ASTContext &C, Expr *base, bool isarrow,
2763 SourceLocation OperatorLoc,
2764 NestedNameSpecifierLoc QualifierLoc,
2765 SourceLocation TemplateKWLoc, ValueDecl *memberdecl,
2766 DeclAccessPair founddecl,
2767 DeclarationNameInfo MemberNameInfo,
2768 const TemplateArgumentListInfo *targs, QualType ty,
2769 ExprValueKind VK, ExprObjectKind OK);
2770
2771 void setBase(Expr *E) { Base = E; }
2772 Expr *getBase() const { return cast<Expr>(Base); }
2773
2774 /// Retrieve the member declaration to which this expression refers.
2775 ///
2776 /// The returned declaration will be a FieldDecl or (in C++) a VarDecl (for
2777 /// static data members), a CXXMethodDecl, or an EnumConstantDecl.
2778 ValueDecl *getMemberDecl() const { return MemberDecl; }
2779 void setMemberDecl(ValueDecl *D) { MemberDecl = D; }
2780
2781 /// Retrieves the declaration found by lookup.
2782 DeclAccessPair getFoundDecl() const {
2783 if (!hasQualifierOrFoundDecl())
2784 return DeclAccessPair::make(getMemberDecl(),
2785 getMemberDecl()->getAccess());
2786 return getTrailingObjects<MemberExprNameQualifier>()->FoundDecl;
2787 }
2788
2789 /// Determines whether this member expression actually had
2790 /// a C++ nested-name-specifier prior to the name of the member, e.g.,
2791 /// x->Base::foo.
2792 bool hasQualifier() const { return getQualifier() != nullptr; }
2793
2794 /// If the member name was qualified, retrieves the
2795 /// nested-name-specifier that precedes the member name, with source-location
2796 /// information.
2797 NestedNameSpecifierLoc getQualifierLoc() const {
2798 if (!hasQualifierOrFoundDecl())
2799 return NestedNameSpecifierLoc();
2800 return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
2801 }
2802
2803 /// If the member name was qualified, retrieves the
2804 /// nested-name-specifier that precedes the member name. Otherwise, returns
2805 /// NULL.
2806 NestedNameSpecifier *getQualifier() const {
2807 return getQualifierLoc().getNestedNameSpecifier();
2808 }
2809
2810 /// Retrieve the location of the template keyword preceding
2811 /// the member name, if any.
2812 SourceLocation getTemplateKeywordLoc() const {
2813 if (!hasTemplateKWAndArgsInfo())
2814 return SourceLocation();
2815 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc;
2816 }
2817
2818 /// Retrieve the location of the left angle bracket starting the
2819 /// explicit template argument list following the member name, if any.
2820 SourceLocation getLAngleLoc() const {
2821 if (!hasTemplateKWAndArgsInfo())
2822 return SourceLocation();
2823 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc;
2824 }
2825
2826 /// Retrieve the location of the right angle bracket ending the
2827 /// explicit template argument list following the member name, if any.
2828 SourceLocation getRAngleLoc() const {
2829 if (!hasTemplateKWAndArgsInfo())
2830 return SourceLocation();
2831 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc;
2832 }
2833
2834 /// Determines whether the member name was preceded by the template keyword.
2835 bool hasTemplateKeyword() const { return getTemplateKeywordLoc().isValid(); }
2836
2837 /// Determines whether the member name was followed by an
2838 /// explicit template argument list.
2839 bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); }
2840
2841 /// Copies the template arguments (if present) into the given
2842 /// structure.
2843 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
2844 if (hasExplicitTemplateArgs())
2845 getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto(
2846 getTrailingObjects<TemplateArgumentLoc>(), List);
2847 }
2848
2849 /// Retrieve the template arguments provided as part of this
2850 /// template-id.
2851 const TemplateArgumentLoc *getTemplateArgs() const {
2852 if (!hasExplicitTemplateArgs())
2853 return nullptr;
2854
2855 return getTrailingObjects<TemplateArgumentLoc>();
2856 }
2857
2858 /// Retrieve the number of template arguments provided as part of this
2859 /// template-id.
2860 unsigned getNumTemplateArgs() const {
2861 if (!hasExplicitTemplateArgs())
2862 return 0;
2863
2864 return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs;
2865 }
2866
2867 ArrayRef<TemplateArgumentLoc> template_arguments() const {
2868 return {getTemplateArgs(), getNumTemplateArgs()};
2869 }
2870
2871 /// Retrieve the member declaration name info.
2872 DeclarationNameInfo getMemberNameInfo() const {
2873 return DeclarationNameInfo(MemberDecl->getDeclName(),
2874 MemberLoc, MemberDNLoc);
2875 }
2876
2877 SourceLocation getOperatorLoc() const { return MemberExprBits.OperatorLoc; }
2878
2879 bool isArrow() const { return MemberExprBits.IsArrow; }
2880 void setArrow(bool A) { MemberExprBits.IsArrow = A; }
2881
2882 /// getMemberLoc - Return the location of the "member", in X->F, it is the
2883 /// location of 'F'.
2884 SourceLocation getMemberLoc() const { return MemberLoc; }
2885 void setMemberLoc(SourceLocation L) { MemberLoc = L; }
2886
2887 SourceLocation getBeginLoc() const LLVM_READONLY;
2888 SourceLocation getEndLoc() const LLVM_READONLY;
2889
2890 SourceLocation getExprLoc() const LLVM_READONLY { return MemberLoc; }
2891
2892 /// Determine whether the base of this explicit is implicit.
2893 bool isImplicitAccess() const {
2894 return getBase() && getBase()->isImplicitCXXThis();
2895 }
2896
2897 /// Returns true if this member expression refers to a method that
2898 /// was resolved from an overloaded set having size greater than 1.
2899 bool hadMultipleCandidates() const {
2900 return MemberExprBits.HadMultipleCandidates;
2901 }
2902 /// Sets the flag telling whether this expression refers to
2903 /// a method that was resolved from an overloaded set having size
2904 /// greater than 1.
2905 void setHadMultipleCandidates(bool V = true) {
2906 MemberExprBits.HadMultipleCandidates = V;
2907 }
2908
2909 /// Returns true if virtual dispatch is performed.
2910 /// If the member access is fully qualified, (i.e. X::f()), virtual
2911 /// dispatching is not performed. In -fapple-kext mode qualified
2912 /// calls to virtual method will still go through the vtable.
2913 bool performsVirtualDispatch(const LangOptions &LO) const {
2914 return LO.AppleKext || !hasQualifier();
2915 }
2916
2917 static bool classof(const Stmt *T) {
2918 return T->getStmtClass() == MemberExprClass;
2919 }
2920
2921 // Iterators
2922 child_range children() { return child_range(&Base, &Base+1); }
2923 const_child_range children() const {
2924 return const_child_range(&Base, &Base + 1);
2925 }
2926 };
2927
2928 /// CompoundLiteralExpr - [C99 6.5.2.5]
2929 ///
2930 class CompoundLiteralExpr : public Expr {
2931 /// LParenLoc - If non-null, this is the location of the left paren in a
2932 /// compound literal like "(int){4}". This can be null if this is a
2933 /// synthesized compound expression.
2934 SourceLocation LParenLoc;
2935
2936 /// The type as written. This can be an incomplete array type, in
2937 /// which case the actual expression type will be different.
2938 /// The int part of the pair stores whether this expr is file scope.
2939 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
2940 Stmt *Init;
2941 public:
2942 CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo,
2943 QualType T, ExprValueKind VK, Expr *init, bool fileScope)
2944 : Expr(CompoundLiteralExprClass, T, VK, OK_Ordinary,
2945 tinfo->getType()->isDependentType(),
2946 init->isValueDependent(),
2947 (init->isInstantiationDependent() ||
2948 tinfo->getType()->isInstantiationDependentType()),
2949 init->containsUnexpandedParameterPack()),
2950 LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {}
2951
2952 /// Construct an empty compound literal.
2953 explicit CompoundLiteralExpr(EmptyShell Empty)
2954 : Expr(CompoundLiteralExprClass, Empty) { }
2955
2956 const Expr *getInitializer() const { return cast<Expr>(Init); }
2957 Expr *getInitializer() { return cast<Expr>(Init); }
2958 void setInitializer(Expr *E) { Init = E; }
2959
2960 bool isFileScope() const { return TInfoAndScope.getInt(); }
2961 void setFileScope(bool FS) { TInfoAndScope.setInt(FS); }
2962
2963 SourceLocation getLParenLoc() const { return LParenLoc; }
2964 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
2965
2966 TypeSourceInfo *getTypeSourceInfo() const {
2967 return TInfoAndScope.getPointer();
2968 }
2969 void setTypeSourceInfo(TypeSourceInfo *tinfo) {
2970 TInfoAndScope.setPointer(tinfo);
2971 }
2972
2973 SourceLocation getBeginLoc() const LLVM_READONLY {
2974 // FIXME: Init should never be null.
2975 if (!Init)
2976 return SourceLocation();
2977 if (LParenLoc.isInvalid())
2978 return Init->getBeginLoc();
2979 return LParenLoc;
2980 }
2981 SourceLocation getEndLoc() const LLVM_READONLY {
2982 // FIXME: Init should never be null.
2983 if (!Init)
2984 return SourceLocation();
2985 return Init->getEndLoc();
2986 }
2987
2988 static bool classof(const Stmt *T) {
2989 return T->getStmtClass() == CompoundLiteralExprClass;
2990 }
2991
2992 // Iterators
2993 child_range children() { return child_range(&Init, &Init+1); }
2994 const_child_range children() const {
2995 return const_child_range(&Init, &Init + 1);
2996 }
2997 };
2998
2999 /// CastExpr - Base class for type casts, including both implicit
3000 /// casts (ImplicitCastExpr) and explicit casts that have some
3001 /// representation in the source code (ExplicitCastExpr's derived
3002 /// classes).
3003 class CastExpr : public Expr {
3004 Stmt *Op;
3005
3006 bool CastConsistency() const;
3007
3008 const CXXBaseSpecifier * const *path_buffer() const {
3009 return const_cast<CastExpr*>(this)->path_buffer();
3010 }
3011 CXXBaseSpecifier **path_buffer();
3012
3013 protected:
3014 CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind,
3015 Expr *op, unsigned BasePathSize)
3016 : Expr(SC, ty, VK, OK_Ordinary,
3017 // Cast expressions are type-dependent if the type is
3018 // dependent (C++ [temp.dep.expr]p3).
3019 ty->isDependentType(),
3020 // Cast expressions are value-dependent if the type is
3021 // dependent or if the subexpression is value-dependent.
3022 ty->isDependentType() || (op && op->isValueDependent()),
3023 (ty->isInstantiationDependentType() ||
3024 (op && op->isInstantiationDependent())),
3025 // An implicit cast expression doesn't (lexically) contain an
3026 // unexpanded pack, even if its target type does.
3027 ((SC != ImplicitCastExprClass &&
3028 ty->containsUnexpandedParameterPack()) ||
3029 (op && op->containsUnexpandedParameterPack()))),
3030 Op(op) {
3031 CastExprBits.Kind = kind;
3032 CastExprBits.PartOfExplicitCast = false;
3033 CastExprBits.BasePathSize = BasePathSize;
3034 assert((CastExprBits.BasePathSize == BasePathSize) &&
3035 "BasePathSize overflow!");
3036 assert(CastConsistency());
3037 }
3038
3039 /// Construct an empty cast.
3040 CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
3041 : Expr(SC, Empty) {
3042 CastExprBits.PartOfExplicitCast = false;
3043 CastExprBits.BasePathSize = BasePathSize;
3044 assert((CastExprBits.BasePathSize == BasePathSize) &&
3045 "BasePathSize overflow!");
3046 }
3047
3048 public:
3049 CastKind getCastKind() const { return (CastKind) CastExprBits.Kind; }
3050 void setCastKind(CastKind K) { CastExprBits.Kind = K; }
3051
3052 static const char *getCastKindName(CastKind CK);
3053 const char *getCastKindName() const { return getCastKindName(getCastKind()); }
3054
3055 Expr *getSubExpr() { return cast<Expr>(Op); }
3056 const Expr *getSubExpr() const { return cast<Expr>(Op); }
3057 void setSubExpr(Expr *E) { Op = E; }
3058
3059 /// Retrieve the cast subexpression as it was written in the source
3060 /// code, looking through any implicit casts or other intermediate nodes
3061 /// introduced by semantic analysis.
3062 Expr *getSubExprAsWritten();
3063 const Expr *getSubExprAsWritten() const {
3064 return const_cast<CastExpr *>(this)->getSubExprAsWritten();
3065 }
3066
3067 /// If this cast applies a user-defined conversion, retrieve the conversion
3068 /// function that it invokes.
3069 NamedDecl *getConversionFunction() const;
3070
3071 typedef CXXBaseSpecifier **path_iterator;
3072 typedef const CXXBaseSpecifier *const *path_const_iterator;
3073 bool path_empty() const { return path_size() == 0; }
3074 unsigned path_size() const { return CastExprBits.BasePathSize; }
3075 path_iterator path_begin() { return path_buffer(); }
3076 path_iterator path_end() { return path_buffer() + path_size(); }
3077 path_const_iterator path_begin() const { return path_buffer(); }
3078 path_const_iterator path_end() const { return path_buffer() + path_size(); }
3079
3080 const FieldDecl *getTargetUnionField() const {
3081 assert(getCastKind() == CK_ToUnion);
3082 return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType());
3083 }
3084
3085 static const FieldDecl *getTargetFieldForToUnionCast(QualType unionType,
3086 QualType opType);
3087 static const FieldDecl *getTargetFieldForToUnionCast(const RecordDecl *RD,
3088 QualType opType);
3089
3090 static bool classof(const Stmt *T) {
3091 return T->getStmtClass() >= firstCastExprConstant &&
3092 T->getStmtClass() <= lastCastExprConstant;
3093 }
3094
3095 // Iterators
3096 child_range children() { return child_range(&Op, &Op+1); }
3097 const_child_range children() const { return const_child_range(&Op, &Op + 1); }
3098 };
3099
3100 /// ImplicitCastExpr - Allows us to explicitly represent implicit type
3101 /// conversions, which have no direct representation in the original
3102 /// source code. For example: converting T[]->T*, void f()->void
3103 /// (*f)(), float->double, short->int, etc.
3104 ///
3105 /// In C, implicit casts always produce rvalues. However, in C++, an
3106 /// implicit cast whose result is being bound to a reference will be
3107 /// an lvalue or xvalue. For example:
3108 ///
3109 /// @code
3110 /// class Base { };
3111 /// class Derived : public Base { };
3112 /// Derived &&ref();
3113 /// void f(Derived d) {
3114 /// Base& b = d; // initializer is an ImplicitCastExpr
3115 /// // to an lvalue of type Base
3116 /// Base&& r = ref(); // initializer is an ImplicitCastExpr
3117 /// // to an xvalue of type Base
3118 /// }
3119 /// @endcode
3120 class ImplicitCastExpr final
3121 : public CastExpr,
3122 private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *> {
3123
3124 ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
3125 unsigned BasePathLength, ExprValueKind VK)
3126 : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { }
3127
3128 /// Construct an empty implicit cast.
3129 explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize)
3130 : CastExpr(ImplicitCastExprClass, Shell, PathSize) { }
3131
3132 public:
3133 enum OnStack_t { OnStack };
3134 ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op,
3135 ExprValueKind VK)
3136 : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) {
3137 }
3138
3139 bool isPartOfExplicitCast() const { return CastExprBits.PartOfExplicitCast; }
3140 void setIsPartOfExplicitCast(bool PartOfExplicitCast) {
3141 CastExprBits.PartOfExplicitCast = PartOfExplicitCast;
3142 }
3143
3144 static ImplicitCastExpr *Create(const ASTContext &Context, QualType T,
3145 CastKind Kind, Expr *Operand,
3146 const CXXCastPath *BasePath,
3147 ExprValueKind Cat);
3148
3149 static ImplicitCastExpr *CreateEmpty(const ASTContext &Context,
3150 unsigned PathSize);
3151
3152 SourceLocation getBeginLoc() const LLVM_READONLY {
3153 return getSubExpr()->getBeginLoc();
3154 }
3155 SourceLocation getEndLoc() const LLVM_READONLY {
3156 return getSubExpr()->getEndLoc();
3157 }
3158
3159 static bool classof(const Stmt *T) {
3160 return T->getStmtClass() == ImplicitCastExprClass;
3161 }
3162
3163 friend TrailingObjects;
3164 friend class CastExpr;
3165 };
3166
3167 inline Expr *Expr::IgnoreImpCasts() {
3168 Expr *e = this;
3169 while (true)
3170 if (ImplicitCastExpr *ice = dyn_cast<ImplicitCastExpr>(e))
3171 e = ice->getSubExpr();
3172 else if (FullExpr *fe = dyn_cast<FullExpr>(e))
3173 e = fe->getSubExpr();
3174 else
3175 break;
3176 return e;
3177 }
3178
3179 /// ExplicitCastExpr - An explicit cast written in the source
3180 /// code.
3181 ///
3182 /// This class is effectively an abstract class, because it provides
3183 /// the basic representation of an explicitly-written cast without
3184 /// specifying which kind of cast (C cast, functional cast, static
3185 /// cast, etc.) was written; specific derived classes represent the
3186 /// particular style of cast and its location information.
3187 ///
3188 /// Unlike implicit casts, explicit cast nodes have two different
3189 /// types: the type that was written into the source code, and the
3190 /// actual type of the expression as determined by semantic
3191 /// analysis. These types may differ slightly. For example, in C++ one
3192 /// can cast to a reference type, which indicates that the resulting
3193 /// expression will be an lvalue or xvalue. The reference type, however,
3194 /// will not be used as the type of the expression.
3195 class ExplicitCastExpr : public CastExpr {
3196 /// TInfo - Source type info for the (written) type
3197 /// this expression is casting to.
3198 TypeSourceInfo *TInfo;
3199
3200 protected:
3201 ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK,
3202 CastKind kind, Expr *op, unsigned PathSize,
3203 TypeSourceInfo *writtenTy)
3204 : CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {}
3205
3206 /// Construct an empty explicit cast.
3207 ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
3208 : CastExpr(SC, Shell, PathSize) { }
3209
3210 public:
3211 /// getTypeInfoAsWritten - Returns the type source info for the type
3212 /// that this expression is casting to.
3213 TypeSourceInfo *getTypeInfoAsWritten() const { return TInfo; }
3214 void setTypeInfoAsWritten(TypeSourceInfo *writtenTy) { TInfo = writtenTy; }
3215
3216 /// getTypeAsWritten - Returns the type that this expression is
3217 /// casting to, as written in the source code.
3218 QualType getTypeAsWritten() const { return TInfo->getType(); }
3219
3220 static bool classof(const Stmt *T) {
3221 return T->getStmtClass() >= firstExplicitCastExprConstant &&
3222 T->getStmtClass() <= lastExplicitCastExprConstant;
3223 }
3224 };
3225
3226 /// CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style
3227 /// cast in C++ (C++ [expr.cast]), which uses the syntax
3228 /// (Type)expr. For example: @c (int)f.
3229 class CStyleCastExpr final
3230 : public ExplicitCastExpr,
3231 private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *> {
3232 SourceLocation LPLoc; // the location of the left paren
3233 SourceLocation RPLoc; // the location of the right paren
3234
3235 CStyleCastExpr(QualType exprTy, ExprValueKind vk, CastKind kind, Expr *op,
3236 unsigned PathSize, TypeSourceInfo *writtenTy,
3237 SourceLocation l, SourceLocation r)
3238 : ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize,
3239 writtenTy), LPLoc(l), RPLoc(r) {}
3240
3241 /// Construct an empty C-style explicit cast.
3242 explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize)
3243 : ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize) { }
3244
3245 public:
3246 static CStyleCastExpr *Create(const ASTContext &Context, QualType T,
3247 ExprValueKind VK, CastKind K,
3248 Expr *Op, const CXXCastPath *BasePath,
3249 TypeSourceInfo *WrittenTy, SourceLocation L,
3250 SourceLocation R);
3251
3252 static CStyleCastExpr *CreateEmpty(const ASTContext &Context,
3253 unsigned PathSize);
3254
3255 SourceLocation getLParenLoc() const { return LPLoc; }
3256 void setLParenLoc(SourceLocation L) { LPLoc = L; }
3257
3258 SourceLocation getRParenLoc() const { return RPLoc; }
3259 void setRParenLoc(SourceLocation L) { RPLoc = L; }
3260
3261 SourceLocation getBeginLoc() const LLVM_READONLY { return LPLoc; }
3262 SourceLocation getEndLoc() const LLVM_READONLY {
3263 return getSubExpr()->getEndLoc();
3264 }
3265
3266 static bool classof(const Stmt *T) {
3267 return T->getStmtClass() == CStyleCastExprClass;
3268 }
3269
3270 friend TrailingObjects;
3271 friend class CastExpr;
3272 };
3273
3274 /// A builtin binary operation expression such as "x + y" or "x <= y".
3275 ///
3276 /// This expression node kind describes a builtin binary operation,
3277 /// such as "x + y" for integer values "x" and "y". The operands will
3278 /// already have been converted to appropriate types (e.g., by
3279 /// performing promotions or conversions).
3280 ///
3281 /// In C++, where operators may be overloaded, a different kind of
3282 /// expression node (CXXOperatorCallExpr) is used to express the
3283 /// invocation of an overloaded operator with operator syntax. Within
3284 /// a C++ template, whether BinaryOperator or CXXOperatorCallExpr is
3285 /// used to store an expression "x + y" depends on the subexpressions
3286 /// for x and y. If neither x or y is type-dependent, and the "+"
3287 /// operator resolves to a built-in operation, BinaryOperator will be
3288 /// used to express the computation (x and y may still be
3289 /// value-dependent). If either x or y is type-dependent, or if the
3290 /// "+" resolves to an overloaded operator, CXXOperatorCallExpr will
3291 /// be used to express the computation.
3292 class BinaryOperator : public Expr {
3293 enum { LHS, RHS, END_EXPR };
3294 Stmt *SubExprs[END_EXPR];
3295
3296 public:
3297 typedef BinaryOperatorKind Opcode;
3298
3299 BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
3300 ExprValueKind VK, ExprObjectKind OK,
3301 SourceLocation opLoc, FPOptions FPFeatures)
3302 : Expr(BinaryOperatorClass, ResTy, VK, OK,
3303 lhs->isTypeDependent() || rhs->isTypeDependent(),
3304 lhs->isValueDependent() || rhs->isValueDependent(),
3305 (lhs->isInstantiationDependent() ||
3306 rhs->isInstantiationDependent()),
3307 (lhs->containsUnexpandedParameterPack() ||
3308 rhs->containsUnexpandedParameterPack())) {
3309 BinaryOperatorBits.Opc = opc;
3310 BinaryOperatorBits.FPFeatures = FPFeatures.getInt();
3311 BinaryOperatorBits.OpLoc = opLoc;
3312 SubExprs[LHS] = lhs;
3313 SubExprs[RHS] = rhs;
3314 assert(!isCompoundAssignmentOp() &&
3315 "Use CompoundAssignOperator for compound assignments");
3316 }
3317
3318 /// Construct an empty binary operator.
3319 explicit BinaryOperator(EmptyShell Empty) : Expr(BinaryOperatorClass, Empty) {
3320 BinaryOperatorBits.Opc = BO_Comma;
3321 }
3322
3323 SourceLocation getExprLoc() const { return getOperatorLoc(); }
3324 SourceLocation getOperatorLoc() const { return BinaryOperatorBits.OpLoc; }
3325 void setOperatorLoc(SourceLocation L) { BinaryOperatorBits.OpLoc = L; }
3326
3327 Opcode getOpcode() const {
3328 return static_cast<Opcode>(BinaryOperatorBits.Opc);
3329 }
3330 void setOpcode(Opcode Opc) { BinaryOperatorBits.Opc = Opc; }
3331
3332 Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); }
3333 void setLHS(Expr *E) { SubExprs[LHS] = E; }
3334 Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
3335 void setRHS(Expr *E) { SubExprs[RHS] = E; }
3336
3337 SourceLocation getBeginLoc() const LLVM_READONLY {
3338 return getLHS()->getBeginLoc();
3339 }
3340 SourceLocation getEndLoc() const LLVM_READONLY {
3341 return getRHS()->getEndLoc();
3342 }
3343
3344 /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
3345 /// corresponds to, e.g. "<<=".
3346 static StringRef getOpcodeStr(Opcode Op);
3347
3348 StringRef getOpcodeStr() const { return getOpcodeStr(getOpcode()); }
3349
3350 /// Retrieve the binary opcode that corresponds to the given
3351 /// overloaded operator.
3352 static Opcode getOverloadedOpcode(OverloadedOperatorKind OO);
3353
3354 /// Retrieve the overloaded operator kind that corresponds to
3355 /// the given binary opcode.
3356 static OverloadedOperatorKind getOverloadedOperator(Opcode Opc);
3357
3358 /// predicates to categorize the respective opcodes.
3359 static bool isPtrMemOp(Opcode Opc) {
3360 return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3361 }
3362 bool isPtrMemOp() const { return isPtrMemOp(getOpcode()); }
3363
3364 static bool isMultiplicativeOp(Opcode Opc) {
3365 return Opc >= BO_Mul && Opc <= BO_Rem;
3366 }
3367 bool isMultiplicativeOp() const { return isMultiplicativeOp(getOpcode()); }
3368 static bool isAdditiveOp(Opcode Opc) { return Opc == BO_Add || Opc==BO_Sub; }
3369 bool isAdditiveOp() const { return isAdditiveOp(getOpcode()); }
3370 static bool isShiftOp(Opcode Opc) { return Opc == BO_Shl || Opc == BO_Shr; }
3371 bool isShiftOp() const { return isShiftOp(getOpcode()); }
3372
3373 static bool isBitwiseOp(Opcode Opc) { return Opc >= BO_And && Opc <= BO_Or; }
3374 bool isBitwiseOp() const { return isBitwiseOp(getOpcode()); }
3375
3376 static bool isRelationalOp(Opcode Opc) { return Opc >= BO_LT && Opc<=BO_GE; }
3377 bool isRelationalOp() const { return isRelationalOp(getOpcode()); }
3378
3379 static bool isEqualityOp(Opcode Opc) { return Opc == BO_EQ || Opc == BO_NE; }
3380 bool isEqualityOp() const { return isEqualityOp(getOpcode()); }
3381
3382 static bool isComparisonOp(Opcode Opc) { return Opc >= BO_Cmp && Opc<=BO_NE; }
3383 bool isComparisonOp() const { return isComparisonOp(getOpcode()); }
3384
3385 static Opcode negateComparisonOp(Opcode Opc) {
3386 switch (Opc) {
3387 default:
3388 llvm_unreachable("Not a comparison operator.");
3389 case BO_LT: return BO_GE;
3390 case BO_GT: return BO_LE;
3391 case BO_LE: return BO_GT;
3392 case BO_GE: return BO_LT;
3393 case BO_EQ: return BO_NE;
3394 case BO_NE: return BO_EQ;
3395 }
3396 }
3397
3398 static Opcode reverseComparisonOp(Opcode Opc) {
3399 switch (Opc) {
3400 default:
3401 llvm_unreachable("Not a comparison operator.");
3402 case BO_LT: return BO_GT;
3403 case BO_GT: return BO_LT;
3404 case BO_LE: return BO_GE;
3405 case BO_GE: return BO_LE;
3406 case BO_EQ:
3407 case BO_NE:
3408 return Opc;
3409 }
3410 }
3411
3412 static bool isLogicalOp(Opcode Opc) { return Opc == BO_LAnd || Opc==BO_LOr; }
3413 bool isLogicalOp() const { return isLogicalOp(getOpcode()); }
3414
3415 static bool isAssignmentOp(Opcode Opc) {
3416 return Opc >= BO_Assign && Opc <= BO_OrAssign;
3417 }
3418 bool isAssignmentOp() const { return isAssignmentOp(getOpcode()); }
3419
3420 static bool isCompoundAssignmentOp(Opcode Opc) {
3421 return Opc > BO_Assign && Opc <= BO_OrAssign;
3422 }
3423 bool isCompoundAssignmentOp() const {
3424 return isCompoundAssignmentOp(getOpcode());
3425 }
3426 static Opcode getOpForCompoundAssignment(Opcode Opc) {
3427 assert(isCompoundAssignmentOp(Opc));
3428 if (Opc >= BO_AndAssign)
3429 return Opcode(unsigned(Opc) - BO_AndAssign + BO_And);
3430 else
3431 return Opcode(unsigned(Opc) - BO_MulAssign + BO_Mul);
3432 }
3433
3434 static bool isShiftAssignOp(Opcode Opc) {
3435 return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
3436 }
3437 bool isShiftAssignOp() const {
3438 return isShiftAssignOp(getOpcode());
3439 }
3440
3441 // Return true if a binary operator using the specified opcode and operands
3442 // would match the 'p = (i8*)nullptr + n' idiom for casting a pointer-sized
3443 // integer to a pointer.
3444 static bool isNullPointerArithmeticExtension(ASTContext &Ctx, Opcode Opc,
3445 Expr *LHS, Expr *RHS);
3446
3447 static bool classof(const Stmt *S) {
3448 return S->getStmtClass() >= firstBinaryOperatorConstant &&
3449 S->getStmtClass() <= lastBinaryOperatorConstant;
3450 }
3451
3452 // Iterators
3453 child_range children() {
3454 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3455 }
3456 const_child_range children() const {
3457 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
3458 }
3459
3460 // Set the FP contractability status of this operator. Only meaningful for
3461 // operations on floating point types.
3462 void setFPFeatures(FPOptions F) {
3463 BinaryOperatorBits.FPFeatures = F.getInt();
3464 }
3465
3466 FPOptions getFPFeatures() const {
3467 return FPOptions(BinaryOperatorBits.FPFeatures);
3468 }
3469
3470 // Get the FP contractability status of this operator. Only meaningful for
3471 // operations on floating point types.
3472 bool isFPContractableWithinStatement() const {
3473 return getFPFeatures().allowFPContractWithinStatement();
3474 }
3475
3476 // Get the FENV_ACCESS status of this operator. Only meaningful for
3477 // operations on floating point types.
3478 bool isFEnvAccessOn() const { return getFPFeatures().allowFEnvAccess(); }
3479
3480 protected:
3481 BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
3482 ExprValueKind VK, ExprObjectKind OK,
3483 SourceLocation opLoc, FPOptions FPFeatures, bool dead2)
3484 : Expr(CompoundAssignOperatorClass, ResTy, VK, OK,
3485 lhs->isTypeDependent() || rhs->isTypeDependent(),
3486 lhs->isValueDependent() || rhs->isValueDependent(),
3487 (lhs->isInstantiationDependent() ||
3488 rhs->isInstantiationDependent()),
3489 (lhs->containsUnexpandedParameterPack() ||
3490 rhs->containsUnexpandedParameterPack())) {
3491 BinaryOperatorBits.Opc = opc;
3492 BinaryOperatorBits.FPFeatures = FPFeatures.getInt();
3493 BinaryOperatorBits.OpLoc = opLoc;
3494 SubExprs[LHS] = lhs;
3495 SubExprs[RHS] = rhs;
3496 }
3497
3498 BinaryOperator(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) {
3499 BinaryOperatorBits.Opc = BO_MulAssign;
3500 }
3501 };
3502
3503 /// CompoundAssignOperator - For compound assignments (e.g. +=), we keep
3504 /// track of the type the operation is performed in. Due to the semantics of
3505 /// these operators, the operands are promoted, the arithmetic performed, an
3506 /// implicit conversion back to the result type done, then the assignment takes
3507 /// place. This captures the intermediate type which the computation is done
3508 /// in.
3509 class CompoundAssignOperator : public BinaryOperator {
3510 QualType ComputationLHSType;
3511 QualType ComputationResultType;
3512 public:
3513 CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResType,
3514 ExprValueKind VK, ExprObjectKind OK,
3515 QualType CompLHSType, QualType CompResultType,
3516 SourceLocation OpLoc, FPOptions FPFeatures)
3517 : BinaryOperator(lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
3518 true),
3519 ComputationLHSType(CompLHSType),
3520 ComputationResultType(CompResultType) {
3521 assert(isCompoundAssignmentOp() &&
3522 "Only should be used for compound assignments");
3523 }
3524
3525 /// Build an empty compound assignment operator expression.
3526 explicit CompoundAssignOperator(EmptyShell Empty)
3527 : BinaryOperator(CompoundAssignOperatorClass, Empty) { }
3528
3529 // The two computation types are the type the LHS is converted
3530 // to for the computation and the type of the result; the two are
3531 // distinct in a few cases (specifically, int+=ptr and ptr-=ptr).
3532 QualType getComputationLHSType() const { return ComputationLHSType; }
3533 void setComputationLHSType(QualType T) { ComputationLHSType = T; }
3534
3535 QualType getComputationResultType() const { return ComputationResultType; }
3536 void setComputationResultType(QualType T) { ComputationResultType = T; }
3537
3538 static bool classof(const Stmt *S) {
3539 return S->getStmtClass() == CompoundAssignOperatorClass;
3540 }
3541 };
3542
3543 /// AbstractConditionalOperator - An abstract base class for
3544 /// ConditionalOperator and BinaryConditionalOperator.
3545 class AbstractConditionalOperator : public Expr {
3546 SourceLocation QuestionLoc, ColonLoc;
3547 friend class ASTStmtReader;
3548
3549 protected:
3550 AbstractConditionalOperator(StmtClass SC, QualType T,
3551 ExprValueKind VK, ExprObjectKind OK,
3552 bool TD, bool VD, bool ID,
3553 bool ContainsUnexpandedParameterPack,
3554 SourceLocation qloc,
3555 SourceLocation cloc)
3556 : Expr(SC, T, VK, OK, TD, VD, ID, ContainsUnexpandedParameterPack),
3557 QuestionLoc(qloc), ColonLoc(cloc) {}
3558
3559 AbstractConditionalOperator(StmtClass SC, EmptyShell Empty)
3560 : Expr(SC, Empty) { }
3561
3562 public:
3563 // getCond - Return the expression representing the condition for
3564 // the ?: operator.
3565 Expr *getCond() const;
3566
3567 // getTrueExpr - Return the subexpression representing the value of
3568 // the expression if the condition evaluates to true.
3569 Expr *getTrueExpr() const;
3570
3571 // getFalseExpr - Return the subexpression representing the value of
3572 // the expression if the condition evaluates to false. This is
3573 // the same as getRHS.
3574 Expr *getFalseExpr() const;
3575
3576 SourceLocation getQuestionLoc() const { return QuestionLoc; }
3577 SourceLocation getColonLoc() const { return ColonLoc; }
3578
3579 static bool classof(const Stmt *T) {
3580 return T->getStmtClass() == ConditionalOperatorClass ||
3581 T->getStmtClass() == BinaryConditionalOperatorClass;
3582 }
3583 };
3584
3585 /// ConditionalOperator - The ?: ternary operator. The GNU "missing
3586 /// middle" extension is a BinaryConditionalOperator.
3587 class ConditionalOperator : public AbstractConditionalOperator {
3588 enum { COND, LHS, RHS, END_EXPR };
3589 Stmt* SubExprs[END_EXPR]; // Left/Middle/Right hand sides.
3590
3591 friend class ASTStmtReader;
3592 public:
3593 ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs,
3594 SourceLocation CLoc, Expr *rhs,
3595 QualType t, ExprValueKind VK, ExprObjectKind OK)
3596 : AbstractConditionalOperator(ConditionalOperatorClass, t, VK, OK,
3597 // FIXME: the type of the conditional operator doesn't
3598 // depend on the type of the conditional, but the standard
3599 // seems to imply that it could. File a bug!
3600 (lhs->isTypeDependent() || rhs->isTypeDependent()),
3601 (cond->isValueDependent() || lhs->isValueDependent() ||
3602 rhs->isValueDependent()),
3603 (cond->isInstantiationDependent() ||
3604 lhs->isInstantiationDependent() ||
3605 rhs->isInstantiationDependent()),
3606 (cond->containsUnexpandedParameterPack() ||
3607 lhs->containsUnexpandedParameterPack() ||
3608 rhs->containsUnexpandedParameterPack()),
3609 QLoc, CLoc) {
3610 SubExprs[COND] = cond;
3611 SubExprs[LHS] = lhs;
3612 SubExprs[RHS] = rhs;
3613 }
3614
3615 /// Build an empty conditional operator.
3616 explicit ConditionalOperator(EmptyShell Empty)
3617 : AbstractConditionalOperator(ConditionalOperatorClass, Empty) { }
3618
3619 // getCond - Return the expression representing the condition for
3620 // the ?: operator.
3621 Expr *getCond() const { return cast<Expr>(SubExprs[COND]); }
3622
3623 // getTrueExpr - Return the subexpression representing the value of
3624 // the expression if the condition evaluates to true.
3625 Expr *getTrueExpr() const { return cast<Expr>(SubExprs[LHS]); }
3626
3627 // getFalseExpr - Return the subexpression representing the value of
3628 // the expression if the condition evaluates to false. This is
3629 // the same as getRHS.
3630 Expr *getFalseExpr() const { return cast<Expr>(SubExprs[RHS]); }
3631
3632 Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); }
3633 Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
3634
3635 SourceLocation getBeginLoc() const LLVM_READONLY {
3636 return getCond()->getBeginLoc();
3637 }
3638 SourceLocation getEndLoc() const LLVM_READONLY {
3639 return getRHS()->getEndLoc();
3640 }
3641
3642 static bool classof(const Stmt *T) {
3643 return T->getStmtClass() == ConditionalOperatorClass;
3644 }
3645
3646 // Iterators
3647 child_range children() {
3648 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
3649 }
3650 const_child_range children() const {
3651 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
3652 }
3653 };
3654
3655 /// BinaryConditionalOperator - The GNU extension to the conditional
3656 /// operator which allows the middle operand to be omitted.
3657 ///
3658 /// This is a different expression kind on the assumption that almost
3659 /// every client ends up needing to know that these are different.
3660 class BinaryConditionalOperator : public AbstractConditionalOperator {
3661 enum { COMMON, COND, LHS, RHS, NUM_SUBEXPRS };
3662
3663 /// - the common condition/left-hand-side expression, which will be
3664 /// evaluated as the opaque value
3665 /// - the condition, expressed in terms of the opaque value
3666 /// - the left-hand-side, expressed in terms of the opaque value
3667 /// - the right-hand-side
3668 Stmt *SubExprs[NUM_SUBEXPRS];
3669 OpaqueValueExpr *OpaqueValue;
3670
3671 friend class ASTStmtReader;
3672 public:
3673 BinaryConditionalOperator(Expr *common, OpaqueValueExpr *opaqueValue,
3674 Expr *cond, Expr *lhs, Expr *rhs,
3675 SourceLocation qloc, SourceLocation cloc,
3676 QualType t, ExprValueKind VK, ExprObjectKind OK)
3677 : AbstractConditionalOperator(BinaryConditionalOperatorClass, t, VK, OK,
3678 (common->isTypeDependent() || rhs->isTypeDependent()),
3679 (common->isValueDependent() || rhs->isValueDependent()),
3680 (common->isInstantiationDependent() ||
3681 rhs->isInstantiationDependent()),
3682 (common->containsUnexpandedParameterPack() ||
3683 rhs->containsUnexpandedParameterPack()),
3684 qloc, cloc),
3685 OpaqueValue(opaqueValue) {
3686 SubExprs[COMMON] = common;
3687 SubExprs[COND] = cond;
3688 SubExprs[LHS] = lhs;
3689 SubExprs[RHS] = rhs;
3690 assert(OpaqueValue->getSourceExpr() == common && "Wrong opaque value");
3691 }
3692
3693 /// Build an empty conditional operator.
3694 explicit BinaryConditionalOperator(EmptyShell Empty)
3695 : AbstractConditionalOperator(BinaryConditionalOperatorClass, Empty) { }
3696
3697 /// getCommon - Return the common expression, written to the
3698 /// left of the condition. The opaque value will be bound to the
3699 /// result of this expression.
3700 Expr *getCommon() const { return cast<Expr>(SubExprs[COMMON]); }
3701
3702 /// getOpaqueValue - Return the opaque value placeholder.
3703 OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; }
3704
3705 /// getCond - Return the condition expression; this is defined
3706 /// in terms of the opaque value.
3707 Expr *getCond() const { return cast<Expr>(SubExprs[COND]); }
3708
3709 /// getTrueExpr - Return the subexpression which will be
3710 /// evaluated if the condition evaluates to true; this is defined
3711 /// in terms of the opaque value.
3712 Expr *getTrueExpr() const {
3713 return cast<Expr>(SubExprs[LHS]);
3714 }
3715
3716 /// getFalseExpr - Return the subexpression which will be
3717 /// evaluated if the condnition evaluates to false; this is
3718 /// defined in terms of the opaque value.
3719 Expr *getFalseExpr() const {
3720 return cast<Expr>(SubExprs[RHS]);
3721 }
3722
3723 SourceLocation getBeginLoc() const LLVM_READONLY {
3724 return getCommon()->getBeginLoc();
3725 }
3726 SourceLocation getEndLoc() const LLVM_READONLY {
3727 return getFalseExpr()->getEndLoc();
3728 }
3729
3730 static bool classof(const Stmt *T) {
3731 return T->getStmtClass() == BinaryConditionalOperatorClass;
3732 }
3733
3734 // Iterators
3735 child_range children() {
3736 return child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
3737 }
3738 const_child_range children() const {
3739 return const_child_range(SubExprs, SubExprs + NUM_SUBEXPRS);
3740 }
3741 };
3742
3743 inline Expr *AbstractConditionalOperator::getCond() const {
3744 if (const ConditionalOperator *co = dyn_cast<ConditionalOperator>(this))
3745 return co->getCond();
3746 return cast<BinaryConditionalOperator>(this)->getCond();
3747 }
3748
3749 inline Expr *AbstractConditionalOperator::getTrueExpr() const {
3750 if (const ConditionalOperator *co = dyn_cast<ConditionalOperator>(this))
3751 return co->getTrueExpr();
3752 return cast<BinaryConditionalOperator>(this)->getTrueExpr();
3753 }
3754
3755 inline Expr *AbstractConditionalOperator::getFalseExpr() const {
3756 if (const ConditionalOperator *co = dyn_cast<ConditionalOperator>(this))
3757 return co->getFalseExpr();
3758 return cast<BinaryConditionalOperator>(this)->getFalseExpr();
3759 }
3760
3761 /// AddrLabelExpr - The GNU address of label extension, representing &&label.
3762 class AddrLabelExpr : public Expr {
3763 SourceLocation AmpAmpLoc, LabelLoc;
3764 LabelDecl *Label;
3765 public:
3766 AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L,
3767 QualType t)
3768 : Expr(AddrLabelExprClass, t, VK_RValue, OK_Ordinary, false, false, false,
3769 false),
3770 AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
3771
3772 /// Build an empty address of a label expression.
3773 explicit AddrLabelExpr(EmptyShell Empty)
3774 : Expr(AddrLabelExprClass, Empty) { }
3775
3776 SourceLocation getAmpAmpLoc() const { return AmpAmpLoc; }
3777 void setAmpAmpLoc(SourceLocation L) { AmpAmpLoc = L; }
3778 SourceLocation getLabelLoc() const { return LabelLoc; }
3779 void setLabelLoc(SourceLocation L) { LabelLoc = L; }
3780
3781 SourceLocation getBeginLoc() const LLVM_READONLY { return AmpAmpLoc; }
3782 SourceLocation getEndLoc() const LLVM_READONLY { return LabelLoc; }
3783
3784 LabelDecl *getLabel() const { return Label; }
3785 void setLabel(LabelDecl *L) { Label = L; }
3786
3787 static bool classof(const Stmt *T) {
3788 return T->getStmtClass() == AddrLabelExprClass;
3789 }
3790
3791 // Iterators
3792 child_range children() {
3793 return child_range(child_iterator(), child_iterator());
3794 }
3795 const_child_range children() const {
3796 return const_child_range(const_child_iterator(), const_child_iterator());
3797 }
3798 };
3799
3800 /// StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
3801 /// The StmtExpr contains a single CompoundStmt node, which it evaluates and
3802 /// takes the value of the last subexpression.
3803 ///
3804 /// A StmtExpr is always an r-value; values "returned" out of a
3805 /// StmtExpr will be copied.
3806 class StmtExpr : public Expr {
3807 Stmt *SubStmt;
3808 SourceLocation LParenLoc, RParenLoc;
3809 public:
3810 // FIXME: Does type-dependence need to be computed differently?
3811 // FIXME: Do we need to compute instantiation instantiation-dependence for
3812 // statements? (ugh!)
3813 StmtExpr(CompoundStmt *substmt, QualType T,
3814 SourceLocation lp, SourceLocation rp) :
3815 Expr(StmtExprClass, T, VK_RValue, OK_Ordinary,
3816 T->isDependentType(), false, false, false),
3817 SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
3818
3819 /// Build an empty statement expression.
3820 explicit StmtExpr(EmptyShell Empty) : Expr(StmtExprClass, Empty) { }
3821
3822 CompoundStmt *getSubStmt() { return cast<CompoundStmt>(SubStmt); }
3823 const CompoundStmt *getSubStmt() const { return cast<CompoundStmt>(SubStmt); }
3824 void setSubStmt(CompoundStmt *S) { SubStmt = S; }
3825
3826 SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
3827 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
3828
3829 SourceLocation getLParenLoc() const { return LParenLoc; }
3830 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
3831 SourceLocation getRParenLoc() const { return RParenLoc; }
3832 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
3833
3834 static bool classof(const Stmt *T) {
3835 return T->getStmtClass() == StmtExprClass;
3836 }
3837
3838 // Iterators
3839 child_range children() { return child_range(&SubStmt, &SubStmt+1); }
3840 const_child_range children() const {
3841 return const_child_range(&SubStmt, &SubStmt + 1);
3842 }
3843 };
3844
3845 /// ShuffleVectorExpr - clang-specific builtin-in function
3846 /// __builtin_shufflevector.
3847 /// This AST node represents a operator that does a constant
3848 /// shuffle, similar to LLVM's shufflevector instruction. It takes
3849 /// two vectors and a variable number of constant indices,
3850 /// and returns the appropriately shuffled vector.
3851 class ShuffleVectorExpr : public Expr {
3852 SourceLocation BuiltinLoc, RParenLoc;
3853
3854 // SubExprs - the list of values passed to the __builtin_shufflevector
3855 // function. The first two are vectors, and the rest are constant
3856 // indices. The number of values in this list is always
3857 // 2+the number of indices in the vector type.
3858 Stmt **SubExprs;
3859 unsigned NumExprs;
3860
3861 public:
3862 ShuffleVectorExpr(const ASTContext &C, ArrayRef<Expr*> args, QualType Type,
3863 SourceLocation BLoc, SourceLocation RP);
3864
3865 /// Build an empty vector-shuffle expression.
3866 explicit ShuffleVectorExpr(EmptyShell Empty)
3867 : Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
3868
3869 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
3870 void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; }
3871
3872 SourceLocation getRParenLoc() const { return RParenLoc; }
3873 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
3874
3875 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
3876 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
3877
3878 static bool classof(const Stmt *T) {
3879 return T->getStmtClass() == ShuffleVectorExprClass;
3880 }
3881
3882 /// getNumSubExprs - Return the size of the SubExprs array. This includes the
3883 /// constant expression, the actual arguments passed in, and the function
3884 /// pointers.
3885 unsigned getNumSubExprs() const { return NumExprs; }
3886
3887 /// Retrieve the array of expressions.
3888 Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); }
3889
3890 /// getExpr - Return the Expr at the specified index.
3891 Expr *getExpr(unsigned Index) {
3892 assert((Index < NumExprs) && "Arg access out of range!");
3893 return cast<Expr>(SubExprs[Index]);
3894 }
3895 const Expr *getExpr(unsigned Index) const {
3896 assert((Index < NumExprs) && "Arg access out of range!");
3897 return cast<Expr>(SubExprs[Index]);
3898 }
3899
3900 void setExprs(const ASTContext &C, ArrayRef<Expr *> Exprs);
3901
3902 llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const {
3903 assert((N < NumExprs - 2) && "Shuffle idx out of range!");
3904 return getExpr(N+2)->EvaluateKnownConstInt(Ctx);
3905 }
3906
3907 // Iterators
3908 child_range children() {
3909 return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
3910 }
3911 const_child_range children() const {
3912 return const_child_range(&SubExprs[0], &SubExprs[0] + NumExprs);
3913 }
3914 };
3915
3916 /// ConvertVectorExpr - Clang builtin function __builtin_convertvector
3917 /// This AST node provides support for converting a vector type to another
3918 /// vector type of the same arity.
3919 class ConvertVectorExpr : public Expr {
3920 private:
3921 Stmt *SrcExpr;
3922 TypeSourceInfo *TInfo;
3923 SourceLocation BuiltinLoc, RParenLoc;
3924
3925 friend class ASTReader;
3926 friend class ASTStmtReader;
3927 explicit ConvertVectorExpr(EmptyShell Empty) : Expr(ConvertVectorExprClass, Empty) {}
3928
3929 public:
3930 ConvertVectorExpr(Expr* SrcExpr, TypeSourceInfo *TI, QualType DstType,
3931 ExprValueKind VK, ExprObjectKind OK,
3932 SourceLocation BuiltinLoc, SourceLocation RParenLoc)
3933 : Expr(ConvertVectorExprClass, DstType, VK, OK,
3934 DstType->isDependentType(),
3935 DstType->isDependentType() || SrcExpr->isValueDependent(),
3936 (DstType->isInstantiationDependentType() ||
3937 SrcExpr->isInstantiationDependent()),
3938 (DstType->containsUnexpandedParameterPack() ||
3939 SrcExpr->containsUnexpandedParameterPack())),
3940 SrcExpr(SrcExpr), TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
3941
3942 /// getSrcExpr - Return the Expr to be converted.
3943 Expr *getSrcExpr() const { return cast<Expr>(SrcExpr); }
3944
3945 /// getTypeSourceInfo - Return the destination type.
3946 TypeSourceInfo *getTypeSourceInfo() const {
3947 return TInfo;
3948 }
3949 void setTypeSourceInfo(TypeSourceInfo *ti) {
3950 TInfo = ti;
3951 }
3952
3953 /// getBuiltinLoc - Return the location of the __builtin_convertvector token.
3954 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
3955
3956 /// getRParenLoc - Return the location of final right parenthesis.
3957 SourceLocation getRParenLoc() const { return RParenLoc; }
3958
3959 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
3960 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
3961
3962 static bool classof(const Stmt *T) {
3963 return T->getStmtClass() == ConvertVectorExprClass;
3964 }
3965
3966 // Iterators
3967 child_range children() { return child_range(&SrcExpr, &SrcExpr+1); }
3968 const_child_range children() const {
3969 return const_child_range(&SrcExpr, &SrcExpr + 1);
3970 }
3971 };
3972
3973 /// ChooseExpr - GNU builtin-in function __builtin_choose_expr.
3974 /// This AST node is similar to the conditional operator (?:) in C, with
3975 /// the following exceptions:
3976 /// - the test expression must be a integer constant expression.
3977 /// - the expression returned acts like the chosen subexpression in every
3978 /// visible way: the type is the same as that of the chosen subexpression,
3979 /// and all predicates (whether it's an l-value, whether it's an integer
3980 /// constant expression, etc.) return the same result as for the chosen
3981 /// sub-expression.
3982 class ChooseExpr : public Expr {
3983 enum { COND, LHS, RHS, END_EXPR };
3984 Stmt* SubExprs[END_EXPR]; // Left/Middle/Right hand sides.
3985 SourceLocation BuiltinLoc, RParenLoc;
3986 bool CondIsTrue;
3987 public:
3988 ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs,
3989 QualType t, ExprValueKind VK, ExprObjectKind OK,
3990 SourceLocation RP, bool condIsTrue,
3991 bool TypeDependent, bool ValueDependent)
3992 : Expr(ChooseExprClass, t, VK, OK, TypeDependent, ValueDependent,
3993 (cond->isInstantiationDependent() ||
3994 lhs->isInstantiationDependent() ||
3995 rhs->isInstantiationDependent()),
3996 (cond->containsUnexpandedParameterPack() ||
3997 lhs->containsUnexpandedParameterPack() ||
3998 rhs->containsUnexpandedParameterPack())),
3999 BuiltinLoc(BLoc), RParenLoc(RP), CondIsTrue(condIsTrue) {
4000 SubExprs[COND] = cond;
4001 SubExprs[LHS] = lhs;
4002 SubExprs[RHS] = rhs;
4003 }
4004
4005 /// Build an empty __builtin_choose_expr.
4006 explicit ChooseExpr(EmptyShell Empty) : Expr(ChooseExprClass, Empty) { }
4007
4008 /// isConditionTrue - Return whether the condition is true (i.e. not
4009 /// equal to zero).
4010 bool isConditionTrue() const {
4011 assert(!isConditionDependent() &&
4012 "Dependent condition isn't true or false");
4013 return CondIsTrue;
4014 }
4015 void setIsConditionTrue(bool isTrue) { CondIsTrue = isTrue; }
4016
4017 bool isConditionDependent() const {
4018 return getCond()->isTypeDependent() || getCond()->isValueDependent();
4019 }
4020
4021 /// getChosenSubExpr - Return the subexpression chosen according to the
4022 /// condition.
4023 Expr *getChosenSubExpr() const {
4024 return isConditionTrue() ? getLHS() : getRHS();
4025 }
4026
4027 Expr *getCond() const { return cast<Expr>(SubExprs[COND]); }
4028 void setCond(Expr *E) { SubExprs[COND] = E; }
4029 Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); }
4030 void setLHS(Expr *E) { SubExprs[LHS] = E; }
4031 Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
4032 void setRHS(Expr *E) { SubExprs[RHS] = E; }
4033
4034 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
4035 void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; }
4036
4037 SourceLocation getRParenLoc() const { return RParenLoc; }
4038 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
4039
4040 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
4041 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
4042
4043 static bool classof(const Stmt *T) {
4044 return T->getStmtClass() == ChooseExprClass;
4045 }
4046
4047 // Iterators
4048 child_range children() {
4049 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
4050 }
4051 const_child_range children() const {
4052 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
4053 }
4054 };
4055
4056 /// GNUNullExpr - Implements the GNU __null extension, which is a name
4057 /// for a null pointer constant that has integral type (e.g., int or
4058 /// long) and is the same size and alignment as a pointer. The __null
4059 /// extension is typically only used by system headers, which define
4060 /// NULL as __null in C++ rather than using 0 (which is an integer
4061 /// that may not match the size of a pointer).
4062 class GNUNullExpr : public Expr {
4063 /// TokenLoc - The location of the __null keyword.
4064 SourceLocation TokenLoc;
4065
4066 public:
4067 GNUNullExpr(QualType Ty, SourceLocation Loc)
4068 : Expr(GNUNullExprClass, Ty, VK_RValue, OK_Ordinary, false, false, false,
4069 false),
4070 TokenLoc(Loc) { }
4071
4072 /// Build an empty GNU __null expression.
4073 explicit GNUNullExpr(EmptyShell Empty) : Expr(GNUNullExprClass, Empty) { }
4074
4075 /// getTokenLocation - The location of the __null token.
4076 SourceLocation getTokenLocation() const { return TokenLoc; }
4077 void setTokenLocation(SourceLocation L) { TokenLoc = L; }
4078
4079 SourceLocation getBeginLoc() const LLVM_READONLY { return TokenLoc; }
4080 SourceLocation getEndLoc() const LLVM_READONLY { return TokenLoc; }
4081
4082 static bool classof(const Stmt *T) {
4083 return T->getStmtClass() == GNUNullExprClass;
4084 }
4085
4086 // Iterators
4087 child_range children() {
4088 return child_range(child_iterator(), child_iterator());
4089 }
4090 const_child_range children() const {
4091 return const_child_range(const_child_iterator(), const_child_iterator());
4092 }
4093 };
4094
4095 /// Represents a call to the builtin function \c __builtin_va_arg.
4096 class VAArgExpr : public Expr {
4097 Stmt *Val;
4098 llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfo;
4099 SourceLocation BuiltinLoc, RParenLoc;
4100 public:
4101 VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo,
4102 SourceLocation RPLoc, QualType t, bool IsMS)
4103 : Expr(VAArgExprClass, t, VK_RValue, OK_Ordinary, t->isDependentType(),
4104 false, (TInfo->getType()->isInstantiationDependentType() ||
4105 e->isInstantiationDependent()),
4106 (TInfo->getType()->containsUnexpandedParameterPack() ||
4107 e->containsUnexpandedParameterPack())),
4108 Val(e), TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) {}
4109
4110 /// Create an empty __builtin_va_arg expression.
4111 explicit VAArgExpr(EmptyShell Empty)
4112 : Expr(VAArgExprClass, Empty), Val(nullptr), TInfo(nullptr, false) {}
4113
4114 const Expr *getSubExpr() const { return cast<Expr>(Val); }
4115 Expr *getSubExpr() { return cast<Expr>(Val); }
4116 void setSubExpr(Expr *E) { Val = E; }
4117
4118 /// Returns whether this is really a Win64 ABI va_arg expression.
4119 bool isMicrosoftABI() const { return TInfo.getInt(); }
4120 void setIsMicrosoftABI(bool IsMS) { TInfo.setInt(IsMS); }
4121
4122 TypeSourceInfo *getWrittenTypeInfo() const { return TInfo.getPointer(); }
4123 void setWrittenTypeInfo(TypeSourceInfo *TI) { TInfo.setPointer(TI); }
4124
4125 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
4126 void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; }
4127
4128 SourceLocation getRParenLoc() const { return RParenLoc; }
4129 void setRParenLoc(SourceLocation L) { RParenLoc = L; }
4130
4131 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
4132 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
4133
4134 static bool classof(const Stmt *T) {
4135 return T->getStmtClass() == VAArgExprClass;
4136 }
4137
4138 // Iterators
4139 child_range children() { return child_range(&Val, &Val+1); }
4140 const_child_range children() const {
4141 return const_child_range(&Val, &Val + 1);
4142 }
4143 };
4144
4145 /// Describes an C or C++ initializer list.
4146 ///
4147 /// InitListExpr describes an initializer list, which can be used to
4148 /// initialize objects of different types, including
4149 /// struct/class/union types, arrays, and vectors. For example:
4150 ///
4151 /// @code
4152 /// struct foo x = { 1, { 2, 3 } };
4153 /// @endcode
4154 ///
4155 /// Prior to semantic analysis, an initializer list will represent the
4156 /// initializer list as written by the user, but will have the
4157 /// placeholder type "void". This initializer list is called the
4158 /// syntactic form of the initializer, and may contain C99 designated
4159 /// initializers (represented as DesignatedInitExprs), initializations
4160 /// of subobject members without explicit braces, and so on. Clients
4161 /// interested in the original syntax of the initializer list should
4162 /// use the syntactic form of the initializer list.
4163 ///
4164 /// After semantic analysis, the initializer list will represent the
4165 /// semantic form of the initializer, where the initializations of all
4166 /// subobjects are made explicit with nested InitListExpr nodes and
4167 /// C99 designators have been eliminated by placing the designated
4168 /// initializations into the subobject they initialize. Additionally,
4169 /// any "holes" in the initialization, where no initializer has been
4170 /// specified for a particular subobject, will be replaced with
4171 /// implicitly-generated ImplicitValueInitExpr expressions that
4172 /// value-initialize the subobjects. Note, however, that the
4173 /// initializer lists may still have fewer initializers than there are
4174 /// elements to initialize within the object.
4175 ///
4176 /// After semantic analysis has completed, given an initializer list,
4177 /// method isSemanticForm() returns true if and only if this is the
4178 /// semantic form of the initializer list (note: the same AST node
4179 /// may at the same time be the syntactic form).
4180 /// Given the semantic form of the initializer list, one can retrieve
4181 /// the syntactic form of that initializer list (when different)
4182 /// using method getSyntacticForm(); the method returns null if applied
4183 /// to a initializer list which is already in syntactic form.
4184 /// Similarly, given the syntactic form (i.e., an initializer list such
4185 /// that isSemanticForm() returns false), one can retrieve the semantic
4186 /// form using method getSemanticForm().
4187 /// Since many initializer lists have the same syntactic and semantic forms,
4188 /// getSyntacticForm() may return NULL, indicating that the current
4189 /// semantic initializer list also serves as its syntactic form.
4190 class InitListExpr : public Expr {
4191 // FIXME: Eliminate this vector in favor of ASTContext allocation
4192 typedef ASTVector<Stmt *> InitExprsTy;
4193 InitExprsTy InitExprs;
4194 SourceLocation LBraceLoc, RBraceLoc;
4195
4196 /// The alternative form of the initializer list (if it exists).
4197 /// The int part of the pair stores whether this initializer list is
4198 /// in semantic form. If not null, the pointer points to:
4199 /// - the syntactic form, if this is in semantic form;
4200 /// - the semantic form, if this is in syntactic form.
4201 llvm::PointerIntPair<InitListExpr *, 1, bool> AltForm;
4202
4203 /// Either:
4204 /// If this initializer list initializes an array with more elements than
4205 /// there are initializers in the list, specifies an expression to be used
4206 /// for value initialization of the rest of the elements.
4207 /// Or
4208 /// If this initializer list initializes a union, specifies which
4209 /// field within the union will be initialized.
4210 llvm::PointerUnion<Expr *, FieldDecl *> ArrayFillerOrUnionFieldInit;
4211
4212 public:
4213 InitListExpr(const ASTContext &C, SourceLocation lbraceloc,
4214 ArrayRef<Expr*> initExprs, SourceLocation rbraceloc);
4215
4216 /// Build an empty initializer list.
4217 explicit InitListExpr(EmptyShell Empty)
4218 : Expr(InitListExprClass, Empty), AltForm(nullptr, true) { }
4219
4220 unsigned getNumInits() const { return InitExprs.size(); }
4221
4222 /// Retrieve the set of initializers.
4223 Expr **getInits() { return reinterpret_cast<Expr **>(InitExprs.data()); }
4224
4225 /// Retrieve the set of initializers.
4226 Expr * const *getInits() const {
4227 return reinterpret_cast<Expr * const *>(InitExprs.data());
4228 }
4229
4230 ArrayRef<Expr *> inits() {
4231 return llvm::makeArrayRef(getInits(), getNumInits());
4232 }
4233
4234 ArrayRef<Expr *> inits() const {
4235 return llvm::makeArrayRef(getInits(), getNumInits());
4236 }
4237
4238 const Expr *getInit(unsigned Init) const {
4239 assert(Init < getNumInits() && "Initializer access out of range!");
4240 return cast_or_null<Expr>(InitExprs[Init]);
4241 }
4242
4243 Expr *getInit(unsigned Init) {
4244 assert(Init < getNumInits() && "Initializer access out of range!");
4245 return cast_or_null<Expr>(InitExprs[Init]);
4246 }
4247
4248 void setInit(unsigned Init, Expr *expr) {
4249 assert(Init < getNumInits() && "Initializer access out of range!");
4250 InitExprs[Init] = expr;
4251
4252 if (expr) {
4253 ExprBits.TypeDependent |= expr->isTypeDependent();
4254 ExprBits.ValueDependent |= expr->isValueDependent();
4255 ExprBits.InstantiationDependent |= expr->isInstantiationDependent();
4256 ExprBits.ContainsUnexpandedParameterPack |=
4257 expr->containsUnexpandedParameterPack();
4258 }
4259 }
4260
4261 /// Reserve space for some number of initializers.
4262 void reserveInits(const ASTContext &C, unsigned NumInits);
4263
4264 /// Specify the number of initializers
4265 ///
4266 /// If there are more than @p NumInits initializers, the remaining
4267 /// initializers will be destroyed. If there are fewer than @p
4268 /// NumInits initializers, NULL expressions will be added for the
4269 /// unknown initializers.
4270 void resizeInits(const ASTContext &Context, unsigned NumInits);
4271
4272 /// Updates the initializer at index @p Init with the new
4273 /// expression @p expr, and returns the old expression at that
4274 /// location.
4275 ///
4276 /// When @p Init is out of range for this initializer list, the
4277 /// initializer list will be extended with NULL expressions to
4278 /// accommodate the new entry.
4279 Expr *updateInit(const ASTContext &C, unsigned Init, Expr *expr);
4280
4281 /// If this initializer list initializes an array with more elements
4282 /// than there are initializers in the list, specifies an expression to be
4283 /// used for value initialization of the rest of the elements.
4284 Expr *getArrayFiller() {
4285 return ArrayFillerOrUnionFieldInit.dyn_cast<Expr *>();
4286 }
4287 const Expr *getArrayFiller() const {
4288 return const_cast<InitListExpr *>(this)->getArrayFiller();
4289 }
4290 void setArrayFiller(Expr *filler);
4291
4292 /// Return true if this is an array initializer and its array "filler"
4293 /// has been set.
4294 bool hasArrayFiller() const { return getArrayFiller(); }
4295
4296 /// If this initializes a union, specifies which field in the
4297 /// union to initialize.
4298 ///
4299 /// Typically, this field is the first named field within the
4300 /// union. However, a designated initializer can specify the
4301 /// initialization of a different field within the union.
4302 FieldDecl *getInitializedFieldInUnion() {
4303 return ArrayFillerOrUnionFieldInit.dyn_cast<FieldDecl *>();
4304 }
4305 const FieldDecl *getInitializedFieldInUnion() const {
4306 return const_cast<InitListExpr *>(this)->getInitializedFieldInUnion();
4307 }
4308 void setInitializedFieldInUnion(FieldDecl *FD) {
4309 assert((FD == nullptr
4310 || getInitializedFieldInUnion() == nullptr
4311 || getInitializedFieldInUnion() == FD)
4312 && "Only one field of a union may be initialized at a time!");
4313 ArrayFillerOrUnionFieldInit = FD;
4314 }
4315
4316 // Explicit InitListExpr's originate from source code (and have valid source
4317 // locations). Implicit InitListExpr's are created by the semantic analyzer.
4318 bool isExplicit() const {
4319 return LBraceLoc.isValid() && RBraceLoc.isValid();
4320 }
4321
4322 // Is this an initializer for an array of characters, initialized by a string
4323 // literal or an @encode?
4324 bool isStringLiteralInit() const;
4325
4326 /// Is this a transparent initializer list (that is, an InitListExpr that is
4327 /// purely syntactic, and whose semantics are that of the sole contained
4328 /// initializer)?
4329 bool isTransparent() const;
4330
4331 /// Is this the zero initializer {0} in a language which considers it
4332 /// idiomatic?
4333 bool isIdiomaticZeroInitializer(const LangOptions &LangOpts) const;
4334
4335 SourceLocation getLBraceLoc() const { return LBraceLoc; }
4336 void setLBraceLoc(SourceLocation Loc) { LBraceLoc = Loc; }
4337 SourceLocation getRBraceLoc() const { return RBraceLoc; }
4338 void setRBraceLoc(SourceLocation Loc) { RBraceLoc = Loc; }
4339
4340 bool isSemanticForm() const { return AltForm.getInt(); }
4341 InitListExpr *getSemanticForm() const {
4342 return isSemanticForm() ? nullptr : AltForm.getPointer();
4343 }
4344 bool isSyntacticForm() const {
4345 return !AltForm.getInt() || !AltForm.getPointer();
4346 }
4347 InitListExpr *getSyntacticForm() const {
4348 return isSemanticForm() ? AltForm.getPointer() : nullptr;
4349 }
4350
4351 void setSyntacticForm(InitListExpr *Init) {
4352 AltForm.setPointer(Init);
4353 AltForm.setInt(true);
4354 Init->AltForm.setPointer(this);
4355 Init->AltForm.setInt(false);
4356 }
4357
4358 bool hadArrayRangeDesignator() const {
4359 return InitListExprBits.HadArrayRangeDesignator != 0;
4360 }
4361 void sawArrayRangeDesignator(bool ARD = true) {
4362 InitListExprBits.HadArrayRangeDesignator = ARD;
4363 }
4364
4365 SourceLocation getBeginLoc() const LLVM_READONLY;
4366 SourceLocation getEndLoc() const LLVM_READONLY;
4367
4368 static bool classof(const Stmt *T) {
4369 return T->getStmtClass() == InitListExprClass;
4370 }
4371
4372 // Iterators
4373 child_range children() {
4374 const_child_range CCR = const_cast<const InitListExpr *>(this)->children();
4375 return child_range(cast_away_const(CCR.begin()),
4376 cast_away_const(CCR.end()));
4377 }
4378
4379 const_child_range children() const {
4380 // FIXME: This does not include the array filler expression.
4381 if (InitExprs.empty())
4382 return const_child_range(const_child_iterator(), const_child_iterator());
4383 return const_child_range(&InitExprs[0], &InitExprs[0] + InitExprs.size());
4384 }
4385
4386 typedef InitExprsTy::iterator iterator;
4387 typedef InitExprsTy::const_iterator const_iterator;
4388 typedef InitExprsTy::reverse_iterator reverse_iterator;
4389 typedef InitExprsTy::const_reverse_iterator const_reverse_iterator;
4390
4391 iterator begin() { return InitExprs.begin(); }
4392 const_iterator begin() const { return InitExprs.begin(); }
4393 iterator end() { return InitExprs.end(); }
4394 const_iterator end() const { return InitExprs.end(); }
4395 reverse_iterator rbegin() { return InitExprs.rbegin(); }
4396 const_reverse_iterator rbegin() const { return InitExprs.rbegin(); }
4397 reverse_iterator rend() { return InitExprs.rend(); }
4398 const_reverse_iterator rend() const { return InitExprs.rend(); }
4399
4400 friend class ASTStmtReader;
4401 friend class ASTStmtWriter;
4402 };
4403
4404 /// Represents a C99 designated initializer expression.
4405 ///
4406 /// A designated initializer expression (C99 6.7.8) contains one or
4407 /// more designators (which can be field designators, array
4408 /// designators, or GNU array-range designators) followed by an
4409 /// expression that initializes the field or element(s) that the
4410 /// designators refer to. For example, given:
4411 ///
4412 /// @code
4413 /// struct point {
4414 /// double x;
4415 /// double y;
4416 /// };
4417 /// struct point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
4418 /// @endcode
4419 ///
4420 /// The InitListExpr contains three DesignatedInitExprs, the first of
4421 /// which covers @c [2].y=1.0. This DesignatedInitExpr will have two
4422 /// designators, one array designator for @c [2] followed by one field
4423 /// designator for @c .y. The initialization expression will be 1.0.
4424 class DesignatedInitExpr final
4425 : public Expr,
4426 private llvm::TrailingObjects<DesignatedInitExpr, Stmt *> {
4427 public:
4428 /// Forward declaration of the Designator class.
4429 class Designator;
4430
4431 private:
4432 /// The location of the '=' or ':' prior to the actual initializer
4433 /// expression.
4434 SourceLocation EqualOrColonLoc;
4435
4436 /// Whether this designated initializer used the GNU deprecated
4437 /// syntax rather than the C99 '=' syntax.
4438 unsigned GNUSyntax : 1;
4439
4440 /// The number of designators in this initializer expression.
4441 unsigned NumDesignators : 15;
4442
4443 /// The number of subexpressions of this initializer expression,
4444 /// which contains both the initializer and any additional
4445 /// expressions used by array and array-range designators.
4446 unsigned NumSubExprs : 16;
4447
4448 /// The designators in this designated initialization
4449 /// expression.
4450 Designator *Designators;
4451
4452 DesignatedInitExpr(const ASTContext &C, QualType Ty,
4453 llvm::ArrayRef<Designator> Designators,
4454 SourceLocation EqualOrColonLoc, bool GNUSyntax,
4455 ArrayRef<Expr *> IndexExprs, Expr *Init);
4456
4457 explicit DesignatedInitExpr(unsigned NumSubExprs)
4458 : Expr(DesignatedInitExprClass, EmptyShell()),
4459 NumDesignators(0), NumSubExprs(NumSubExprs), Designators(nullptr) { }
4460
4461 public:
4462 /// A field designator, e.g., ".x".
4463 struct FieldDesignator {
4464 /// Refers to the field that is being initialized. The low bit
4465 /// of this field determines whether this is actually a pointer
4466 /// to an IdentifierInfo (if 1) or a FieldDecl (if 0). When
4467 /// initially constructed, a field designator will store an
4468 /// IdentifierInfo*. After semantic analysis has resolved that
4469 /// name, the field designator will instead store a FieldDecl*.
4470 uintptr_t NameOrField;
4471
4472 /// The location of the '.' in the designated initializer.
4473 unsigned DotLoc;
4474
4475 /// The location of the field name in the designated initializer.
4476 unsigned FieldLoc;
4477 };
4478
4479 /// An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
4480 struct ArrayOrRangeDesignator {
4481 /// Location of the first index expression within the designated
4482 /// initializer expression's list of subexpressions.
4483 unsigned Index;
4484 /// The location of the '[' starting the array range designator.
4485 unsigned LBracketLoc;
4486 /// The location of the ellipsis separating the start and end
4487 /// indices. Only valid for GNU array-range designators.
4488 unsigned EllipsisLoc;
4489 /// The location of the ']' terminating the array range designator.
4490 unsigned RBracketLoc;
4491 };
4492
4493 /// Represents a single C99 designator.
4494 ///
4495 /// @todo This class is infuriatingly similar to clang::Designator,
4496 /// but minor differences (storing indices vs. storing pointers)
4497 /// keep us from reusing it. Try harder, later, to rectify these
4498 /// differences.
4499 class Designator {
4500 /// The kind of designator this describes.
4501 enum {
4502 FieldDesignator,
4503 ArrayDesignator,
4504 ArrayRangeDesignator
4505 } Kind;
4506
4507 union {
4508 /// A field designator, e.g., ".x".
4509 struct FieldDesignator Field;
4510 /// An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
4511 struct ArrayOrRangeDesignator ArrayOrRange;
4512 };
4513 friend class DesignatedInitExpr;
4514
4515 public:
4516 Designator() {}
4517
4518 /// Initializes a field designator.
4519 Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc,
4520 SourceLocation FieldLoc)
4521 : Kind(FieldDesignator) {
4522 Field.NameOrField = reinterpret_cast<uintptr_t>(FieldName) | 0x01;
4523 Field.DotLoc = DotLoc.getRawEncoding();
4524 Field.FieldLoc = FieldLoc.getRawEncoding();
4525 }
4526
4527 /// Initializes an array designator.
4528 Designator(unsigned Index, SourceLocation LBracketLoc,
4529 SourceLocation RBracketLoc)
4530 : Kind(ArrayDesignator) {
4531 ArrayOrRange.Index = Index;
4532 ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding();
4533 ArrayOrRange.EllipsisLoc = SourceLocation().getRawEncoding();
4534 ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding();
4535 }
4536
4537 /// Initializes a GNU array-range designator.
4538 Designator(unsigned Index, SourceLocation LBracketLoc,
4539 SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
4540 : Kind(ArrayRangeDesignator) {
4541 ArrayOrRange.Index = Index;
4542 ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding();
4543 ArrayOrRange.EllipsisLoc = EllipsisLoc.getRawEncoding();
4544 ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding();
4545 }
4546
4547 bool isFieldDesignator() const { return Kind == FieldDesignator; }
4548 bool isArrayDesignator() const { return Kind == ArrayDesignator; }
4549 bool isArrayRangeDesignator() const { return Kind == ArrayRangeDesignator; }
4550
4551 IdentifierInfo *getFieldName() const;
4552
4553 FieldDecl *getField() const {
4554 assert(Kind == FieldDesignator && "Only valid on a field designator");
4555 if (Field.NameOrField & 0x01)
4556 return nullptr;
4557 else
4558 return reinterpret_cast<FieldDecl *>(Field.NameOrField);
4559 }
4560
4561 void setField(FieldDecl *FD) {
4562 assert(Kind == FieldDesignator && "Only valid on a field designator");
4563 Field.NameOrField = reinterpret_cast<uintptr_t>(FD);
4564 }
4565
4566 SourceLocation getDotLoc() const {
4567 assert(Kind == FieldDesignator && "Only valid on a field designator");
4568 return SourceLocation::getFromRawEncoding(Field.DotLoc);
4569 }
4570
4571 SourceLocation getFieldLoc() const {
4572 assert(Kind == FieldDesignator && "Only valid on a field designator");
4573 return SourceLocation::getFromRawEncoding(Field.FieldLoc);
4574 }
4575
4576 SourceLocation getLBracketLoc() const {
4577 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4578 "Only valid on an array or array-range designator");
4579 return SourceLocation::getFromRawEncoding(ArrayOrRange.LBracketLoc);
4580 }
4581
4582 SourceLocation getRBracketLoc() const {
4583 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4584 "Only valid on an array or array-range designator");
4585 return SourceLocation::getFromRawEncoding(ArrayOrRange.RBracketLoc);
4586 }
4587
4588 SourceLocation getEllipsisLoc() const {
4589 assert(Kind == ArrayRangeDesignator &&
4590 "Only valid on an array-range designator");
4591 return SourceLocation::getFromRawEncoding(ArrayOrRange.EllipsisLoc);
4592 }
4593
4594 unsigned getFirstExprIndex() const {
4595 assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
4596 "Only valid on an array or array-range designator");
4597 return ArrayOrRange.Index;
4598 }
4599
4600 SourceLocation getBeginLoc() const LLVM_READONLY {
4601 if (Kind == FieldDesignator)
4602 return getDotLoc().isInvalid()? getFieldLoc() : getDotLoc();
4603 else
4604 return getLBracketLoc();
4605 }
4606 SourceLocation getEndLoc() const LLVM_READONLY {
4607 return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc();
4608 }
4609 SourceRange getSourceRange() const LLVM_READONLY {
4610 return SourceRange(getBeginLoc(), getEndLoc());
4611 }
4612 };
4613
4614 static DesignatedInitExpr *Create(const ASTContext &C,
4615 llvm::ArrayRef<Designator> Designators,
4616 ArrayRef<Expr*> IndexExprs,
4617 SourceLocation EqualOrColonLoc,
4618 bool GNUSyntax, Expr *Init);
4619
4620 static DesignatedInitExpr *CreateEmpty(const ASTContext &C,
4621 unsigned NumIndexExprs);
4622
4623 /// Returns the number of designators in this initializer.
4624 unsigned size() const { return NumDesignators; }
4625
4626 // Iterator access to the designators.
4627 llvm::MutableArrayRef<Designator> designators() {
4628 return {Designators, NumDesignators};
4629 }
4630
4631 llvm::ArrayRef<Designator> designators() const {
4632 return {Designators, NumDesignators};
4633 }
4634
4635 Designator *getDesignator(unsigned Idx) { return &designators()[Idx]; }
4636 const Designator *getDesignator(unsigned Idx) const {
4637 return &designators()[Idx];
4638 }
4639
4640 void setDesignators(const ASTContext &C, const Designator *Desigs,
4641 unsigned NumDesigs);
4642
4643 Expr *getArrayIndex(const Designator &D) const;
4644 Expr *getArrayRangeStart(const Designator &D) const;
4645 Expr *getArrayRangeEnd(const Designator &D) const;
4646
4647 /// Retrieve the location of the '=' that precedes the
4648 /// initializer value itself, if present.
4649 SourceLocation getEqualOrColonLoc() const { return EqualOrColonLoc; }
4650 void setEqualOrColonLoc(SourceLocation L) { EqualOrColonLoc = L; }
4651
4652 /// Determines whether this designated initializer used the
4653 /// deprecated GNU syntax for designated initializers.
4654 bool usesGNUSyntax() const { return GNUSyntax; }
4655 void setGNUSyntax(bool GNU) { GNUSyntax = GNU; }
4656
4657 /// Retrieve the initializer value.
4658 Expr *getInit() const {
4659 return cast<Expr>(*const_cast<DesignatedInitExpr*>(this)->child_begin());
4660 }
4661
4662 void setInit(Expr *init) {
4663 *child_begin() = init;
4664 }
4665
4666 /// Retrieve the total number of subexpressions in this
4667 /// designated initializer expression, including the actual
4668 /// initialized value and any expressions that occur within array
4669 /// and array-range designators.
4670 unsigned getNumSubExprs() const { return NumSubExprs; }
4671
4672 Expr *getSubExpr(unsigned Idx) const {
4673 assert(Idx < NumSubExprs && "Subscript out of range");
4674 return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
4675 }
4676
4677 void setSubExpr(unsigned Idx, Expr *E) {
4678 assert(Idx < NumSubExprs && "Subscript out of range");
4679 getTrailingObjects<Stmt *>()[Idx] = E;
4680 }
4681
4682 /// Replaces the designator at index @p Idx with the series
4683 /// of designators in [First, Last).
4684 void ExpandDesignator(const ASTContext &C, unsigned Idx,
4685 const Designator *First, const Designator *Last);
4686
4687 SourceRange getDesignatorsSourceRange() const;
4688
4689 SourceLocation getBeginLoc() const LLVM_READONLY;
4690 SourceLocation getEndLoc() const LLVM_READONLY;
4691
4692 static bool classof(const Stmt *T) {
4693 return T->getStmtClass() == DesignatedInitExprClass;
4694 }
4695
4696 // Iterators
4697 child_range children() {
4698 Stmt **begin = getTrailingObjects<Stmt *>();
4699 return child_range(begin, begin + NumSubExprs);
4700 }
4701 const_child_range children() const {
4702 Stmt * const *begin = getTrailingObjects<Stmt *>();
4703 return const_child_range(begin, begin + NumSubExprs);
4704 }
4705
4706 friend TrailingObjects;
4707 };
4708
4709 /// Represents a place-holder for an object not to be initialized by
4710 /// anything.
4711 ///
4712 /// This only makes sense when it appears as part of an updater of a
4713 /// DesignatedInitUpdateExpr (see below). The base expression of a DIUE
4714 /// initializes a big object, and the NoInitExpr's mark the spots within the
4715 /// big object not to be overwritten by the updater.
4716 ///
4717 /// \see DesignatedInitUpdateExpr
4718 class NoInitExpr : public Expr {
4719 public:
4720 explicit NoInitExpr(QualType ty)
4721 : Expr(NoInitExprClass, ty, VK_RValue, OK_Ordinary,
4722 false, false, ty->isInstantiationDependentType(), false) { }
4723
4724 explicit NoInitExpr(EmptyShell Empty)
4725 : Expr(NoInitExprClass, Empty) { }
4726
4727 static bool classof(const Stmt *T) {
4728 return T->getStmtClass() == NoInitExprClass;
4729 }
4730
4731 SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
4732 SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
4733
4734 // Iterators
4735 child_range children() {
4736 return child_range(child_iterator(), child_iterator());
4737 }
4738 const_child_range children() const {
4739 return const_child_range(const_child_iterator(), const_child_iterator());
4740 }
4741 };
4742
4743 // In cases like:
4744 // struct Q { int a, b, c; };
4745 // Q *getQ();
4746 // void foo() {
4747 // struct A { Q q; } a = { *getQ(), .q.b = 3 };
4748 // }
4749 //
4750 // We will have an InitListExpr for a, with type A, and then a
4751 // DesignatedInitUpdateExpr for "a.q" with type Q. The "base" for this DIUE
4752 // is the call expression *getQ(); the "updater" for the DIUE is ".q.b = 3"
4753 //
4754 class DesignatedInitUpdateExpr : public Expr {
4755 // BaseAndUpdaterExprs[0] is the base expression;
4756 // BaseAndUpdaterExprs[1] is an InitListExpr overwriting part of the base.
4757 Stmt *BaseAndUpdaterExprs[2];
4758
4759 public:
4760 DesignatedInitUpdateExpr(const ASTContext &C, SourceLocation lBraceLoc,
4761 Expr *baseExprs, SourceLocation rBraceLoc);
4762
4763 explicit DesignatedInitUpdateExpr(EmptyShell Empty)
4764 : Expr(DesignatedInitUpdateExprClass, Empty) { }
4765
4766 SourceLocation getBeginLoc() const LLVM_READONLY;
4767 SourceLocation getEndLoc() const LLVM_READONLY;
4768
4769 static bool classof(const Stmt *T) {
4770 return T->getStmtClass() == DesignatedInitUpdateExprClass;
4771 }
4772
4773 Expr *getBase() const { return cast<Expr>(BaseAndUpdaterExprs[0]); }
4774 void setBase(Expr *Base) { BaseAndUpdaterExprs[0] = Base; }
4775
4776 InitListExpr *getUpdater() const {
4777 return cast<InitListExpr>(BaseAndUpdaterExprs[1]);
4778 }
4779 void setUpdater(Expr *Updater) { BaseAndUpdaterExprs[1] = Updater; }
4780
4781 // Iterators
4782 // children = the base and the updater
4783 child_range children() {
4784 return child_range(&BaseAndUpdaterExprs[0], &BaseAndUpdaterExprs[0] + 2);
4785 }
4786 const_child_range children() const {
4787 return const_child_range(&BaseAndUpdaterExprs[0],
4788 &BaseAndUpdaterExprs[0] + 2);
4789 }
4790 };
4791
4792 /// Represents a loop initializing the elements of an array.
4793 ///
4794 /// The need to initialize the elements of an array occurs in a number of
4795 /// contexts:
4796 ///
4797 /// * in the implicit copy/move constructor for a class with an array member
4798 /// * when a lambda-expression captures an array by value
4799 /// * when a decomposition declaration decomposes an array
4800 ///
4801 /// There are two subexpressions: a common expression (the source array)
4802 /// that is evaluated once up-front, and a per-element initializer that
4803 /// runs once for each array element.
4804 ///
4805 /// Within the per-element initializer, the common expression may be referenced
4806 /// via an OpaqueValueExpr, and the current index may be obtained via an
4807 /// ArrayInitIndexExpr.
4808 class ArrayInitLoopExpr : public Expr {
4809 Stmt *SubExprs[2];
4810
4811 explicit ArrayInitLoopExpr(EmptyShell Empty)
4812 : Expr(ArrayInitLoopExprClass, Empty), SubExprs{} {}
4813
4814 public:
4815 explicit ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit)
4816 : Expr(ArrayInitLoopExprClass, T, VK_RValue, OK_Ordinary, false,
4817 CommonInit->isValueDependent() || ElementInit->isValueDependent(),
4818 T->isInstantiationDependentType(),
4819 CommonInit->containsUnexpandedParameterPack() ||
4820 ElementInit->containsUnexpandedParameterPack()),
4821 SubExprs{CommonInit, ElementInit} {}
4822
4823 /// Get the common subexpression shared by all initializations (the source
4824 /// array).
4825 OpaqueValueExpr *getCommonExpr() const {
4826 return cast<OpaqueValueExpr>(SubExprs[0]);
4827 }
4828
4829 /// Get the initializer to use for each array element.
4830 Expr *getSubExpr() const { return cast<Expr>(SubExprs[1]); }
4831
4832 llvm::APInt getArraySize() const {
4833 return cast<ConstantArrayType>(getType()->castAsArrayTypeUnsafe())
4834 ->getSize();
4835 }
4836
4837 static bool classof(const Stmt *S) {
4838 return S->getStmtClass() == ArrayInitLoopExprClass;
4839 }
4840
4841 SourceLocation getBeginLoc() const LLVM_READONLY {
4842 return getCommonExpr()->getBeginLoc();
4843 }
4844 SourceLocation getEndLoc() const LLVM_READONLY {
4845 return getCommonExpr()->getEndLoc();
4846 }
4847
4848 child_range children() {
4849 return child_range(SubExprs, SubExprs + 2);
4850 }
4851 const_child_range children() const {
4852 return const_child_range(SubExprs, SubExprs + 2);
4853 }
4854
4855 friend class ASTReader;
4856 friend class ASTStmtReader;
4857 friend class ASTStmtWriter;
4858 };
4859
4860 /// Represents the index of the current element of an array being
4861 /// initialized by an ArrayInitLoopExpr. This can only appear within the
4862 /// subexpression of an ArrayInitLoopExpr.
4863 class ArrayInitIndexExpr : public Expr {
4864 explicit ArrayInitIndexExpr(EmptyShell Empty)
4865 : Expr(ArrayInitIndexExprClass, Empty) {}
4866
4867 public:
4868 explicit ArrayInitIndexExpr(QualType T)
4869 : Expr(ArrayInitIndexExprClass, T, VK_RValue, OK_Ordinary,
4870 false, false, false, false) {}
4871
4872 static bool classof(const Stmt *S) {
4873 return S->getStmtClass() == ArrayInitIndexExprClass;
4874 }
4875
4876 SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
4877 SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
4878
4879 child_range children() {
4880 return child_range(child_iterator(), child_iterator());
4881 }
4882 const_child_range children() const {
4883 return const_child_range(const_child_iterator(), const_child_iterator());
4884 }
4885
4886 friend class ASTReader;
4887 friend class ASTStmtReader;
4888 };
4889
4890 /// Represents an implicitly-generated value initialization of
4891 /// an object of a given type.
4892 ///
4893 /// Implicit value initializations occur within semantic initializer
4894 /// list expressions (InitListExpr) as placeholders for subobject
4895 /// initializations not explicitly specified by the user.
4896 ///
4897 /// \see InitListExpr
4898 class ImplicitValueInitExpr : public Expr {
4899 public:
4900 explicit ImplicitValueInitExpr(QualType ty)
4901 : Expr(ImplicitValueInitExprClass, ty, VK_RValue, OK_Ordinary,
4902 false, false, ty->isInstantiationDependentType(), false) { }
4903
4904 /// Construct an empty implicit value initialization.
4905 explicit ImplicitValueInitExpr(EmptyShell Empty)
4906 : Expr(ImplicitValueInitExprClass, Empty) { }
4907
4908 static bool classof(const Stmt *T) {
4909 return T->getStmtClass() == ImplicitValueInitExprClass;
4910 }
4911
4912 SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
4913 SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
4914
4915 // Iterators
4916 child_range children() {
4917 return child_range(child_iterator(), child_iterator());
4918 }
4919 const_child_range children() const {
4920 return const_child_range(const_child_iterator(), const_child_iterator());
4921 }
4922 };
4923
4924 class ParenListExpr final
4925 : public Expr,
4926 private llvm::TrailingObjects<ParenListExpr, Stmt *> {
4927 friend class ASTStmtReader;
4928 friend TrailingObjects;
4929
4930 /// The location of the left and right parentheses.
4931 SourceLocation LParenLoc, RParenLoc;
4932
4933 /// Build a paren list.
4934 ParenListExpr(SourceLocation LParenLoc, ArrayRef<Expr *> Exprs,
4935 SourceLocation RParenLoc);
4936
4937 /// Build an empty paren list.
4938 ParenListExpr(EmptyShell Empty, unsigned NumExprs);
4939
4940 public:
4941 /// Create a paren list.
4942 static ParenListExpr *Create(const ASTContext &Ctx, SourceLocation LParenLoc,
4943 ArrayRef<Expr *> Exprs,
4944 SourceLocation RParenLoc);
4945
4946 /// Create an empty paren list.
4947 static ParenListExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumExprs);
4948
4949 /// Return the number of expressions in this paren list.
4950 unsigned getNumExprs() const { return ParenListExprBits.NumExprs; }
4951
4952 Expr *getExpr(unsigned Init) {
4953 assert(Init < getNumExprs() && "Initializer access out of range!");
4954 return getExprs()[Init];
4955 }
4956
4957 const Expr *getExpr(unsigned Init) const {
4958 return const_cast<ParenListExpr *>(this)->getExpr(Init);
4959 }
4960
4961 Expr **getExprs() {
4962 return reinterpret_cast<Expr **>(getTrailingObjects<Stmt *>());
4963 }
4964
4965 ArrayRef<Expr *> exprs() {
4966 return llvm::makeArrayRef(getExprs(), getNumExprs());
4967 }
4968
4969 SourceLocation getLParenLoc() const { return LParenLoc; }
4970 SourceLocation getRParenLoc() const { return RParenLoc; }
4971 SourceLocation getBeginLoc() const { return getLParenLoc(); }
4972 SourceLocation getEndLoc() const { return getRParenLoc(); }
4973
4974 static bool classof(const Stmt *T) {
4975 return T->getStmtClass() == ParenListExprClass;
4976 }
4977
4978 // Iterators
4979 child_range children() {
4980 return child_range(getTrailingObjects<Stmt *>(),
4981 getTrailingObjects<Stmt *>() + getNumExprs());
4982 }
4983 const_child_range children() const {
4984 return const_child_range(getTrailingObjects<Stmt *>(),
4985 getTrailingObjects<Stmt *>() + getNumExprs());
4986 }
4987 };
4988
4989 /// Represents a C11 generic selection.
4990 ///
4991 /// A generic selection (C11 6.5.1.1) contains an unevaluated controlling
4992 /// expression, followed by one or more generic associations. Each generic
4993 /// association specifies a type name and an expression, or "default" and an
4994 /// expression (in which case it is known as a default generic association).
4995 /// The type and value of the generic selection are identical to those of its
4996 /// result expression, which is defined as the expression in the generic
4997 /// association with a type name that is compatible with the type of the
4998 /// controlling expression, or the expression in the default generic association
4999 /// if no types are compatible. For example:
5000 ///
5001 /// @code
5002 /// _Generic(X, double: 1, float: 2, default: 3)
5003 /// @endcode
5004 ///
5005 /// The above expression evaluates to 1 if 1.0 is substituted for X, 2 if 1.0f
5006 /// or 3 if "hello".
5007 ///
5008 /// As an extension, generic selections are allowed in C++, where the following
5009 /// additional semantics apply:
5010 ///
5011 /// Any generic selection whose controlling expression is type-dependent or
5012 /// which names a dependent type in its association list is result-dependent,
5013 /// which means that the choice of result expression is dependent.
5014 /// Result-dependent generic associations are both type- and value-dependent.
5015 class GenericSelectionExpr : public Expr {
5016 enum { CONTROLLING, END_EXPR };
5017 TypeSourceInfo **AssocTypes;
5018 Stmt **SubExprs;
5019 unsigned NumAssocs, ResultIndex;
5020 SourceLocation GenericLoc, DefaultLoc, RParenLoc;
5021
5022 public:
5023 GenericSelectionExpr(const ASTContext &Context,
5024 SourceLocation GenericLoc, Expr *ControllingExpr,
5025 ArrayRef<TypeSourceInfo*> AssocTypes,
5026 ArrayRef<Expr*> AssocExprs,
5027 SourceLocation DefaultLoc, SourceLocation RParenLoc,
5028 bool ContainsUnexpandedParameterPack,
5029 unsigned ResultIndex);
5030
5031 /// This constructor is used in the result-dependent case.
5032 GenericSelectionExpr(const ASTContext &Context,
5033 SourceLocation GenericLoc, Expr *ControllingExpr,
5034 ArrayRef<TypeSourceInfo*> AssocTypes,
5035 ArrayRef<Expr*> AssocExprs,
5036 SourceLocation DefaultLoc, SourceLocation RParenLoc,
5037 bool ContainsUnexpandedParameterPack);
5038
5039 explicit GenericSelectionExpr(EmptyShell Empty)
5040 : Expr(GenericSelectionExprClass, Empty) { }
5041
5042 unsigned getNumAssocs() const { return NumAssocs; }
5043
5044 SourceLocation getGenericLoc() const { return GenericLoc; }
5045 SourceLocation getDefaultLoc() const { return DefaultLoc; }
5046 SourceLocation getRParenLoc() const { return RParenLoc; }
5047
5048 const Expr *getAssocExpr(unsigned i) const {
5049 return cast<Expr>(SubExprs[END_EXPR+i]);
5050 }
5051 Expr *getAssocExpr(unsigned i) { return cast<Expr>(SubExprs[END_EXPR+i]); }
5052 ArrayRef<Expr *> getAssocExprs() const {
5053 return NumAssocs
5054 ? llvm::makeArrayRef(
5055 &reinterpret_cast<Expr **>(SubExprs)[END_EXPR], NumAssocs)
5056 : None;
5057 }
5058 const TypeSourceInfo *getAssocTypeSourceInfo(unsigned i) const {
5059 return AssocTypes[i];
5060 }
5061 TypeSourceInfo *getAssocTypeSourceInfo(unsigned i) { return AssocTypes[i]; }
5062 ArrayRef<TypeSourceInfo *> getAssocTypeSourceInfos() const {
5063 return NumAssocs ? llvm::makeArrayRef(&AssocTypes[0], NumAssocs) : None;
5064 }
5065
5066 QualType getAssocType(unsigned i) const {
5067 if (const TypeSourceInfo *TS = getAssocTypeSourceInfo(i))
5068 return TS->getType();
5069 else
5070 return QualType();
5071 }
5072
5073 const Expr *getControllingExpr() const {
5074 return cast<Expr>(SubExprs[CONTROLLING]);
5075 }
5076 Expr *getControllingExpr() { return cast<Expr>(SubExprs[CONTROLLING]); }
5077
5078 /// Whether this generic selection is result-dependent.
5079 bool isResultDependent() const { return ResultIndex == -1U; }
5080
5081 /// The zero-based index of the result expression's generic association in
5082 /// the generic selection's association list. Defined only if the
5083 /// generic selection is not result-dependent.
5084 unsigned getResultIndex() const {
5085 assert(!isResultDependent() && "Generic selection is result-dependent");
5086 return ResultIndex;
5087 }
5088
5089 /// The generic selection's result expression. Defined only if the
5090 /// generic selection is not result-dependent.
5091 const Expr *getResultExpr() const { return getAssocExpr(getResultIndex()); }
5092 Expr *getResultExpr() { return getAssocExpr(getResultIndex()); }
5093
5094 SourceLocation getBeginLoc() const LLVM_READONLY { return GenericLoc; }
5095 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5096
5097 static bool classof(const Stmt *T) {
5098 return T->getStmtClass() == GenericSelectionExprClass;
5099 }
5100
5101 child_range children() {
5102 return child_range(SubExprs, SubExprs+END_EXPR+NumAssocs);
5103 }
5104 const_child_range children() const {
5105 return const_child_range(SubExprs, SubExprs + END_EXPR + NumAssocs);
5106 }
5107 friend class ASTStmtReader;
5108 };
5109
5110 //===----------------------------------------------------------------------===//
5111 // Clang Extensions
5112 //===----------------------------------------------------------------------===//
5113
5114 /// ExtVectorElementExpr - This represents access to specific elements of a
5115 /// vector, and may occur on the left hand side or right hand side. For example
5116 /// the following is legal: "V.xy = V.zw" if V is a 4 element extended vector.
5117 ///
5118 /// Note that the base may have either vector or pointer to vector type, just
5119 /// like a struct field reference.
5120 ///
5121 class ExtVectorElementExpr : public Expr {
5122 Stmt *Base;
5123 IdentifierInfo *Accessor;
5124 SourceLocation AccessorLoc;
5125 public:
5126 ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base,
5127 IdentifierInfo &accessor, SourceLocation loc)
5128 : Expr(ExtVectorElementExprClass, ty, VK,
5129 (VK == VK_RValue ? OK_Ordinary : OK_VectorComponent),
5130 base->isTypeDependent(), base->isValueDependent(),
5131 base->isInstantiationDependent(),
5132 base->containsUnexpandedParameterPack()),
5133 Base(base), Accessor(&accessor), AccessorLoc(loc) {}
5134
5135 /// Build an empty vector element expression.
5136 explicit ExtVectorElementExpr(EmptyShell Empty)
5137 : Expr(ExtVectorElementExprClass, Empty) { }
5138
5139 const Expr *getBase() const { return cast<Expr>(Base); }
5140 Expr *getBase() { return cast<Expr>(Base); }
5141 void setBase(Expr *E) { Base = E; }
5142
5143 IdentifierInfo &getAccessor() const { return *Accessor; }
5144 void setAccessor(IdentifierInfo *II) { Accessor = II; }
5145
5146 SourceLocation getAccessorLoc() const { return AccessorLoc; }
5147 void setAccessorLoc(SourceLocation L) { AccessorLoc = L; }
5148
5149 /// getNumElements - Get the number of components being selected.
5150 unsigned getNumElements() const;
5151
5152 /// containsDuplicateElements - Return true if any element access is
5153 /// repeated.
5154 bool containsDuplicateElements() const;
5155
5156 /// getEncodedElementAccess - Encode the elements accessed into an llvm
5157 /// aggregate Constant of ConstantInt(s).
5158 void getEncodedElementAccess(SmallVectorImpl<uint32_t> &Elts) const;
5159
5160 SourceLocation getBeginLoc() const LLVM_READONLY {
5161 return getBase()->getBeginLoc();
5162 }
5163 SourceLocation getEndLoc() const LLVM_READONLY { return AccessorLoc; }
5164
5165 /// isArrow - Return true if the base expression is a pointer to vector,
5166 /// return false if the base expression is a vector.
5167 bool isArrow() const;
5168
5169 static bool classof(const Stmt *T) {
5170 return T->getStmtClass() == ExtVectorElementExprClass;
5171 }
5172
5173 // Iterators
5174 child_range children() { return child_range(&Base, &Base+1); }
5175 const_child_range children() const {
5176 return const_child_range(&Base, &Base + 1);
5177 }
5178 };
5179
5180 /// BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
5181 /// ^{ statement-body } or ^(int arg1, float arg2){ statement-body }
5182 class BlockExpr : public Expr {
5183 protected:
5184 BlockDecl *TheBlock;
5185 public:
5186 BlockExpr(BlockDecl *BD, QualType ty)
5187 : Expr(BlockExprClass, ty, VK_RValue, OK_Ordinary,
5188 ty->isDependentType(), ty->isDependentType(),
5189 ty->isInstantiationDependentType() || BD->isDependentContext(),
5190 false),
5191 TheBlock(BD) {}
5192
5193 /// Build an empty block expression.
5194 explicit BlockExpr(EmptyShell Empty) : Expr(BlockExprClass, Empty) { }
5195
5196 const BlockDecl *getBlockDecl() const { return TheBlock; }
5197 BlockDecl *getBlockDecl() { return TheBlock; }
5198 void setBlockDecl(BlockDecl *BD) { TheBlock = BD; }
5199
5200 // Convenience functions for probing the underlying BlockDecl.
5201 SourceLocation getCaretLocation() const;
5202 const Stmt *getBody() const;
5203 Stmt *getBody();
5204
5205 SourceLocation getBeginLoc() const LLVM_READONLY {
5206 return getCaretLocation();
5207 }
5208 SourceLocation getEndLoc() const LLVM_READONLY {
5209 return getBody()->getEndLoc();
5210 }
5211
5212 /// getFunctionType - Return the underlying function type for this block.
5213 const FunctionProtoType *getFunctionType() const;
5214
5215 static bool classof(const Stmt *T) {
5216 return T->getStmtClass() == BlockExprClass;
5217 }
5218
5219 // Iterators
5220 child_range children() {
5221 return child_range(child_iterator(), child_iterator());
5222 }
5223 const_child_range children() const {
5224 return const_child_range(const_child_iterator(), const_child_iterator());
5225 }
5226 };
5227
5228 /// AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2]
5229 /// This AST node provides support for reinterpreting a type to another
5230 /// type of the same size.
5231 class AsTypeExpr : public Expr {
5232 private:
5233 Stmt *SrcExpr;
5234 SourceLocation BuiltinLoc, RParenLoc;
5235
5236 friend class ASTReader;
5237 friend class ASTStmtReader;
5238 explicit AsTypeExpr(EmptyShell Empty) : Expr(AsTypeExprClass, Empty) {}
5239
5240 public:
5241 AsTypeExpr(Expr* SrcExpr, QualType DstType,
5242 ExprValueKind VK, ExprObjectKind OK,
5243 SourceLocation BuiltinLoc, SourceLocation RParenLoc)
5244 : Expr(AsTypeExprClass, DstType, VK, OK,
5245 DstType->isDependentType(),
5246 DstType->isDependentType() || SrcExpr->isValueDependent(),
5247 (DstType->isInstantiationDependentType() ||
5248 SrcExpr->isInstantiationDependent()),
5249 (DstType->containsUnexpandedParameterPack() ||
5250 SrcExpr->containsUnexpandedParameterPack())),
5251 SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {}
5252
5253 /// getSrcExpr - Return the Expr to be converted.
5254 Expr *getSrcExpr() const { return cast<Expr>(SrcExpr); }
5255
5256 /// getBuiltinLoc - Return the location of the __builtin_astype token.
5257 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
5258
5259 /// getRParenLoc - Return the location of final right parenthesis.
5260 SourceLocation getRParenLoc() const { return RParenLoc; }
5261
5262 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
5263 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5264
5265 static bool classof(const Stmt *T) {
5266 return T->getStmtClass() == AsTypeExprClass;
5267 }
5268
5269 // Iterators
5270 child_range children() { return child_range(&SrcExpr, &SrcExpr+1); }
5271 const_child_range children() const {
5272 return const_child_range(&SrcExpr, &SrcExpr + 1);
5273 }
5274 };
5275
5276 /// PseudoObjectExpr - An expression which accesses a pseudo-object
5277 /// l-value. A pseudo-object is an abstract object, accesses to which
5278 /// are translated to calls. The pseudo-object expression has a
5279 /// syntactic form, which shows how the expression was actually
5280 /// written in the source code, and a semantic form, which is a series
5281 /// of expressions to be executed in order which detail how the
5282 /// operation is actually evaluated. Optionally, one of the semantic
5283 /// forms may also provide a result value for the expression.
5284 ///
5285 /// If any of the semantic-form expressions is an OpaqueValueExpr,
5286 /// that OVE is required to have a source expression, and it is bound
5287 /// to the result of that source expression. Such OVEs may appear
5288 /// only in subsequent semantic-form expressions and as
5289 /// sub-expressions of the syntactic form.
5290 ///
5291 /// PseudoObjectExpr should be used only when an operation can be
5292 /// usefully described in terms of fairly simple rewrite rules on
5293 /// objects and functions that are meant to be used by end-developers.
5294 /// For example, under the Itanium ABI, dynamic casts are implemented
5295 /// as a call to a runtime function called __dynamic_cast; using this
5296 /// class to describe that would be inappropriate because that call is
5297 /// not really part of the user-visible semantics, and instead the
5298 /// cast is properly reflected in the AST and IR-generation has been
5299 /// taught to generate the call as necessary. In contrast, an
5300 /// Objective-C property access is semantically defined to be
5301 /// equivalent to a particular message send, and this is very much
5302 /// part of the user model. The name of this class encourages this
5303 /// modelling design.
5304 class PseudoObjectExpr final
5305 : public Expr,
5306 private llvm::TrailingObjects<PseudoObjectExpr, Expr *> {
5307 // PseudoObjectExprBits.NumSubExprs - The number of sub-expressions.
5308 // Always at least two, because the first sub-expression is the
5309 // syntactic form.
5310
5311 // PseudoObjectExprBits.ResultIndex - The index of the
5312 // sub-expression holding the result. 0 means the result is void,
5313 // which is unambiguous because it's the index of the syntactic
5314 // form. Note that this is therefore 1 higher than the value passed
5315 // in to Create, which is an index within the semantic forms.
5316 // Note also that ASTStmtWriter assumes this encoding.
5317
5318 Expr **getSubExprsBuffer() { return getTrailingObjects<Expr *>(); }
5319 const Expr * const *getSubExprsBuffer() const {
5320 return getTrailingObjects<Expr *>();
5321 }
5322
5323 PseudoObjectExpr(QualType type, ExprValueKind VK,
5324 Expr *syntactic, ArrayRef<Expr*> semantic,
5325 unsigned resultIndex);
5326
5327 PseudoObjectExpr(EmptyShell shell, unsigned numSemanticExprs);
5328
5329 unsigned getNumSubExprs() const {
5330 return PseudoObjectExprBits.NumSubExprs;
5331 }
5332
5333 public:
5334 /// NoResult - A value for the result index indicating that there is
5335 /// no semantic result.
5336 enum : unsigned { NoResult = ~0U };
5337
5338 static PseudoObjectExpr *Create(const ASTContext &Context, Expr *syntactic,
5339 ArrayRef<Expr*> semantic,
5340 unsigned resultIndex);
5341
5342 static PseudoObjectExpr *Create(const ASTContext &Context, EmptyShell shell,
5343 unsigned numSemanticExprs);
5344
5345 /// Return the syntactic form of this expression, i.e. the
5346 /// expression it actually looks like. Likely to be expressed in
5347 /// terms of OpaqueValueExprs bound in the semantic form.
5348 Expr *getSyntacticForm() { return getSubExprsBuffer()[0]; }
5349 const Expr *getSyntacticForm() const { return getSubExprsBuffer()[0]; }
5350
5351 /// Return the index of the result-bearing expression into the semantics
5352 /// expressions, or PseudoObjectExpr::NoResult if there is none.
5353 unsigned getResultExprIndex() const {
5354 if (PseudoObjectExprBits.ResultIndex == 0) return NoResult;
5355 return PseudoObjectExprBits.ResultIndex - 1;
5356 }
5357
5358 /// Return the result-bearing expression, or null if there is none.
5359 Expr *getResultExpr() {
5360 if (PseudoObjectExprBits.ResultIndex == 0)
5361 return nullptr;
5362 return getSubExprsBuffer()[PseudoObjectExprBits.ResultIndex];
5363 }
5364 const Expr *getResultExpr() const {
5365 return const_cast<PseudoObjectExpr*>(this)->getResultExpr();
5366 }
5367
5368 unsigned getNumSemanticExprs() const { return getNumSubExprs() - 1; }
5369
5370 typedef Expr * const *semantics_iterator;
5371 typedef const Expr * const *const_semantics_iterator;
5372 semantics_iterator semantics_begin() {
5373 return getSubExprsBuffer() + 1;
5374 }
5375 const_semantics_iterator semantics_begin() const {
5376 return getSubExprsBuffer() + 1;
5377 }
5378 semantics_iterator semantics_end() {
5379 return getSubExprsBuffer() + getNumSubExprs();
5380 }
5381 const_semantics_iterator semantics_end() const {
5382 return getSubExprsBuffer() + getNumSubExprs();
5383 }
5384
5385 llvm::iterator_range<semantics_iterator> semantics() {
5386 return llvm::make_range(semantics_begin(), semantics_end());
5387 }
5388 llvm::iterator_range<const_semantics_iterator> semantics() const {
5389 return llvm::make_range(semantics_begin(), semantics_end());
5390 }
5391
5392 Expr *getSemanticExpr(unsigned index) {
5393 assert(index + 1 < getNumSubExprs());
5394 return getSubExprsBuffer()[index + 1];
5395 }
5396 const Expr *getSemanticExpr(unsigned index) const {
5397 return const_cast<PseudoObjectExpr*>(this)->getSemanticExpr(index);
5398 }
5399
5400 SourceLocation getExprLoc() const LLVM_READONLY {
5401 return getSyntacticForm()->getExprLoc();
5402 }
5403
5404 SourceLocation getBeginLoc() const LLVM_READONLY {
5405 return getSyntacticForm()->getBeginLoc();
5406 }
5407 SourceLocation getEndLoc() const LLVM_READONLY {
5408 return getSyntacticForm()->getEndLoc();
5409 }
5410
5411 child_range children() {
5412 const_child_range CCR =
5413 const_cast<const PseudoObjectExpr *>(this)->children();
5414 return child_range(cast_away_const(CCR.begin()),
5415 cast_away_const(CCR.end()));
5416 }
5417 const_child_range children() const {
5418 Stmt *const *cs = const_cast<Stmt *const *>(
5419 reinterpret_cast<const Stmt *const *>(getSubExprsBuffer()));
5420 return const_child_range(cs, cs + getNumSubExprs());
5421 }
5422
5423 static bool classof(const Stmt *T) {
5424 return T->getStmtClass() == PseudoObjectExprClass;
5425 }
5426
5427 friend TrailingObjects;
5428 friend class ASTStmtReader;
5429 };
5430
5431 /// AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*,
5432 /// __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the
5433 /// similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>,
5434 /// and corresponding __opencl_atomic_* for OpenCL 2.0.
5435 /// All of these instructions take one primary pointer, at least one memory
5436 /// order. The instructions for which getScopeModel returns non-null value
5437 /// take one synch scope.
5438 class AtomicExpr : public Expr {
5439 public:
5440 enum AtomicOp {
5441 #define BUILTIN(ID, TYPE, ATTRS)
5442 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID,
5443 #include "clang/Basic/Builtins.def"
5444 // Avoid trailing comma
5445 BI_First = 0
5446 };
5447
5448 private:
5449 /// Location of sub-expressions.
5450 /// The location of Scope sub-expression is NumSubExprs - 1, which is
5451 /// not fixed, therefore is not defined in enum.
5452 enum { PTR, ORDER, VAL1, ORDER_FAIL, VAL2, WEAK, END_EXPR };
5453 Stmt *SubExprs[END_EXPR + 1];
5454 unsigned NumSubExprs;
5455 SourceLocation BuiltinLoc, RParenLoc;
5456 AtomicOp Op;
5457
5458 friend class ASTStmtReader;
5459 public:
5460 AtomicExpr(SourceLocation BLoc, ArrayRef<Expr*> args, QualType t,
5461 AtomicOp op, SourceLocation RP);
5462
5463 /// Determine the number of arguments the specified atomic builtin
5464 /// should have.
5465 static unsigned getNumSubExprs(AtomicOp Op);
5466
5467 /// Build an empty AtomicExpr.
5468 explicit AtomicExpr(EmptyShell Empty) : Expr(AtomicExprClass, Empty) { }
5469
5470 Expr *getPtr() const {
5471 return cast<Expr>(SubExprs[PTR]);
5472 }
5473 Expr *getOrder() const {
5474 return cast<Expr>(SubExprs[ORDER]);
5475 }
5476 Expr *getScope() const {
5477 assert(getScopeModel() && "No scope");
5478 return cast<Expr>(SubExprs[NumSubExprs - 1]);
5479 }
5480 Expr *getVal1() const {
5481 if (Op == AO__c11_atomic_init || Op == AO__opencl_atomic_init)
5482 return cast<Expr>(SubExprs[ORDER]);
5483 assert(NumSubExprs > VAL1);
5484 return cast<Expr>(SubExprs[VAL1]);
5485 }
5486 Expr *getOrderFail() const {
5487 assert(NumSubExprs > ORDER_FAIL);
5488 return cast<Expr>(SubExprs[ORDER_FAIL]);
5489 }
5490 Expr *getVal2() const {
5491 if (Op == AO__atomic_exchange)
5492 return cast<Expr>(SubExprs[ORDER_FAIL]);
5493 assert(NumSubExprs > VAL2);
5494 return cast<Expr>(SubExprs[VAL2]);
5495 }
5496 Expr *getWeak() const {
5497 assert(NumSubExprs > WEAK);
5498 return cast<Expr>(SubExprs[WEAK]);
5499 }
5500 QualType getValueType() const;
5501
5502 AtomicOp getOp() const { return Op; }
5503 unsigned getNumSubExprs() const { return NumSubExprs; }
5504
5505 Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); }
5506 const Expr * const *getSubExprs() const {
5507 return reinterpret_cast<Expr * const *>(SubExprs);
5508 }
5509
5510 bool isVolatile() const {
5511 return getPtr()->getType()->getPointeeType().isVolatileQualified();
5512 }
5513
5514 bool isCmpXChg() const {
5515 return getOp() == AO__c11_atomic_compare_exchange_strong ||
5516 getOp() == AO__c11_atomic_compare_exchange_weak ||
5517 getOp() == AO__opencl_atomic_compare_exchange_strong ||
5518 getOp() == AO__opencl_atomic_compare_exchange_weak ||
5519 getOp() == AO__atomic_compare_exchange ||
5520 getOp() == AO__atomic_compare_exchange_n;
5521 }
5522
5523 bool isOpenCL() const {
5524 return getOp() >= AO__opencl_atomic_init &&
5525 getOp() <= AO__opencl_atomic_fetch_max;
5526 }
5527
5528 SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
5529 SourceLocation getRParenLoc() const { return RParenLoc; }
5530
5531 SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
5532 SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
5533
5534 static bool classof(const Stmt *T) {
5535 return T->getStmtClass() == AtomicExprClass;
5536 }
5537
5538 // Iterators
5539 child_range children() {
5540 return child_range(SubExprs, SubExprs+NumSubExprs);
5541 }
5542 const_child_range children() const {
5543 return const_child_range(SubExprs, SubExprs + NumSubExprs);
5544 }
5545
5546 /// Get atomic scope model for the atomic op code.
5547 /// \return empty atomic scope model if the atomic op code does not have
5548 /// scope operand.
5549 static std::unique_ptr<AtomicScopeModel> getScopeModel(AtomicOp Op) {
5550 auto Kind =
5551 (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
5552 ? AtomicScopeModelKind::OpenCL
5553 : AtomicScopeModelKind::None;
5554 return AtomicScopeModel::create(Kind);
5555 }
5556
5557 /// Get atomic scope model.
5558 /// \return empty atomic scope model if this atomic expression does not have
5559 /// scope operand.
5560 std::unique_ptr<AtomicScopeModel> getScopeModel() const {
5561 return getScopeModel(getOp());
5562 }
5563 };
5564
5565 /// TypoExpr - Internal placeholder for expressions where typo correction
5566 /// still needs to be performed and/or an error diagnostic emitted.
5567 class TypoExpr : public Expr {
5568 public:
5569 TypoExpr(QualType T)
5570 : Expr(TypoExprClass, T, VK_LValue, OK_Ordinary,
5571 /*isTypeDependent*/ true,
5572 /*isValueDependent*/ true,
5573 /*isInstantiationDependent*/ true,
5574 /*containsUnexpandedParameterPack*/ false) {
5575 assert(T->isDependentType() && "TypoExpr given a non-dependent type");
5576 }
5577
5578 child_range children() {
5579 return child_range(child_iterator(), child_iterator());
5580 }
5581 const_child_range children() const {
5582 return const_child_range(const_child_iterator(), const_child_iterator());
5583 }
5584
5585 SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
5586 SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
5587
5588 static bool classof(const Stmt *T) {
5589 return T->getStmtClass() == TypoExprClass;
5590 }
5591
5592 };
5593 } // end namespace clang
5594
5595 #endif // LLVM_CLANG_AST_EXPR_H
clang::BinaryOperator::setFPFeatures
void setFPFeatures(FPOptions F)
Definition: Expr.h:3462
clang::ObjCPropertyRefExpr
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
clang::PseudoObjectExpr::getNumSemanticExprs
unsigned getNumSemanticExprs() const
Definition: Expr.h:5368
clang::FullExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:890
clang::InitListExpr::hasArrayFiller
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
Definition: Expr.h:4294
clang::Expr::LV_IncompleteVoidType
Definition: Expr.h:257
clang::DesignatedInitExpr::Designator
Represents a single C99 designator.
Definition: Expr.h:4499
clang::DeclRefExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1215
clang::BlockExpr::children
child_range children()
Definition: Expr.h:5220
clang::TypoExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5585
clang::AtomicExpr::getVal2
Expr * getVal2() const
Definition: Expr.h:5490
clang::Builtin::ID
ID
Definition: Builtins.h:49
clang::Expr::setValueDependent
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Definition: Expr.h:152
clang::CStyleCastExpr::TrailingObjects
friend TrailingObjects
Definition: Expr.h:3270
clang::Stmt::APFloatSemantics
APFloatSemantics
Definition: Stmt.h:351
clang::BlockExpr::getBlockDecl
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5196
clang::CastExpr::children
const_child_range children() const
Definition: Expr.h:3097
clang::CallExpr::isCallToStdMove
bool isCallToStdMove() const
Definition: Expr.h:2650
clang::CharacterLiteral::Ascii
Definition: Expr.h:1395
clang::UnaryOperator::isIncrementOp
bool isIncrementOp() const
Definition: Expr.h:1958
clang::CastExpr::path_empty
bool path_empty() const
Definition: Expr.h:3073
clang::ChooseExpr::getChosenSubExpr
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
Definition: Expr.h:4023
clang::DesignatedInitUpdateExpr::children
const_child_range children() const
Definition: Expr.h:4786
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1738
clang::DeclRefExpr::getFoundDecl
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1151
clang::PredefinedExpr::getFunctionName
const StringLiteral * getFunctionName() const
Definition: Expr.h:1819
clang::StmtExpr::setSubStmt
void setSubStmt(CompoundStmt *S)
Definition: Expr.h:3824
clang::CallExpr::getArgs
Expr ** getArgs()
Retrieve the call arguments.
Definition: Expr.h:2543
clang::BuiltinType::Kind
Kind
Definition: Type.h:2393
Diag
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Definition: LiteralSupport.cpp:78
clang::BlockExpr::BlockExpr
BlockExpr(EmptyShell Empty)
Build an empty block expression.
Definition: Expr.h:5194
clang::ConditionalOperator::getLHS
Expr * getLHS() const
Definition: Expr.h:3632
clang::UnaryOperator::children
child_range children()
Definition: Expr.h:2004
Identifier
StringRef Identifier
Definition: Format.cpp:1636
clang::BlockExpr::TheBlock
BlockDecl * TheBlock
Definition: Expr.h:5184
clang::ImplicitCastExpr::ImplicitCastExpr
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op, ExprValueKind VK)
Definition: Expr.h:3134
clang::PseudoObjectExpr::getSyntacticForm
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:5348
clang::CharacterLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1424
clang::MemberExpr::hasTemplateKeyword
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: Expr.h:2835
clang::Expr::Classification::CL_ObjCMessageRValue
Definition: Expr.h:316
clang::InitListExpr::rbegin
reverse_iterator rbegin()
Definition: Expr.h:4395
clang::CallExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:2640
clang::DeclRefExpr::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1207
clang::ArraySubscriptExpr::children
child_range children()
Definition: Expr.h:2382
clang::SourceLocation::getRawEncoding
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
Definition: SourceLocation.h:146
clang::ArraySubscriptExpr::getIdx
const Expr * getIdx() const
Definition: Expr.h:2359
clang::SubobjectAdjustment::Kind
enum clang::SubobjectAdjustment::@45 Kind
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:638
clang::ArrayInitIndexExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4877
clang::ArraySubscriptExpr::getBase
Expr * getBase()
Definition: Expr.h:2355
clang::StringLiteral::getKind
StringKind getKind() const
Definition: Expr.h:1681
clang::MemberExpr::getMemberDecl
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2778
clang::ChooseExpr::getCond
Expr * getCond() const
Definition: Expr.h:4027
clang::UnaryExprOrTypeTraitExpr::setOperatorLoc
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:2290
clang::BinaryOperator::getOpForCompoundAssignment
static Opcode getOpForCompoundAssignment(Opcode Opc)
Definition: Expr.h:3426
clang::CallExpr::getArg
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2553
clang::BinaryOperator::getExprLoc
SourceLocation getExprLoc() const
Definition: Expr.h:3323
clang::MemberExpr::setArrow
void setArrow(bool A)
Definition: Expr.h:2880
clang::FloatingLiteral::setRawSemantics
void setRawSemantics(APFloatSemantics Sem)
Set the raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE...
Definition: Expr.h:1475
TypeTraits.h
Defines enumerations for the type traits support.
clang::ParenExpr::getLParen
SourceLocation getLParen() const
Get the location of the left parentheses &#39;(&#39;.
Definition: Expr.h:1868
clang::ArrayInitLoopExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4844
clang::Expr::Expr
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
Definition: Expr.h:110
clang::ShuffleVectorExpr::getExpr
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition: Expr.h:3891
clang::APFloatStorage::getValue
llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const
Definition: Expr.h:1300
clang::DesignatedInitExpr::Designator::Designator
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc)
Initializes an array designator.
Definition: Expr.h:4528
clang::DesignatedInitExpr::FieldDesignator::FieldLoc
unsigned FieldLoc
The location of the field name in the designated initializer.
Definition: Expr.h:4476
clang::CharacterLiteral::CharacterLiteral
CharacterLiteral(EmptyShell Empty)
Construct an empty character literal.
Definition: Expr.h:1416
clang::ShuffleVectorExpr::getNumSubExprs
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:3885
clang::GenericSelectionExpr::getResultIndex
unsigned getResultIndex() const
The zero-based index of the result expression&#39;s generic association in the generic selection&#39;s associ...
Definition: Expr.h:5084
clang::GenericSelectionExpr::getResultExpr
Expr * getResultExpr()
Definition: Expr.h:5092
clang::StmtExpr::getSubStmt
CompoundStmt * getSubStmt()
Definition: Expr.h:3822
clang::InitListExpr::const_iterator
InitExprsTy::const_iterator const_iterator
Definition: Expr.h:4387
clang::ExtVectorElementExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5163
clang::InitListExpr::getInit
const Expr * getInit(unsigned Init) const
Definition: Expr.h:4238
clang::ArrayInitIndexExpr::classof
static bool classof(const Stmt *S)
Definition: Expr.h:4872
clang::DesignatedInitExpr::Designator::Designator
Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Initializes a field designator.
Definition: Expr.h:4519
clang::GenericSelectionExpr::getControllingExpr
Expr * getControllingExpr()
Definition: Expr.h:5076
clang::ArraySubscriptExpr::setRHS
void setRHS(Expr *E)
Definition: Expr.h:2353
clang::StringLiteral::containsNonAsciiOrNull
bool containsNonAsciiOrNull() const
Definition: Expr.h:1699
isBuiltinAssumeFalse
static bool isBuiltinAssumeFalse(const CFGBlock *B, const Stmt *S, ASTContext &C)
Definition: ReachableCode.cpp:69
clang::UnaryExprOrTypeTraitExpr::Ty
TypeSourceInfo * Ty
Definition: Expr.h:2224
clang::PseudoObjectExpr::semantics_iterator
Expr *const * semantics_iterator
Definition: Expr.h:5370
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::CallExpr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2540
clang::CompoundLiteralExpr::CompoundLiteralExpr
CompoundLiteralExpr(EmptyShell Empty)
Construct an empty compound literal.
Definition: Expr.h:2953
clang::OffsetOfExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2152
clang::ShuffleVectorExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:3872
clang::FloatingLiteral::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1493
clang::StmtExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3826
clang::StmtExpr::StmtExpr
StmtExpr(CompoundStmt *substmt, QualType T, SourceLocation lp, SourceLocation rp)
Definition: Expr.h:3813
clang::BinaryOperator::isFEnvAccessOn
bool isFEnvAccessOn() const
Definition: Expr.h:3478
clang::Expr::hasPlaceholderType
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
Definition: Expr.h:472
Base
clang::CallExpr::getRawSubExprs
ArrayRef< Stmt * > getRawSubExprs()
This method provides fast access to all the subexpressions of a CallExpr without going through the sl...
Definition: Expr.h:2609
clang::Expr::LV_InvalidExpression
Definition: Expr.h:259
Type.h
C Language Family Type Representation.
clang::BinaryOperator::isMultiplicativeOp
static bool isMultiplicativeOp(Opcode Opc)
Definition: Expr.h:3364
clang::BinaryOperator::isLogicalOp
bool isLogicalOp() const
Definition: Expr.h:3413
clang::DesignatedInitExpr::Designator::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: Expr.h:4582
clang::BinaryOperator::setOpcode
void setOpcode(Opcode Opc)
Definition: Expr.h:3330
clang::FloatingLiteral::children
const_child_range children() const
Definition: Expr.h:1507
clang::StringLiteral::isAscii
bool isAscii() const
Definition: Expr.h:1685
clang::Expr::MLV_IncompleteType
Definition: Expr.h:276
clang::ASTVector::rbegin
reverse_iterator rbegin()
Definition: ASTVector.h:104
clang::ChooseExpr::children
const_child_range children() const
Definition: Expr.h:4051
clang::MemberExpr::getBase
Expr * getBase() const
Definition: Expr.h:2772
clang::CompoundLiteralExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2966
clang::Expr::Classification::CL_MemberFunction
Definition: Expr.h:312
clang::CallExpr::sizeOfTrailingObjects
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs)
Return the size in bytes needed for the trailing objects.
Definition: Expr.h:2460
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
clang::IntegerLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1338
clang::FloatingLiteral::getValue
llvm::APFloat getValue() const
Definition: Expr.h:1459
clang::ArrayInitIndexExpr
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:4863
clang::isASCII
LLVM_READNONE bool isASCII(char c)
Returns true if this is an ASCII character.
Definition: CharInfo.h:43
clang::Expr::setType
void setType(QualType t)
Definition: Expr.h:129
clang::Expr::ConstExprUsage
ConstExprUsage
Indicates how the constant expression will be used.
Definition: Expr.h:668
clang::UnaryExprOrTypeTraitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:2295
clang::VAArgExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:4114
clang::CallExpr::children
const_child_range children() const
Definition: Expr.h:2667
clang::TypoExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5586
clang::BinaryOperator::getOpcode
Opcode getOpcode() const
Definition: Expr.h:3327
clang::Expr::Classify
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
Definition: Expr.h:377
clang::ImplicitCastExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3159
clang::SubobjectAdjustment::DTB::BasePath
const CastExpr * BasePath
Definition: Expr.h:69
clang::DesignatedInitExpr::getNumSubExprs
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
Definition: Expr.h:4670
clang::CallExpr::setNumArgsUnsafe
void setNumArgsUnsafe(unsigned NewNumArgs)
Bluntly set a new number of arguments without doing any checks whatsoever.
Definition: Expr.h:2583
clang::CompoundAssignOperator::setComputationResultType
void setComputationResultType(QualType T)
Definition: Expr.h:3536
clang::ParenExpr
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1844
clang::Expr::Classification::CM_Function
Definition: Expr.h:324
clang::AbstractConditionalOperator::getFalseExpr
Expr * getFalseExpr() const
Definition: Expr.h:3755
clang::AttrSyntax::GNU
Is the identifier known as a GNU-style attribute?
clang::MemberExpr::hasQualifier
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition: Expr.h:2792
clang::Expr::SE_NoSideEffects
Strictly evaluate the expression.
Definition: Expr.h:596
clang::BinaryOperator::children
child_range children()
Definition: Expr.h:3453
clang::IntegerLiteral
Definition: Expr.h:1308
clang::CallExpr::arg_begin
const_arg_iterator arg_begin() const
Definition: Expr.h:2600
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1407
clang::FullExpr::FullExpr
FullExpr(StmtClass SC, Expr *subexpr)
Definition: Expr.h:881
clang::ImplicitValueInitExpr::ImplicitValueInitExpr
ImplicitValueInitExpr(QualType ty)
Definition: Expr.h:4900
clang::InitListExpr::isSemanticForm
bool isSemanticForm() const
Definition: Expr.h:4340
clang::DeclRefExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Definition: Expr.h:1195
clang::Stmt::child_range
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1098
clang::UnaryExprOrTypeTraitExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:2292
clang::CastExpr::CastExpr
CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize)
Construct an empty cast.
Definition: Expr.h:3040
clang::BinaryOperator::isShiftOp
static bool isShiftOp(Opcode Opc)
Definition: Expr.h:3370
clang::Expr::getValueKindForType
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Definition: Expr.h:395
clang::DesignatedInitExpr::getDesignator
const Designator * getDesignator(unsigned Idx) const
Definition: Expr.h:4636
clang::ExplicitCastExpr::getTypeInfoAsWritten
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
Definition: Expr.h:3213
clang::CallExpr::setADLCallKind
void setADLCallKind(ADLCallKind V=UsesADL)
Definition: Expr.h:2521
clang::BinaryOperator::getFPFeatures
FPOptions getFPFeatures() const
Definition: Expr.h:3466
clang::InitListExpr::iterator
InitExprsTy::iterator iterator
Definition: Expr.h:4386
clang::CStyleCastExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:3255
clang::CodeGen::AlignmentSource::Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::TypeSourceInfo
A container of type source information.
Definition: Decl.h:87
clang::ImplicitCastExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3152
clang::Stmt::IgnoreImplicit
Stmt * IgnoreImplicit()
Skip past any implicit AST nodes which might surround this statement, such as ExprWithCleanups or Imp...
Definition: Stmt.cpp:121
clang::FullExpr::SubExpr
Stmt * SubExpr
Definition: Expr.h:879
clang::UnaryOperator::setCanOverflow
void setCanOverflow(bool C)
Definition: Expr.h:1940
clang::FPOptions
Floating point control options.
Definition: LangOptions.h:307
clang::CStyleCastExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3261
clang::PredefinedExpr::getIdentKind
IdentKind getIdentKind() const
Definition: Expr.h:1806
clang::GenericSelectionExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5095
clang::ASTStmtReader
Definition: ASTReaderStmt.cpp:69
clang::CastExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3090
clang::GenericSelectionExpr::children
const_child_range children() const
Definition: Expr.h:5104
clang::PseudoObjectExpr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
Definition: Expr.h:5400
clang::ImplicitValueInitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4913
clang::VAArgExpr::children
const_child_range children() const
Definition: Expr.h:4140
clang::ShuffleVectorExpr::ShuffleVectorExpr
ShuffleVectorExpr(EmptyShell Empty)
Build an empty vector-shuffle expression.
Definition: Expr.h:3866
clang::ExtVectorElementExpr::getAccessorLoc
SourceLocation getAccessorLoc() const
Definition: Expr.h:5146
clang::Expr::Classification::Classification
Classification()
Definition: Expr.h:345
clang::BinaryOperator::BinaryOperator
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptions FPFeatures)
Definition: Expr.h:3299
clang::GenericSelectionExpr::getResultExpr
const Expr * getResultExpr() const
The generic selection&#39;s result expression.
Definition: Expr.h:5091
clang::MemberExpr::isImplicitAccess
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
Definition: Expr.h:2893
clang::ConvertVectorExpr::getRParenLoc
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:3957
clang::Expr::isModifiableLvalueResult
isModifiableLvalueResult
Definition: Expr.h:269
clang::ImaginaryLiteral::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:1529
Value
Value
Definition: UninitializedValues.cpp:102
clang::OffsetOfExpr::getIndexExpr
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2180
clang::OffsetOfExpr::getIndexExpr
const Expr * getIndexExpr(unsigned Idx) const
Definition: Expr.h:2185
clang::CastExpr::path_const_iterator
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:3072
clang::CharacterLiteral::UTF16
Definition: Expr.h:1398
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:813
clang::GenericSelectionExpr::GenericSelectionExpr
GenericSelectionExpr(EmptyShell Empty)
Definition: Expr.h:5039
clang::DeclRefExpr::hasTemplateKWAndArgsInfo
bool hasTemplateKWAndArgsInfo() const
Definition: Expr.h:1161
clang::Expr::MLV_LValueCast
Definition: Expr.h:275
clang::ImplicitCastExpr::setIsPartOfExplicitCast
void setIsPartOfExplicitCast(bool PartOfExplicitCast)
Definition: Expr.h:3140
clang::CompoundLiteralExpr
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:2930
clang::DesignatedInitExpr::setSubExpr
void setSubExpr(unsigned Idx, Expr *E)
Definition: Expr.h:4677
clang::UnaryOperator::isArithmeticOp
static bool isArithmeticOp(Opcode Op)
Definition: Expr.h:1974
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:690
clang::ArrayInitLoopExpr::getCommonExpr
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
Definition: Expr.h:4825
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6748
clang::CompoundLiteralExpr::setInitializer
void setInitializer(Expr *E)
Definition: Expr.h:2958
clang::ImplicitValueInitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4912
clang::PseudoObjectExpr::getSemanticExpr
const Expr * getSemanticExpr(unsigned index) const
Definition: Expr.h:5396
clang::DesignatedInitExpr::ArrayOrRangeDesignator::EllipsisLoc
unsigned EllipsisLoc
The location of the ellipsis separating the start and end indices.
Definition: Expr.h:4488
clang::CallExpr::arg_range
llvm::iterator_range< arg_iterator > arg_range
Definition: Expr.h:2587
clang::PredefinedExpr::FuncDName
Definition: Expr.h:1773
clang::AbstractConditionalOperator::getColonLoc
SourceLocation getColonLoc() const
Definition: Expr.h:3577
clang::BlockExpr::BlockExpr
BlockExpr(BlockDecl *BD, QualType ty)
Definition: Expr.h:5186
clang::InitListExpr::setInit
void setInit(unsigned Init, Expr *expr)
Definition: Expr.h:4248
clang::AddrLabelExpr::AddrLabelExpr
AddrLabelExpr(EmptyShell Empty)
Build an empty address of a label expression.
Definition: Expr.h:3773
clang::CharacterLiteral::setValue
void setValue(unsigned Val)
Definition: Expr.h:1430
clang::InitListExpr::begin
const_iterator begin() const
Definition: Expr.h:4392
clang::FixedPointLiteral::setLocation
void setLocation(SourceLocation Location)
Definition: Expr.h:1375
clang::ASTVector::size
size_type size() const
Definition: ASTVector.h:110
clang::AtomicExpr::getVal1
Expr * getVal1() const
Definition: Expr.h:5480
clang::ConstantExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:925
clang::AtomicScopeModel::create
static std::unique_ptr< AtomicScopeModel > create(AtomicScopeModelKind K)
Create an atomic scope model by AtomicScopeModelKind.
Definition: SyncScope.h:143
clang::Expr::setContainsUnexpandedParameterPack
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
Definition: Expr.h:220
clang::ConditionalOperator::ConditionalOperator
ConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
Definition: Expr.h:3616
clang::DesignatedInitExpr::setGNUSyntax
void setGNUSyntax(bool GNU)
Definition: Expr.h:4655
clang::UnaryExprOrTypeTraitExpr::getArgumentTypeInfo
TypeSourceInfo * getArgumentTypeInfo() const
Definition: Expr.h:2262
clang::AddrLabelExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3781
clang::OffsetOfNode::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2098
clang::PredefinedExpr::Function
Definition: Expr.h:1771
clang::BinaryOperator::isShiftAssignOp
bool isShiftAssignOp() const
Definition: Expr.h:3437
clang::OffsetOfExpr::getNumExpressions
unsigned getNumExpressions() const
Definition: Expr.h:2195
clang::IntegerLiteral::getLocation
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1334
clang::ConstantExpr::ConstantExpr
ConstantExpr(EmptyShell Empty)
Build an empty constant expression wrapper.
Definition: Expr.h:915
clang::BinaryConditionalOperator::children
child_range children()
Definition: Expr.h:3735
clang::OpaqueValueExpr::children
child_range children()
Definition: Expr.h:987
OperationKinds.h
clang::SubobjectAdjustment::P
Definition: Expr.h:73
clang::ArrayInitIndexExpr::children
const_child_range children() const
Definition: Expr.h:4882
clang::BinaryOperator::isAssignmentOp
static bool isAssignmentOp(Opcode Opc)
Definition: Expr.h:3415
clang::MultiVersionKind::Target
clang::StmtExpr::children
child_range children()
Definition: Expr.h:3839
clang::Expr::LV_ClassTemporary
Definition: Expr.h:263
clang::GenericSelectionExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:5046
clang::FixedPointLiteral::getLocation
SourceLocation getLocation() const
Retrieve the location of the literal.
Definition: Expr.h:1373
clang::Expr::IgnoreParenNoopCasts
const Expr * IgnoreParenNoopCasts(ASTContext &Ctx) const LLVM_READONLY
Definition: Expr.h:834
clang::BinaryOperator::isAdditiveOp
bool isAdditiveOp() const
Definition: Expr.h:3369
clang::BinaryOperator::isEqualityOp
bool isEqualityOp() const
Definition: Expr.h:3380
clang::ChooseExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4034
clang::CompoundLiteralExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:2973
clang::AddrLabelExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3782
clang::Expr::isXValue
bool isXValue() const
Definition: Expr.h:251
clang::InitListExpr::end
iterator end()
Definition: Expr.h:4393
clang::NamedDecl::getIdentifier
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:270
clang::ArraySubscriptExpr::getBase
const Expr * getBase() const
Definition: Expr.h:2356
clang::Expr::IgnoreImpCasts
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Definition: Expr.h:3167
clang::ParenExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1875
clang::NoInitExpr::children
const_child_range children() const
Definition: Expr.h:4738
clang::AtomicExpr::AtomicOp
AtomicOp
Definition: Expr.h:5440
clang::DesignatedInitExpr::Designator::getDotLoc
SourceLocation getDotLoc() const
Definition: Expr.h:4566
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3593
clang::InitListExpr::const_reverse_iterator
InitExprsTy::const_reverse_iterator const_reverse_iterator
Definition: Expr.h:4389
clang::DesignatedInitExpr
Represents a C99 designated initializer expression.
Definition: Expr.h:4424
clang::AbstractConditionalOperator::AbstractConditionalOperator
AbstractConditionalOperator(StmtClass SC, EmptyShell Empty)
Definition: Expr.h:3559
clang::Expr::isOrdinaryOrBitFieldObject
bool isOrdinaryOrBitFieldObject() const
Definition: Expr.h:416
clang::NamedDecl::getDeclName
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:298
clang::UnaryExprOrTypeTraitExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2298
clang::StringLiteral::Create
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, SourceLocation Loc)
Simple constructor for string literals made from one token.
Definition: Expr.h:1638
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:58
clang::ConditionalOperator::getFalseExpr
Expr * getFalseExpr() const
Definition: Expr.h:3630
clang::OffsetOfNode::getField
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2077
clang::AtomicExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:5529
clang::AtomicScopeModelKind::None
clang::PseudoObjectExpr::children
child_range children()
Definition: Expr.h:5411
clang::AddrLabelExpr::AddrLabelExpr
AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L, QualType t)
Definition: Expr.h:3766
clang::InitListExpr::rend
const_reverse_iterator rend() const
Definition: Expr.h:4398
clang::ShuffleVectorExpr
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3851
clang::BinaryOperator::reverseComparisonOp
static Opcode reverseComparisonOp(Opcode Opc)
Definition: Expr.h:3398
clang::CompoundAssignOperator::getComputationResultType
QualType getComputationResultType() const
Definition: Expr.h:3535
clang::DesignatedInitExpr::Designator::isArrayRangeDesignator
bool isArrayRangeDesignator() const
Definition: Expr.h:4549
clang::Expr::Classification::CL_SubObjCPropertySetting
Definition: Expr.h:313
clang::IdentifierInfo::isStr
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Definition: IdentifierTable.h:137
clang::ParenExpr::getRParen
SourceLocation getRParen() const
Get the location of the right parentheses &#39;)&#39;.
Definition: Expr.h:1872
clang::OK_VectorComponent
A vector component is an element or range of elements on a vector.
Definition: Specifiers.h:132
clang::cast_away_const
StmtIterator cast_away_const(const ConstStmtIterator &RHS)
Definition: StmtIterator.h:152
clang::OffsetOfExpr::children
const_child_range children() const
Definition: Expr.h:2211
clang::Expr::Classification::CM_ConstAddrSpace
Definition: Expr.h:329
clang::InitListExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4368
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:237
clang::DesignatedInitExpr::getInit
Expr * getInit() const
Retrieve the initializer value.
Definition: Expr.h:4658
clang::ArraySubscriptExpr::setLHS
void setLHS(Expr *E)
Definition: Expr.h:2349
clang::ArraySubscriptExpr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
Definition: Expr.h:2373
clang::CompoundLiteralExpr::isFileScope
bool isFileScope() const
Definition: Expr.h:2960
clang::ImplicitCastExpr::TrailingObjects
friend TrailingObjects
Definition: Expr.h:3163
clang::ConditionalOperator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3635
clang::StringLiteral::isUTF8
bool isUTF8() const
Definition: Expr.h:1687
clang::FullExpr
FullExpr - Represents a "full-expression" node.
Definition: Expr.h:877
clang::CompoundLiteralExpr::children
child_range children()
Definition: Expr.h:2993
clang::Expr::LV_DuplicateVectorComponents
Definition: Expr.h:258
clang::AddrLabelExpr::getAmpAmpLoc
SourceLocation getAmpAmpLoc() const
Definition: Expr.h:3776
clang::SourceLocation::getFromRawEncoding
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Definition: SourceLocation.h:152
clang::Stmt::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:288
clang::ImplicitCastExpr::OnStack_t
OnStack_t
Definition: Expr.h:3133
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2579
clang::AsTypeExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5262
clang::VAArgExpr::setIsMicrosoftABI
void setIsMicrosoftABI(bool IsMS)
Definition: Expr.h:4120
clang::NoInitExpr
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4718
clang::ASTVector::empty
bool empty() const
Definition: ASTVector.h:109
clang::GNUNullExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4079
clang::UnaryOperator::UnaryOperator
UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow)
Definition: Expr.h:1902
clang::BinaryOperator::isPtrMemOp
static bool isPtrMemOp(Opcode Opc)
predicates to categorize the respective opcodes.
Definition: Expr.h:3359
clang::DesignatedInitExpr::Designator::isArrayDesignator
bool isArrayDesignator() const
Definition: Expr.h:4548
clang::UnaryExprOrTypeTrait
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:97
clang::UnaryOperator::isIncrementDecrementOp
static bool isIncrementDecrementOp(Opcode Op)
Definition: Expr.h:1969
clang::OffsetOfNode::getArrayExprIndex
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2071
clang::AddrLabelExpr::getLabelLoc
SourceLocation getLabelLoc() const
Definition: Expr.h:3778
clang::ExtVectorElementExpr::ExtVectorElementExpr
ExtVectorElementExpr(EmptyShell Empty)
Build an empty vector element expression.
Definition: Expr.h:5136
clang::MemberExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
Definition: Expr.h:2839
clang::UnaryOperator::UnaryOperator
UnaryOperator(EmptyShell Empty)
Build an empty unary operator.
Definition: Expr.h:1917
clang::PseudoObjectExpr::getResultExpr
const Expr * getResultExpr() const
Definition: Expr.h:5364
clang::InitListExpr::getRBraceLoc
SourceLocation getRBraceLoc() const
Definition: Expr.h:4337
clang::UnaryExprOrTypeTraitExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Definition: Expr.h:2289
clang::MemberExpr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
Definition: Expr.h:2890
clang::CallExpr::getNumCommas
unsigned getNumCommas() const
getNumCommas - Return the number of commas that must have been present in this function call...
Definition: Expr.h:2616
clang::CStyleCastExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3266
clang::GNUNullExpr
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4062
clang::Type::isReferenceType
bool isReferenceType() const
Definition: Type.h:6308
clang::CStyleCastExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:3258
clang::CallExpr::setArg
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: Expr.h:2563
clang::BinaryOperator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3340
clang::FloatingLiteral::children
child_range children()
Definition: Expr.h:1504
clang::GNUNullExpr::children
child_range children()
Definition: Expr.h:4087
clang::CharacterLiteral::children
child_range children()
Definition: Expr.h:1437
clang::CallExpr::shrinkNumArgs
void shrinkNumArgs(unsigned NewNumArgs)
Reduce the number of arguments in this call expression.
Definition: Expr.h:2574
clang::ParenExpr::setRParen
void setRParen(SourceLocation Loc)
Definition: Expr.h:1873
clang::GNUNullExpr::GNUNullExpr
GNUNullExpr(EmptyShell Empty)
Build an empty GNU __null expression.
Definition: Expr.h:4073
clang::FixedPointLiteral
Definition: Expr.h:1351
clang::ArrayInitLoopExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4841
clang::OpaqueValueExpr::getSourceExpr
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1003
clang::SubobjectAdjustment::P::RHS
Expr * RHS
Definition: Expr.h:75
clang::ParenExpr::children
const_child_range children() const
Definition: Expr.h:1881
clang::CharacterLiteral::children
const_child_range children() const
Definition: Expr.h:1440
clang::ExtVectorElementExpr
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5121
clang::NoInitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4731
clang::Expr::ClassifyModifiable
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const
ClassifyModifiable - Classify this expression according to the C++11 expression taxonomy, and see if it is valid on the left side of an assignment.
Definition: Expr.h:389
clang::CastExpr::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:3055
clang::AtomicExpr::getScopeModel
std::unique_ptr< AtomicScopeModel > getScopeModel() const
Get atomic scope model.
Definition: Expr.h:5560
clang::VAArgExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4131
clang::AbstractConditionalOperator::getQuestionLoc
SourceLocation getQuestionLoc() const
Definition: Expr.h:3576
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:50
clang::OffsetOfExpr::setComponent
void setComponent(unsigned Idx, OffsetOfNode ON)
Definition: Expr.h:2171
clang::UnaryExprOrTypeTraitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:2296
clang::GNUNullExpr::children
const_child_range children() const
Definition: Expr.h:4090
clang::StringLiteral::getCharByteWidth
unsigned getCharByteWidth() const
Definition: Expr.h:1679
clang::ArrayInitIndexExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4876
clang::ArraySubscriptExpr::getRHS
Expr * getRHS()
Definition: Expr.h:2351
clang::BinaryOperator::isAssignmentOp
bool isAssignmentOp() const
Definition: Expr.h:3418
clang::GNUNullExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4080
clang::MemberExprNameQualifier::QualifierLoc
NestedNameSpecifierLoc QualifierLoc
The nested-name-specifier that qualifies the name, including source-location information.
Definition: Expr.h:2678
clang::StmtExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3832
llvm::SmallVectorImpl
Definition: LLVM.h:37
clang::DesignatedInitUpdateExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4769
clang::InitListExpr::hadArrayRangeDesignator
bool hadArrayRangeDesignator() const
Definition: Expr.h:4358
clang::VK_RValue
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:110
clang::IntegerLiteral::children
child_range children()
Definition: Expr.h:1343
clang::PseudoObjectExpr::const_semantics_iterator
const Expr *const * const_semantics_iterator
Definition: Expr.h:5371
clang::PseudoObjectExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5423
clang::NoInitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4732
clang::FullExpr::setSubExpr
void setSubExpr(Expr *E)
As with any mutator of the AST, be very careful when modifying an existing AST to preserve its invari...
Definition: Expr.h:895
clang::BinaryOperator::isRelationalOp
static bool isRelationalOp(Opcode Opc)
Definition: Expr.h:3376
clang::InitListExpr::getInits
Expr *const * getInits() const
Retrieve the set of initializers.
Definition: Expr.h:4226
clang::InitListExpr::setLBraceLoc
void setLBraceLoc(SourceLocation Loc)
Definition: Expr.h:4336
clang::BinaryOperator::getOpcodeStr
StringRef getOpcodeStr() const
Definition: Expr.h:3348
clang::Expr::isGLValue
bool isGLValue() const
Definition: Expr.h:252
clang::AsTypeExpr::children
const_child_range children() const
Definition: Expr.h:5271
clang::Expr::MLV_MemberFunction
Definition: Expr.h:282
clang::DeclRefExpr::copyTemplateArgumentsInto
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition: Expr.h:1199
clang::InitListExpr
Describes an C or C++ initializer list.
Definition: Expr.h:4190
clang::ConvertVectorExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3960
clang::AsTypeExpr::AsTypeExpr
AsTypeExpr(Expr *SrcExpr, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Definition: Expr.h:5241
clang::APIntStorage::setValue
void setValue(const ASTContext &C, const llvm::APInt &Val)
Definition: Expr.h:1293
clang::ShuffleVectorExpr::setBuiltinLoc
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:3870
clang::BinaryOperatorKind
BinaryOperatorKind
Definition: OperationKinds.h:26
clang::UnaryOperator::isPostfix
bool isPostfix() const
Definition: Expr.h:1953
clang::ParenExpr::setSubExpr
void setSubExpr(Expr *E)
Definition: Expr.h:1862
clang::IntegerLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1330
clang::Expr::EvalStatus::Diag
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
Definition: Expr.h:558
clang::ChooseExpr::setLHS
void setLHS(Expr *E)
Definition: Expr.h:4030
clang::ConvertVectorExpr::children
child_range children()
Definition: Expr.h:3967
clang::StringLiteral::getLength
unsigned getLength() const
Definition: Expr.h:1678
clang::BinaryOperator::isEqualityOp
static bool isEqualityOp(Opcode Opc)
Definition: Expr.h:3379
clang::DesignatedInitExpr::Designator::getFirstExprIndex
unsigned getFirstExprIndex() const
Definition: Expr.h:4594
clang::Expr::refersToBitField
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
Definition: Expr.h:437
clang::DeclAccessPair::make
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
Definition: DeclAccessPair.h:36
clang::Expr::Classification::CL_ClassTemporary
Definition: Expr.h:314
clang::PredefinedExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1831
APValue.h
clang::Expr::EvalResult::Val
APValue Val
Val - This is the value the expression can be folded to.
Definition: Expr.h:573
clang::TemplateArgumentListInfo
A convenient class for passing around template argument information.
Definition: TemplateBase.h:555
clang::Expr::MLV_InvalidExpression
Definition: Expr.h:274
clang::Expr::LV_Valid
Definition: Expr.h:255
clang::AtomicExpr::getPtr
Expr * getPtr() const
Definition: Expr.h:5470
clang::FixedPointLiteral::children
child_range children()
Definition: Expr.h:1384
clang::FloatingLiteral::getRawSemantics
APFloatSemantics getRawSemantics() const
Get a raw enumeration value representing the floating-point semantics of this literal (32-bit IEEE...
Definition: Expr.h:1469
clang::PredefinedExpr::PrettyFunction
Definition: Expr.h:1776
clang::SubobjectAdjustment::FieldAdjustment
Definition: Expr.h:64
clang::CharacterLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1432
clang::DeclRefExpr::children
child_range children()
Definition: Expr.h:1248
clang::Expr::Classification::CL_DuplicateVectorComponents
Definition: Expr.h:311
clang::OffsetOfNode::OffsetOfNode
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc)
Create an offsetof node that refers to an array element.
Definition: Expr.h:2047
clang::Expr::getValueKind
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:405
clang::VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:119
clang::ComparisonCategoryType::First
clang::CastExpr::path_begin
path_iterator path_begin()
Definition: Expr.h:3075
clang::CallExpr::getArg
const Expr * getArg(unsigned Arg) const
Definition: Expr.h:2557
clang::CallExpr::children
child_range children()
Definition: Expr.h:2662
clang::OffsetOfNode::OffsetOfNode
OffsetOfNode(const CXXBaseSpecifier *Base)
Create an offsetof node that refers into a C++ base class.
Definition: Expr.h:2063
clang::Expr::NullPointerConstantValueDependence
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
Definition: Expr.h:709
clang::ImaginaryLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1538
clang::CallExpr::getNumPreArgs
unsigned getNumPreArgs() const
Definition: Expr.h:2477
clang::ArrayInitLoopExpr::classof
static bool classof(const Stmt *S)
Definition: Expr.h:4837
clang::PseudoObjectExpr::semantics_end
semantics_iterator semantics_end()
Definition: Expr.h:5378
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3292
clang::VAArgExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4134
clang::TypoExpr::TypoExpr
TypoExpr(QualType T)
Definition: Expr.h:5569
clang::GenericSelectionExpr::getAssocExpr
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:5048
clang::StringLiteral::tokloc_end
tokloc_iterator tokloc_end() const
Definition: Expr.h:1737
clang::DesignatedInitExpr::ArrayOrRangeDesignator::RBracketLoc
unsigned RBracketLoc
The location of the &#39;]&#39; terminating the array range designator.
Definition: Expr.h:4490
clang::MemberExpr::template_arguments
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: Expr.h:2867
clang::ExtVectorElementExpr::setAccessor
void setAccessor(IdentifierInfo *II)
Definition: Expr.h:5144
clang::MemberExpr::hadMultipleCandidates
bool hadMultipleCandidates() const
Returns true if this member expression refers to a method that was resolved from an overloaded set ha...
Definition: Expr.h:2899
clang::PseudoObjectExpr::getResultExprIndex
unsigned getResultExprIndex() const
Return the index of the result-bearing expression into the semantics expressions, or PseudoObjectExpr...
Definition: Expr.h:5353
clang::UnaryOperator::isPostfix
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1943
clang::ArraySubscriptExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2377
clang::Expr::Classification::CM_Modifiable
Definition: Expr.h:322
clang::InitListExpr::children
child_range children()
Definition: Expr.h:4373
clang::MemberExpr::isArrow
bool isArrow() const
Definition: Expr.h:2879
clang::ChooseExpr::ChooseExpr
ChooseExpr(EmptyShell Empty)
Build an empty __builtin_choose_expr.
Definition: Expr.h:4006
clang::AddrLabelExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3787
clang::BinaryOperator::isFPContractableWithinStatement
bool isFPContractableWithinStatement() const
Definition: Expr.h:3472
clang::DesignatedInitExpr::getEqualOrColonLoc
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the &#39;=&#39; that precedes the initializer value itself, if present.
Definition: Expr.h:4649
clang::Expr::MLV_IncompleteVoidType
Definition: Expr.h:272
clang::BinaryOperator::BinaryOperator
BinaryOperator(EmptyShell Empty)
Construct an empty binary operator.
Definition: Expr.h:3319
clang::StringLiteral::StringKind
StringKind
StringLiteral is followed by several trailing objects.
Definition: Expr.h:1588
clang::ArrayInitIndexExpr::children
child_range children()
Definition: Expr.h:4879
clang::TypoExpr
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5567
clang::Expr::MLV_ArrayType
Definition: Expr.h:280
clang::ImplicitValueInitExpr::children
const_child_range children() const
Definition: Expr.h:4919
clang::OffsetOfExpr::setOperatorLoc
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:2153
clang::ParenListExpr
Definition: Expr.h:4924
clang::FPOptions::getInt
unsigned getInt() const
Used to serialize this.
Definition: LangOptions.h:352
clang::BinaryOperator::isRelationalOp
bool isRelationalOp() const
Definition: Expr.h:3377
clang::SubobjectAdjustment
An adjustment to be made to the temporary created when emitting a reference binding, which accesses a particular subobject of that temporary.
Definition: Expr.h:61
clang::GenericSelectionExpr::getControllingExpr
const Expr * getControllingExpr() const
Definition: Expr.h:5073
clang::CastExpr
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3003
clang::OffsetOfNode
Helper class for OffsetOfExpr.
Definition: Expr.h:2013
clang::VAArgExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4125
clang::Expr::Classification::CL_XValue
Definition: Expr.h:307
clang::UnaryOperator::setOpcode
void setOpcode(Opcode Opc)
Definition: Expr.h:1924
clang::CompoundLiteralExpr::getInitializer
Expr * getInitializer()
Definition: Expr.h:2957
clang::DeclRefExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
Definition: Expr.h:1133
clang::Expr::isTypeDependent
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.
Definition: Expr.h:167
clang::OK_Ordinary
An ordinary object is located at an address in memory.
Definition: Specifiers.h:126
clang::FloatingLiteral
Definition: Expr.h:1445
clang::UnaryOperator::getOperatorLoc
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:1930
llvm::ArrayRef
Definition: LLVM.h:32
clang::AtomicExpr::isCmpXChg
bool isCmpXChg() const
Definition: Expr.h:5514
clang::Stmt::StmtClass
StmtClass
Definition: Stmt.h:68
clang::OffsetOfExpr::setRParenLoc
void setRParenLoc(SourceLocation R)
Definition: Expr.h:2157
clang::PredefinedExpr::getEndLoc
SourceLocation getEndLoc() const
Definition: Expr.h:1829
clang::Expr::Classification::makeSimpleLValue
static Classification makeSimpleLValue()
Create a simple, modifiably lvalue.
Definition: Expr.h:360
clang::ArraySubscriptExpr::getIdx
Expr * getIdx()
Definition: Expr.h:2358
clang::FloatingLiteral::isExact
bool isExact() const
Definition: Expr.h:1485
clang::Expr::Classification::CM_RValue
Definition: Expr.h:323
clang::GNUNullExpr::GNUNullExpr
GNUNullExpr(QualType Ty, SourceLocation Loc)
Definition: Expr.h:4067
clang::ConditionalOperator::children
child_range children()
Definition: Expr.h:3647
clang::ConvertVectorExpr::ConvertVectorExpr
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Definition: Expr.h:3930
clang::Expr::MLV_ClassTemporary
Definition: Expr.h:285
clang::GNUNullExpr::getTokenLocation
SourceLocation getTokenLocation() const
getTokenLocation - The location of the __null token.
Definition: Expr.h:4076
clang::Stmt::ExprIterator
Iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:983
clang::CStyleCastExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3259
clang::APNumericStorage::pVal
uint64_t * pVal
Used to store the >64 bits integer value.
Definition: Expr.h:1268
clang::BinaryConditionalOperator::children
const_child_range children() const
Definition: Expr.h:3738
clang::CallExpr::arg_end
arg_iterator arg_end()
Definition: Expr.h:2598
clang::CastExpr::setCastKind
void setCastKind(CastKind K)
Definition: Expr.h:3050
clang::Expr::Classification::CL_Void
Definition: Expr.h:309
clang::APIntStorage
Definition: Expr.h:1290
clang::MemberExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:2797
DeclAccessPair.h
clang::ASTVector::iterator
T * iterator
Definition: ASTVector.h:86
clang::OffsetOfExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:2199
clang::FloatingLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1497
clang::ShuffleVectorExpr::getSubExprs
Expr ** getSubExprs()
Retrieve the array of expressions.
Definition: Expr.h:3888
clang::FullExpr::FullExpr
FullExpr(StmtClass SC, EmptyShell Empty)
Definition: Expr.h:887
clang::ChooseExpr::ChooseExpr
ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation RP, bool condIsTrue, bool TypeDependent, bool ValueDependent)
Definition: Expr.h:3988
clang::ParenExpr::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:1861
clang::GenericSelectionExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5097
clang::DesignatedInitExpr::setEqualOrColonLoc
void setEqualOrColonLoc(SourceLocation L)
Definition: Expr.h:4650
clang::DesignatedInitExpr::Designator::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: Expr.h:4588
clang::ArraySubscriptExpr::getLHS
const Expr * getLHS() const
Definition: Expr.h:2348
clang::UnaryExprOrTypeTraitExpr::setArgument
void setArgument(Expr *E)
Definition: Expr.h:2274
clang::ExplicitCastExpr::getTypeAsWritten
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:3218
clang::OffsetOfExpr::setTypeSourceInfo
void setTypeSourceInfo(TypeSourceInfo *tsi)
Definition: Expr.h:2162
clang::BinaryOperator::negateComparisonOp
static Opcode negateComparisonOp(Opcode Opc)
Definition: Expr.h:3385
clang::ArraySubscriptExpr::getEndLoc
SourceLocation getEndLoc() const
Definition: Expr.h:2364
clang::CallExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2656
clang::ShuffleVectorExpr::getExpr
const Expr * getExpr(unsigned Index) const
Definition: Expr.h:3895
clang::ConditionalOperator
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3587
clang::Stmt::ConstExprIterator
Const iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:997
clang::AtomicExpr::getScope
Expr * getScope() const
Definition: Expr.h:5476
clang::DesignatedInitExpr::Designator::setField
void setField(FieldDecl *FD)
Definition: Expr.h:4561
clang::StringLiteral::getString
StringRef getString() const
Definition: Expr.h:1649
clang::ParenExpr::ParenExpr
ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
Definition: Expr.h:1848
clang::AddrLabelExpr::setAmpAmpLoc
void setAmpAmpLoc(SourceLocation L)
Definition: Expr.h:3777
clang::Stmt::const_child_range
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1099
CharInfo.h
clang::CompoundStmt
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1241
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3687
clang::BlockExpr::setBlockDecl
void setBlockDecl(BlockDecl *BD)
Definition: Expr.h:5198
clang::ASTStmtWriter
Definition: ASTWriterStmt.cpp:31
clang::VAArgExpr::isMicrosoftABI
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
Definition: Expr.h:4119
clang::ArrayInitIndexExpr::ArrayInitIndexExpr
ArrayInitIndexExpr(QualType T)
Definition: Expr.h:4868
clang::AtomicExpr::getSubExprs
Expr ** getSubExprs()
Definition: Expr.h:5505
clang::SubobjectAdjustment::SubobjectAdjustment
SubobjectAdjustment(FieldDecl *Field)
Definition: Expr.h:91
clang::MemberExpr::copyTemplateArgumentsInto
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments (if present) into the given structure.
Definition: Expr.h:2843
clang::CompoundAssignOperator::getComputationLHSType
QualType getComputationLHSType() const
Definition: Expr.h:3532
clang::CastKind
CastKind
CastKind - The kind of operation required for a conversion.
Definition: OperationKinds.h:21
clang::MemberExpr::getQualifier
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:2806
clang::Expr::Classification
The return type of classify().
Definition: Expr.h:302
clang::Expr::IgnoreParenCasts
const Expr * IgnoreParenCasts() const LLVM_READONLY
Definition: Expr.h:826
clang::PseudoObjectExpr::semantics_begin
const_semantics_iterator semantics_begin() const
Definition: Expr.h:5375
clang::APNumericStorage
Used by IntegerLiteral/FloatingLiteral to store the numeric without leaking memory.
Definition: Expr.h:1265
clang::AtomicExpr::getScopeModel
static std::unique_ptr< AtomicScopeModel > getScopeModel(AtomicOp Op)
Get atomic scope model for the atomic op code.
Definition: Expr.h:5549
clang::OffsetOfNode::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:2099
clang::UnaryOperator::setSubExpr
void setSubExpr(Expr *E)
Definition: Expr.h:1927
clang::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2222
clang::Expr::MLV_InvalidMessageExpression
Definition: Expr.h:284
clang::ASTVector::end
iterator end()
Definition: ASTVector.h:100
clang::ParenExpr::setLParen
void setLParen(SourceLocation Loc)
Definition: Expr.h:1869
clang::Expr::IgnoreImplicit
const Expr * IgnoreImplicit() const LLVM_READONLY
Definition: Expr.h:751
clang::APNumericStorage::getIntValue
llvm::APInt getIntValue() const
Definition: Expr.h:1280
clang::DeclRefExpr::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1122
clang::DesignatedInitUpdateExpr::getUpdater
InitListExpr * getUpdater() const
Definition: Expr.h:4776
clang::ConditionalOperator::ConditionalOperator
ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs, SourceLocation CLoc, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK)
Definition: Expr.h:3593
clang::ConstantExpr
ConstantExpr - An expression that occurs in a constant context.
Definition: Expr.h:904
clang::Expr::EvalStatus::HasUndefinedBehavior
bool HasUndefinedBehavior
Whether the evaluation hit undefined behavior.
Definition: Expr.h:549
clang::VAArgExpr
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4096
clang::AbstractConditionalOperator::getCond
Expr * getCond() const
Definition: Expr.h:3743
clang::Expr::Classification::Kinds
Kinds
The various classification results. Most of these mean prvalue.
Definition: Expr.h:305
clang::UnaryOperator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1994
clang::CharacterLiteral::getValue
unsigned getValue() const
Definition: Expr.h:1426
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:54
clang::AsTypeExpr::getSrcExpr
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:5254
clang::CompoundAssignOperator::CompoundAssignOperator
CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResType, ExprValueKind VK, ExprObjectKind OK, QualType CompLHSType, QualType CompResultType, SourceLocation OpLoc, FPOptions FPFeatures)
Definition: Expr.h:3513
clang::ShuffleVectorExpr::getShuffleMaskIdx
llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const
Definition: Expr.h:3902
clang::CallExpr::getADLCallKind
ADLCallKind getADLCallKind() const
Definition: Expr.h:2518
clang::ShuffleVectorExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3875
clang::UnaryOperator::children
const_child_range children() const
Definition: Expr.h:2005
clang::StmtExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3827
clang::CharacterLiteral::setLocation
void setLocation(SourceLocation Location)
Definition: Expr.h:1428
clang::ConditionalOperator::getCond
Expr * getCond() const
Definition: Expr.h:3621
clang::CallExpr::arguments
const_arg_range arguments() const
Definition: Expr.h:2591
clang::BlockDecl
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3858
clang::DesignatedInitExpr::designators
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:4627
clang::StringLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1744
clang::MemberExpr::getFoundDecl
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition: Expr.h:2782
clang::PredefinedExpr::LFunction
Definition: Expr.h:1772
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:637
clang::Expr
This represents one expression.
Definition: Expr.h:106
LangOptions.h
Defines the clang::LangOptions interface.
clang::InitListExpr::setRBraceLoc
void setRBraceLoc(SourceLocation Loc)
Definition: Expr.h:4338
clang::ShuffleVectorExpr::children
const_child_range children() const
Definition: Expr.h:3911
clang::ExprValueKind
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:107
clang::ShuffleVectorExpr::children
child_range children()
Definition: Expr.h:3908
clang::CallExpr::setCallee
void setCallee(Expr *F)
Definition: Expr.h:2516
llvm::MutableArrayRef
Definition: LLVM.h:33
Label
std::string Label
Definition: UsingDeclarationsSorter.cpp:70
clang::PseudoObjectExpr::getSyntacticForm
const Expr * getSyntacticForm() const
Definition: Expr.h:5349
clang::ArrayInitLoopExpr::children
const_child_range children() const
Definition: Expr.h:4851
clang::OffsetOfNode::getBase
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
Definition: Expr.h:2087
clang::ShuffleVectorExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:3873
clang::ArraySubscriptExpr::getRHS
const Expr * getRHS() const
Definition: Expr.h:2352
clang::DeclRefExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1243
clang::DesignatedInitUpdateExpr::setBase
void setBase(Expr *Base)
Definition: Expr.h:4774
clang::InitListExpr::setSyntacticForm
void setSyntacticForm(InitListExpr *Init)
Definition: Expr.h:4351
clang::DesignatedInitUpdateExpr
Definition: Expr.h:4754
clang::Expr::Classification::CL_LValue
Definition: Expr.h:306
clang::CompoundLiteralExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:2981
clang::ImaginaryLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1536
clang::MemberExpr::setMemberLoc
void setMemberLoc(SourceLocation L)
Definition: Expr.h:2885
clang::NoInitExpr::NoInitExpr
NoInitExpr(QualType ty)
Definition: Expr.h:4720
clang::Expr::setTypeDependent
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
Definition: Expr.h:170
clang::GenericSelectionExpr::getAssocTypeSourceInfo
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
Definition: Expr.h:5058
clang::BlockExpr
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5182
clang::CallExpr::getCallee
Expr * getCallee()
Definition: Expr.h:2514
clang::DesignatedInitExpr::Designator::isFieldDesignator
bool isFieldDesignator() const
Definition: Expr.h:4547
clang::InitListExpr::getNumInits
unsigned getNumInits() const
Definition: Expr.h:4220
clang::DesignatedInitExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4692
clang::ArrayInitLoopExpr::getSubExpr
Expr * getSubExpr() const
Get the initializer to use for each array element.
Definition: Expr.h:4830
clang::PredefinedExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: Expr.h:1828
clang::CallExpr::getCallee
const Expr * getCallee() const
Definition: Expr.h:2515
clang::Expr::MLV_SubObjCPropertySetting
Definition: Expr.h:283
clang::BinaryOperator::setRHS
void setRHS(Expr *E)
Definition: Expr.h:3335
clang::PseudoObjectExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5407
clang::DesignatedInitExpr::ArrayOrRangeDesignator
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
Definition: Expr.h:4480
clang::CallExpr::getPreArg
Stmt * getPreArg(unsigned I)
Definition: Expr.h:2464
clang::Expr::skipRValueSubobjectAdjustments
const Expr * skipRValueSubobjectAdjustments() const
Definition: Expr.h:860
clang::ConvertVectorExpr::setTypeSourceInfo
void setTypeSourceInfo(TypeSourceInfo *ti)
Definition: Expr.h:3949
clang::InitListExpr::end
const_iterator end() const
Definition: Expr.h:4394
clang::StringLiteral::children
const_child_range children() const
Definition: Expr.h:1752
clang::UnaryExprOrTypeTraitExpr::getArgumentType
QualType getArgumentType() const
Definition: Expr.h:2259
bool
#define bool
Definition: stdbool.h:31
clang::SubobjectAdjustment::DerivedToBase
struct DTB DerivedToBase
Definition: Expr.h:79
clang::MemberExpr::performsVirtualDispatch
bool performsVirtualDispatch(const LangOptions &LO) const
Returns true if virtual dispatch is performed.
Definition: Expr.h:2913
clang::VAArgExpr::setWrittenTypeInfo
void setWrittenTypeInfo(TypeSourceInfo *TI)
Definition: Expr.h:4123
clang::AtomicExpr::getOrder
Expr * getOrder() const
Definition: Expr.h:5473
clang::ParenListExpr::children
child_range children()
Definition: Expr.h:4979
clang::ParenListExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:4969
clang::ParenExpr::ParenExpr
ParenExpr(EmptyShell Empty)
Construct an empty parenthesized expression.
Definition: Expr.h:1857
clang::StringLiteral::getCodeUnit
uint32_t getCodeUnit(size_t i) const
Definition: Expr.h:1664
clang::Expr::setObjectKind
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
Definition: Expr.h:425
clang::DeclRefExpr::hasQualifier
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
Definition: Expr.h:1129
clang::VAArgExpr::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:4115
clang::DesignatedInitUpdateExpr::children
child_range children()
Definition: Expr.h:4783
clang::OffsetOfExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2159
clang::DesignatedInitExpr::size
unsigned size() const
Returns the number of designators in this initializer.
Definition: Expr.h:4624
clang::AsTypeExpr
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:5231
clang::ConditionalOperator::children
const_child_range children() const
Definition: Expr.h:3650
clang::CallExpr::getDirectCallee
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
Definition: Expr.h:2532
clang::DeclRefExpr::refersToEnclosingVariableOrCapture
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Definition: Expr.h:1239
clang::ExtVectorElementExpr::getAccessor
IdentifierInfo & getAccessor() const
Definition: Expr.h:5143
EvaluateAsBooleanCondition
static bool EvaluateAsBooleanCondition(const Expr *E, bool &Result, EvalInfo &Info)
Definition: ExprConstant.cpp:2057
clang::BinaryOperator::BinaryOperator
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptions FPFeatures, bool dead2)
Definition: Expr.h:3481
clang::DeclRefExpr::getDecl
const ValueDecl * getDecl() const
Definition: Expr.h:1115
clang::InitListExpr::inits
ArrayRef< Expr * > inits()
Definition: Expr.h:4230
clang::ArraySubscriptExpr::ArraySubscriptExpr
ArraySubscriptExpr(EmptyShell Shell)
Create an empty array subscript expression.
Definition: Expr.h:2335
clang::SubobjectAdjustment::DTB
Definition: Expr.h:68
clang::StringLiteral::children
child_range children()
Definition: Expr.h:1749
clang::Expr::NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
Definition: Expr.h:715
clang::MemberExprNameQualifier
Extra data stored in some MemberExpr objects.
Definition: Expr.h:2675
clang::GenericSelectionExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5094
clang::OffsetOfNode::getKind
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2067
clang::MemberExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: Expr.h:2820
clang::Expr::getType
QualType getType() const
Definition: Expr.h:128
clang::GenericSelectionExpr::getAssocExprs
ArrayRef< Expr * > getAssocExprs() const
Definition: Expr.h:5052
clang::UnaryExprOrTypeTraitExpr::getTypeOfArgument
QualType getTypeOfArgument() const
Gets the argument type, or the type of the argument expression, whichever is appropriate.
Definition: Expr.h:2285
clang::AtomicExpr::isVolatile
bool isVolatile() const
Definition: Expr.h:5510
clang::StringLiteral::isWide
bool isWide() const
Definition: Expr.h:1686
clang::PseudoObjectExpr::semantics_end
const_semantics_iterator semantics_end() const
Definition: Expr.h:5381
Stmt.h
clang::Expr::setValueKind
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
Definition: Expr.h:422
clang::AtomicExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5532
clang::CreateEmpty
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
clang::AsTypeExpr::getRParenLoc
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:5260
clang::MemberExpr::setMemberDecl
void setMemberDecl(ValueDecl *D)
Definition: Expr.h:2779
clang::ParenListExpr::children
const_child_range children() const
Definition: Expr.h:4983
clang::BlockExpr::children
const_child_range children() const
Definition: Expr.h:5223
clang::Expr::Classification::ModifiableType
ModifiableType
The results of modification testing.
Definition: Expr.h:320
clang::ChooseExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:4038
clang::DesignatedInitExpr::Designator::getLBracketLoc
SourceLocation getLBracketLoc() const
Definition: Expr.h:4576
clang::ArraySubscriptExpr::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: Expr.h:2366
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:208
clang::AddrLabelExpr::children
const_child_range children() const
Definition: Expr.h:3795
clang::UnaryOperator
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1896
clang::DesignatedInitExpr::ArrayOrRangeDesignator::Index
unsigned Index
Location of the first index expression within the designated initializer expression&#39;s list of subexpr...
Definition: Expr.h:4483
clang::MemberExpr::getMemberLoc
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of &#39;F&#39;...
Definition: Expr.h:2884
clang::IntegerLiteral::children
const_child_range children() const
Definition: Expr.h:1346
clang::DesignatedInitExpr::usesGNUSyntax
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:4654
clang::AtomicExpr::getOp
AtomicOp getOp() const
Definition: Expr.h:5502
clang::Expr::LV_MemberFunction
Definition: Expr.h:261
EvaluateAsInt
static bool EvaluateAsInt(const Expr *E, Expr::EvalResult &ExprResult, const ASTContext &Ctx, Expr::SideEffectsKind AllowSideEffects, EvalInfo &Info)
Definition: ExprConstant.cpp:10916
clang::InitListExpr::inits
ArrayRef< Expr * > inits() const
Definition: Expr.h:4234
clang::DesignatedInitExpr::Designator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4600
clang::BinaryConditionalOperator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3726
clang::CallExpr::arg_end
const_arg_iterator arg_end() const
Definition: Expr.h:2603
clang::CStyleCastExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3262
clang::OffsetOfExpr::getComponent
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2166
clang::BinaryConditionalOperator::getTrueExpr
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
Definition: Expr.h:3712
clang::DeclRefExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition: Expr.h:1167
clang::AbstractConditionalOperator::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3579
clang::DeclRefExpr::getDecl
ValueDecl * getDecl()
Definition: Expr.h:1114
clang::AtomicExpr::children
child_range children()
Definition: Expr.h:5539
clang::PredefinedExpr::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1810
clang::AbstractConditionalOperator::getTrueExpr
Expr * getTrueExpr() const
Definition: Expr.h:3749
clang::ConstantExpr::children
child_range children()
Definition: Expr.h:930
clang::VAArgExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4128
clang::ComparisonCategoryType::Last
clang::ObjCSubstitutionContext::Result
The result type of a method or function.
clang::DesignatedInitExpr::Designator::Designator
Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
Initializes a GNU array-range designator.
Definition: Expr.h:4538
clang::PredefinedExpr::IdentKind
IdentKind
Definition: Expr.h:1769
clang::ParenExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:1860
clang::CStyleCastExpr
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
Definition: Expr.h:3229
clang::PseudoObjectExpr::semantics
llvm::iterator_range< semantics_iterator > semantics()
Definition: Expr.h:5385
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:703
clang::APNumericStorage::APNumericStorage
APNumericStorage()
Definition: Expr.h:1278
clang::ArraySubscriptExpr::getLHS
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2347
clang::ASTVector::rend
reverse_iterator rend()
Definition: ASTVector.h:106
clang::OpaqueValueExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1013
clang::DeclRefExpr::hadMultipleCandidates
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
Definition: Expr.h:1227
clang::FixedPointLiteral::children
const_child_range children() const
Definition: Expr.h:1387
SM
const SourceManager & SM
Definition: Format.cpp:1490
uintptr_t
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:90
clang::ConvertVectorExpr::children
const_child_range children() const
Definition: Expr.h:3968
clang::PseudoObjectExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5404
clang::ExplicitCastExpr::ExplicitCastExpr
ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, TypeSourceInfo *writtenTy)
Definition: Expr.h:3201
clang::MemberExpr::children
child_range children()
Definition: Expr.h:2922
clang::ImaginaryLiteral
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1517
clang::VAArgExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4132
clang::GenericSelectionExpr::getAssocTypeSourceInfos
ArrayRef< TypeSourceInfo * > getAssocTypeSourceInfos() const
Definition: Expr.h:5062
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:301
clang::VAArgExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:4129
clang::UnaryOperator::isDecrementOp
bool isDecrementOp() const
Definition: Expr.h:1965
clang::Expr::getObjectKind
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:412
clang::TypoExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5588
clang::Expr::SideEffectsKind
SideEffectsKind
Definition: Expr.h:595
clang::ConstantExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:918
clang::BinaryOperator::isComparisonOp
bool isComparisonOp() const
Definition: Expr.h:3383
clang::BinaryOperator::isBitwiseOp
static bool isBitwiseOp(Opcode Opc)
Definition: Expr.h:3373
clang::Expr::IgnoreConversionOperator
const Expr * IgnoreConversionOperator() const LLVM_READONLY
Definition: Expr.h:776
clang::AtomicExpr::children
const_child_range children() const
Definition: Expr.h:5542
clang::FixedPointLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1377
clang::StmtIterator
Definition: StmtIterator.h:125
clang::CompoundLiteralExpr::setTypeSourceInfo
void setTypeSourceInfo(TypeSourceInfo *tinfo)
Definition: Expr.h:2969
clang::AsTypeExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5265
clang::DesignatedInitExpr::FieldDesignator::DotLoc
unsigned DotLoc
The location of the &#39;.&#39; in the designated initializer.
Definition: Expr.h:4473
clang::UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
Definition: Expr.h:2230
clang::OpaqueValueExpr
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:945
clang::CompoundAssignOperator::setComputationLHSType
void setComputationLHSType(QualType T)
Definition: Expr.h:3533
clang::DesignatedInitUpdateExpr::getBase
Expr * getBase() const
Definition: Expr.h:4773
clang::ConvertVectorExpr
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:3919
clang::CallExpr::getPreArg
const Stmt * getPreArg(unsigned I) const
Definition: Expr.h:2468
false
#define false
Definition: stdbool.h:33
clang::Expr::Classification::CM_LValueCast
Definition: Expr.h:325
clang::CompoundLiteralExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:2963
Kind
Kind
Definition: ChrootChecker.cpp:29
clang::DesignatedInitUpdateExpr::DesignatedInitUpdateExpr
DesignatedInitUpdateExpr(EmptyShell Empty)
Definition: Expr.h:4763
clang::CastExpr::path_size
unsigned path_size() const
Definition: Expr.h:3074
clang::PseudoObjectExpr
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5304
clang::CStyleCastExpr::setLParenLoc
void setLParenLoc(SourceLocation L)
Definition: Expr.h:3256
clang::CXXCastPath
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:54
clang::Expr::isInstantiationDependent
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:191
clang::PseudoObjectExpr::TrailingObjects
friend TrailingObjects
Definition: Expr.h:5427
clang::StmtExpr::getSubStmt
const CompoundStmt * getSubStmt() const
Definition: Expr.h:3823
clang::ImaginaryLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1533
clang::DeclRefExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: Expr.h:1183
clang::CallExpr::const_arg_iterator
ConstExprIterator const_arg_iterator
Definition: Expr.h:2586
clang::OffsetOfExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:2200
clang::ExtVectorElementExpr::setAccessorLoc
void setAccessorLoc(SourceLocation L)
Definition: Expr.h:5147
clang::Expr::MLV_NotObjectType
Definition: Expr.h:271
clang::OpaqueValueExpr::children
const_child_range children() const
Definition: Expr.h:991
clang::OffsetOfNode::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:2100
clang::MemberExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: Expr.h:2828
clang::PredefinedExpr::getFunctionName
StringLiteral * getFunctionName()
Definition: Expr.h:1813
clang::ConstantExpr::children
const_child_range children() const
Definition: Expr.h:931
clang::ParenListExpr::getNumExprs
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition: Expr.h:4950
clang::DeclRefExpr::setLocation
void setLocation(SourceLocation L)
Definition: Expr.h:1123
clang::Expr::IgnoreParenImpCasts
const Expr * IgnoreParenImpCasts() const LLVM_READONLY
Definition: Expr.h:780
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::PredefinedExpr::setLocation
void setLocation(SourceLocation L)
Definition: Expr.h:1811
clang::APFloatStorage::setValue
void setValue(const ASTContext &C, const llvm::APFloat &Val)
Definition: Expr.h:1303
clang::StringLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1742
clang::Expr::MLV_ConstQualifiedField
Definition: Expr.h:278
clang::getInits
MutableArrayRef< Expr * > getInits()
Definition: OpenMPClause.h:2673
clang::DeclRefExpr::getFoundDecl
const NamedDecl * getFoundDecl() const
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1157
clang::BinaryOperator::getOperatorLoc
SourceLocation getOperatorLoc() const
Definition: Expr.h:3324
clang::BlockExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5205
clang::ExtVectorElementExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5160
clang::Expr::IgnoreParens
const Expr * IgnoreParens() const LLVM_READONLY
Definition: Expr.h:823
clang::UnaryOperator::getSubExpr
Expr * getSubExpr() const
Definition: Expr.h:1926
clang::Expr::getReferencedDeclOfCallee
const Decl * getReferencedDeclOfCallee() const
Definition: Expr.h:453
clang::DeclRefExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: Expr.h:1175
clang::DesignatedInitUpdateExpr::setUpdater
void setUpdater(Expr *Updater)
Definition: Expr.h:4779
clang::AsTypeExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_astype token.
Definition: Expr.h:5257
clang::NoInitExpr::NoInitExpr
NoInitExpr(EmptyShell Empty)
Definition: Expr.h:4724
clang::CastExpr::getCastKind
CastKind getCastKind() const
Definition: Expr.h:3049
clang::DesignatedInitExpr::getSubExpr
Expr * getSubExpr(unsigned Idx) const
Definition: Expr.h:4672
clang::VAArgExpr::children
child_range children()
Definition: Expr.h:4139
clang::Expr::MLV_NoSetterProperty
Definition: Expr.h:281
clang::CallExpr::getArgs
const Expr *const * getArgs() const
Definition: Expr.h:2547
clang::DeclarationNameInfo::getName
DeclarationName getName() const
getName - Returns the embedded declaration name.
Definition: DeclarationName.h:714
clang::ConstantExpr::Create
static ConstantExpr * Create(const ASTContext &Context, Expr *E)
Definition: Expr.h:909
clang::ASTVector::data
pointer data()
data - Return a pointer to the vector&#39;s buffer, even if empty().
Definition: ASTVector.h:154
clang::Expr::Classification::isModifiable
bool isModifiable() const
Definition: Expr.h:357
clang::BuiltinType::isPlaceholderTypeKind
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
Definition: Type.h:2448
clang::ConvertVectorExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3962
clang::LabelDecl
Represents the declaration of a label.
Definition: Decl.h:469
clang::MemberExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2917
clang::AddrLabelExpr::setLabelLoc
void setLabelLoc(SourceLocation L)
Definition: Expr.h:3779
clang::ParenListExpr::getExpr
const Expr * getExpr(unsigned Init) const
Definition: Expr.h:4957
clang::ExprObjectKind
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:124
clang::PartialDiagnosticAt
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
Definition: PartialDiagnostic.h:419
clang::Expr::ignoreParenBaseCasts
const Expr * ignoreParenBaseCasts() const LLVM_READONLY
Definition: Expr.h:800
clang::ArraySubscriptExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:2361
clang::PredefinedExpr::FuncSig
Definition: Expr.h:1774
clang::StringLiteral::getStrTokenLoc
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
Definition: Expr.h:1713
clang::OffsetOfExpr::children
child_range children()
Definition: Expr.h:2207
clang::StmtExpr::StmtExpr
StmtExpr(EmptyShell Empty)
Build an empty statement expression.
Definition: Expr.h:3820
clang::UnaryOperator::canOverflow
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:1939
clang::CompoundAssignOperator::CompoundAssignOperator
CompoundAssignOperator(EmptyShell Empty)
Build an empty compound assignment operator expression.
Definition: Expr.h:3526
clang::StmtExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:3831
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:49
clang::GenericSelectionExpr::getAssocExpr
Expr * getAssocExpr(unsigned i)
Definition: Expr.h:5051
clang::BinaryOperator::setLHS
void setLHS(Expr *E)
Definition: Expr.h:3333
clang::Expr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:866
clang::StringLiteral::isPascal
bool isPascal() const
Definition: Expr.h:1690
clang::ConstantExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:921
clang::APNumericStorage::VAL
uint64_t VAL
Used to store the <= 64 bits integer value.
Definition: Expr.h:1267
clang::MemberExpr::MemberExpr
MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc, ValueDecl *memberdecl, SourceLocation l, QualType ty, ExprValueKind VK, ExprObjectKind OK)
Definition: Expr.h:2748
clang::CastExpr::getSubExprAsWritten
const Expr * getSubExprAsWritten() const
Definition: Expr.h:3063
clang::CompoundLiteralExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2988
clang::SubobjectAdjustment::Ptr
struct P Ptr
Definition: Expr.h:81
clang::UnaryExprOrTypeTraitExpr::getArgumentExpr
const Expr * getArgumentExpr() const
Definition: Expr.h:2270
clang::AtomicScopeModelKind::OpenCL
clang::AtomicExpr
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:5438
clang::UnaryExprOrTypeTraitExpr::getKind
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2253
clang::AsTypeExpr::children
child_range children()
Definition: Expr.h:5270
clang::TypoExpr::children
const_child_range children() const
Definition: Expr.h:5581
clang::ParenListExpr::getExpr
Expr * getExpr(unsigned Init)
Definition: Expr.h:4952
clang::Expr::IgnoreCasts
const Expr * IgnoreCasts() const LLVM_READONLY
Strip off casts, but keep parentheses.
Definition: Expr.h:830
clang::InitListExpr::rbegin
const_reverse_iterator rbegin() const
Definition: Expr.h:4396
clang::Expr::isValueDependent
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:149
clang::CharacterLiteral::UTF8
Definition: Expr.h:1397
clang::GNUNullExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4082
clang::StringLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1741
clang::StmtExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:3829
clang::StmtExpr::children
const_child_range children() const
Definition: Expr.h:3840
clang::DeclRefExpr::setDecl
void setDecl(ValueDecl *NewD)
Definition: Expr.h:1116
clang::CallExpr::arguments
arg_range arguments()
Definition: Expr.h:2590
llvm::SmallVector
Definition: LLVM.h:36
clang::UnaryExprOrTypeTraitExpr::setArgument
void setArgument(TypeSourceInfo *TInfo)
Definition: Expr.h:2278
clang::ConditionalOperator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3638
clang::ImplicitCastExpr
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3120
clang::InitListExpr::getInits
Expr ** getInits()
Retrieve the set of initializers.
Definition: Expr.h:4223
clang::Expr::isLValue
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
Definition: Expr.h:249
clang::CharacterLiteral::getKind
CharacterKind getKind() const
Definition: Expr.h:1419
clang::AtomicExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5534
clang::InitListExpr::InitListExpr
InitListExpr(EmptyShell Empty)
Build an empty initializer list.
Definition: Expr.h:4217
clang::FixedPointLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1369
clang::AtomicExpr::AtomicExpr
AtomicExpr(EmptyShell Empty)
Build an empty AtomicExpr.
Definition: Expr.h:5468
clang::DesignatedInitExpr::TrailingObjects
friend TrailingObjects
Definition: Expr.h:4706
clang::ImaginaryLiteral::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:1530
clang::Expr::Classification::isRValue
bool isRValue() const
Definition: Expr.h:356
clang::BinaryOperator::isLogicalOp
static bool isLogicalOp(Opcode Opc)
Definition: Expr.h:3412
clang::MemberExpr::children
const_child_range children() const
Definition: Expr.h:2923
clang::CharacterLiteral
Definition: Expr.h:1392
clang::OffsetOfExpr::TrailingObjects
friend TrailingObjects
Definition: Expr.h:2216
clang::ParenListExpr::getExprs
Expr ** getExprs()
Definition: Expr.h:4961
clang::UnaryExprOrTypeTraitExpr::getArgumentExpr
Expr * getArgumentExpr()
Definition: Expr.h:2266
clang::ParenListExpr::exprs
ArrayRef< Expr * > exprs()
Definition: Expr.h:4965
clang::GenericSelectionExpr::children
child_range children()
Definition: Expr.h:5101
clang::Expr::Classification::CL_Function
Definition: Expr.h:308
clang::DesignatedInitExpr::FieldDesignator::NameOrField
uintptr_t NameOrField
Refers to the field that is being initialized.
Definition: Expr.h:4470
clang::StmtExpr
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3806
clang::PredefinedExpr::LFuncSig
Definition: Expr.h:1775
clang::Expr::LV_SubObjCPropertySetting
Definition: Expr.h:262
clang::OpaqueValueExpr::OpaqueValueExpr
OpaqueValueExpr(EmptyShell Empty)
Definition: Expr.h:971
clang::DesignatedInitExpr::ArrayOrRangeDesignator::LBracketLoc
unsigned LBracketLoc
The location of the &#39;[&#39; starting the array range designator.
Definition: Expr.h:4485
clang::Expr::IgnoreParenLValueCasts
const Expr * IgnoreParenLValueCasts() const LLVM_READONLY
Definition: Expr.h:788
clang::DesignatedInitExpr::children
child_range children()
Definition: Expr.h:4697
clang::CastExpr::path_end
path_const_iterator path_end() const
Definition: Expr.h:3078
clang::UnaryExprOrTypeTraitExpr::isArgumentType
bool isArgumentType() const
Definition: Expr.h:2258
clang::StringLiteral::tokloc_iterator
const SourceLocation * tokloc_iterator
Definition: Expr.h:1731
clang::FullExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:897
clang::InitListExpr::getArrayFiller
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition: Expr.h:4284
clang::VAArgExpr::setSubExpr
void setSubExpr(Expr *E)
Definition: Expr.h:4116
clang::InitListExpr::sawArrayRangeDesignator
void sawArrayRangeDesignator(bool ARD=true)
Definition: Expr.h:4361
clang::ImplicitCastExpr::isPartOfExplicitCast
bool isPartOfExplicitCast() const
Definition: Expr.h:3139
clang::ImplicitCastExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3155
clang::MultiVersionKind::None
clang::Stmt::EmptyShell
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:976
clang::Expr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:215
clang::DeclRefExpr::hasTemplateKeyword
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword...
Definition: Expr.h:1191
clang::CompoundLiteralExpr::getInitializer
const Expr * getInitializer() const
Definition: Expr.h:2956
clang::BinaryOperator::getLHS
Expr * getLHS() const
Definition: Expr.h:3332
clang::CompoundAssignOperator
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3509
clang::DeclAccessPair
A POD class for pairing a NamedDecl* with an access specifier.
Definition: DeclAccessPair.h:30
clang::DeclarationNameLoc
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
Definition: DeclarationName.h:651
clang::GenericSelectionExpr
Represents a C11 generic selection.
Definition: Expr.h:5015
clang::VAArgExpr::VAArgExpr
VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo, SourceLocation RPLoc, QualType t, bool IsMS)
Definition: Expr.h:4101
clang::ExtVectorElementExpr::getBase
const Expr * getBase() const
Definition: Expr.h:5139
clang::Expr::EvalStatus
EvalStatus is a struct with detailed info about an evaluation in progress.
Definition: Expr.h:541
clang::FullExpr::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:891
clang::ArrayInitLoopExpr::ArrayInitLoopExpr
ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit)
Definition: Expr.h:4815
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3762
clang::PseudoObjectExpr::getResultExpr
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
Definition: Expr.h:5359
clang::Expr::LV_NotObjectType
Definition: Expr.h:256
clang::Expr::Expr
Expr(StmtClass SC, EmptyShell)
Construct an empty expression.
Definition: Expr.h:125
clang::BinaryConditionalOperator::getOpaqueValue
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Definition: Expr.h:3703
clang::CastExpr::getTargetUnionField
const FieldDecl * getTargetUnionField() const
Definition: Expr.h:3080
clang::Expr::Classification::CL_AddressableVoid
Definition: Expr.h:310
clang::InitListExpr::getInitializedFieldInUnion
const FieldDecl * getInitializedFieldInUnion() const
Definition: Expr.h:4305
clang::NoInitExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4727
clang::BinaryConditionalOperator::getFalseExpr
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:3719
clang::BinaryOperator::BinaryOperator
BinaryOperator(StmtClass SC, EmptyShell Empty)
Definition: Expr.h:3498
clang::FloatingLiteral::setLocation
void setLocation(SourceLocation L)
Definition: Expr.h:1494
clang::OpaqueValueExpr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
Definition: Expr.h:983
clang::ConditionalOperator::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3642
clang::OffsetOfNode::OffsetOfNode
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
Create an offsetof node that refers to a field.
Definition: Expr.h:2052
clang::InitListExpr::begin
iterator begin()
Definition: Expr.h:4391
clang::Expr::Classification::CM_Untested
Definition: Expr.h:321
clang::GenericSelectionExpr::getNumAssocs
unsigned getNumAssocs() const
Definition: Expr.h:5042
Decl.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::GenericSelectionExpr::isResultDependent
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5079
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:108
clang::children
child_range children()
Definition: OpenMPClause.h:2827
clang::StringLiteral::Wide
Definition: Expr.h:1588
clang::APFloatStorage
Definition: Expr.h:1298
clang::Expr::EvalStatus::hasSideEffects
bool hasSideEffects() const
Definition: Expr.h:565
clang::StringLiteral::tokloc_begin
tokloc_iterator tokloc_begin() const
Definition: Expr.h:1733
clang::ChooseExpr::setBuiltinLoc
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:4035
clang::MemberExpr::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:2851
clang::PredefinedExpr
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1758
clang::MemberExpr::getMemberNameInfo
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Definition: Expr.h:2872
clang::UnaryOperatorKind
UnaryOperatorKind
Definition: OperationKinds.h:31
clang::AtomicExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5531
clang::Expr::EvalResult
EvalResult is a struct with detailed info about an evaluated expression.
Definition: Expr.h:571
clang::ASTVector::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: ASTVector.h:90
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
clang::CharacterLiteral::CharacterKind
CharacterKind
Definition: Expr.h:1394
clang::CallExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2641
clang::UnaryOperator::Opcode
UnaryOperatorKind Opcode
Definition: Expr.h:1900
clang::Expr::Classification::getModifiable
ModifiableType getModifiable() const
Definition: Expr.h:348
clang::AddrLabelExpr::setLabel
void setLabel(LabelDecl *L)
Definition: Expr.h:3785
clang::InitListExpr::isExplicit
bool isExplicit() const
Definition: Expr.h:4318
clang::BinaryOperator::isShiftAssignOp
static bool isShiftAssignOp(Opcode Opc)
Definition: Expr.h:3434
clang::BinaryOperator::isShiftOp
bool isShiftOp() const
Definition: Expr.h:3371
clang::ExplicitCastExpr::setTypeInfoAsWritten
void setTypeInfoAsWritten(TypeSourceInfo *writtenTy)
Definition: Expr.h:3214
clang::BinaryConditionalOperator::BinaryConditionalOperator
BinaryConditionalOperator(EmptyShell Empty)
Build an empty conditional operator.
Definition: Expr.h:3694
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
clang::DesignatedInitExpr::FieldDesignator
A field designator, e.g., ".x".
Definition: Expr.h:4463
clang::ExtVectorElementExpr::getBase
Expr * getBase()
Definition: Expr.h:5140
clang::InitListExpr::reverse_iterator
InitExprsTy::reverse_iterator reverse_iterator
Definition: Expr.h:4388
clang::OpaqueValueExpr::setIsUnique
void setIsUnique(bool V)
Definition: Expr.h:1005
clang::ExtVectorElementExpr::ExtVectorElementExpr
ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base, IdentifierInfo &accessor, SourceLocation loc)
Definition: Expr.h:5126
clang::ParenExpr::children
child_range children()
Definition: Expr.h:1880
clang::ImaginaryLiteral::setSubExpr
void setSubExpr(Expr *E)
Definition: Expr.h:1531
clang::GenericSelectionExpr::getAssocType
QualType getAssocType(unsigned i) const
Definition: Expr.h:5066
clang::CastExpr::setSubExpr
void setSubExpr(Expr *E)
Definition: Expr.h:3057
type
IteratorComparison::getOpcode
BinaryOperator::Opcode getOpcode(const SymExpr *SE)
clang::AtomicExpr::isOpenCL
bool isOpenCL() const
Definition: Expr.h:5523
clang::CompoundLiteralExpr::setFileScope
void setFileScope(bool FS)
Definition: Expr.h:2961
clang::FloatingLiteral::setExact
void setExact(bool E)
Definition: Expr.h:1486
clang::OpaqueValueExpr::OpaqueValueExpr
OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, ExprObjectKind OK=OK_Ordinary, Expr *SourceExpr=nullptr)
Definition: Expr.h:950
clang::ExtVectorElementExpr::children
child_range children()
Definition: Expr.h:5174
clang::CallExpr::getCalleeDecl
const Decl * getCalleeDecl() const
Definition: Expr.h:2527
clang::Expr::getSourceBitField
const FieldDecl * getSourceBitField() const
Definition: Expr.h:448
clang::CallExpr::usesADL
bool usesADL() const
Definition: Expr.h:2524
clang::InitListExpr::getLBraceLoc
SourceLocation getLBraceLoc() const
Definition: Expr.h:4335
clang::Stmt::getStmtClass
StmtClass getStmtClass() const
Definition: Stmt.h:1029
clang::CastExpr::getCastKindName
const char * getCastKindName() const
Definition: Expr.h:3053
clang::PseudoObjectExpr::children
const_child_range children() const
Definition: Expr.h:5417
clang::InitListExpr::getArrayFiller
const Expr * getArrayFiller() const
Definition: Expr.h:4287
clang::Expr::NPCK_ZeroExpression
Expression is a Null pointer constant built from a zero integer expression that is not a simple...
Definition: Expr.h:695
clang::Expr::Classification::getKind
Kinds getKind() const
Definition: Expr.h:347
clang::PseudoObjectExpr::semantics
llvm::iterator_range< const_semantics_iterator > semantics() const
Definition: Expr.h:5388
clang::Expr::setInstantiationDependent
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
Definition: Expr.h:196
clang::ASTVector::const_iterator
const T * const_iterator
Definition: ASTVector.h:87
clang::OffsetOfNode::Kind
Kind
The kind of offsetof node we have.
Definition: Expr.h:2016
clang::Expr::NPCK_CXX11_nullptr
Expression is a C++11 nullptr.
Definition: Expr.h:701
clang::OffsetOfNode::OffsetOfNode
OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc)
Create an offsetof node that refers to an identifier.
Definition: Expr.h:2057
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2756
clang::FixedPointLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1370
clang::CastExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:3056
clang::VAArgExpr::VAArgExpr
VAArgExpr(EmptyShell Empty)
Create an empty __builtin_va_arg expression.
Definition: Expr.h:4111
clang::PseudoObjectExpr::semantics_begin
semantics_iterator semantics_begin()
Definition: Expr.h:5372
clang::StmtExpr::setLParenLoc
void setLParenLoc(SourceLocation L)
Definition: Expr.h:3830
clang::Expr::Classification::CM_ConstQualifiedField
Definition: Expr.h:328
clang::ExplicitCastExpr
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3195
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:691
clang::UnaryOperator::isPrefix
static bool isPrefix(Opcode Op)
isPrefix - Return true if this is a prefix operation, like –x.
Definition: Expr.h:1948
clang::InitListExpr::setInitializedFieldInUnion
void setInitializedFieldInUnion(FieldDecl *FD)
Definition: Expr.h:4308
clang::ChooseExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4043
clang::BinaryOperator::isPtrMemOp
bool isPtrMemOp() const
Definition: Expr.h:3362
clang::ExplicitCastExpr::ExplicitCastExpr
ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize)
Construct an empty explicit cast.
Definition: Expr.h:3207
clang::APIntStorage::getValue
llvm::APInt getValue() const
Definition: Expr.h:1292
clang::AtomicExpr::getNumSubExprs
unsigned getNumSubExprs() const
Definition: Expr.h:5503
clang::AddrLabelExpr::getLabel
LabelDecl * getLabel() const
Definition: Expr.h:3784
clang::ArraySubscriptExpr::setRBracketLoc
void setRBracketLoc(SourceLocation L)
Definition: Expr.h:2369
clang::CastExpr::path_end
path_iterator path_end()
Definition: Expr.h:3076
clang::Expr::hasPlaceholderType
bool hasPlaceholderType(BuiltinType::Kind K) const
Returns whether this expression has a specific placeholder type.
Definition: Expr.h:477
clang::StringLiteral::getByteLength
unsigned getByteLength() const
Definition: Expr.h:1677
clang::ConstStmtIterator
Definition: StmtIterator.h:141
clang::ShuffleVectorExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3878
clang::DesignatedInitExpr::Designator::getFieldLoc
SourceLocation getFieldLoc() const
Definition: Expr.h:4571
clang::AtomicExpr::getOrderFail
Expr * getOrderFail() const
Definition: Expr.h:5486
clang::DeclRefExpr::getNameInfo
DeclarationNameInfo getNameInfo() const
Definition: Expr.h:1118
clang::Expr::EvalStatus::HasSideEffects
bool HasSideEffects
Whether the evaluated expression has side effects.
Definition: Expr.h:544
clang::MemberExpr::setHadMultipleCandidates
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
Definition: Expr.h:2905
clang::MemberExpr::MemberExpr
MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc, ValueDecl *memberdecl, const DeclarationNameInfo &NameInfo, QualType ty, ExprValueKind VK, ExprObjectKind OK)
Definition: Expr.h:2728
clang::TemplateArgumentLoc
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:450
getInfo
static const TypeInfo & getInfo(unsigned id)
Definition: Types.cpp:34
clang::CharacterLiteral::Wide
Definition: Expr.h:1396
TemplateBase.h
clang::ShuffleVectorExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:3869
clang::CompoundLiteralExpr::CompoundLiteralExpr
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope)
Definition: Expr.h:2942
clang::IntegerLiteral::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1331
clang::CompoundAssignOperator::classof
static bool classof(const Stmt *S)
Definition: Expr.h:3538
clang::ExtVectorElementExpr::children
const_child_range children() const
Definition: Expr.h:5175
clang::ArraySubscriptExpr
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2312
clang::StringLiteral::isUTF32
bool isUTF32() const
Definition: Expr.h:1689
clang::BinaryOperator::classof
static bool classof(const Stmt *S)
Definition: Expr.h:3447
clang::AbstractConditionalOperator
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Definition: Expr.h:3545
clang::GenericSelectionExpr::getAssocTypeSourceInfo
TypeSourceInfo * getAssocTypeSourceInfo(unsigned i)
Definition: Expr.h:5061
clang::TypoExpr::children
child_range children()
Definition: Expr.h:5578
clang::CallExpr::arg_begin
arg_iterator arg_begin()
Definition: Expr.h:2595
clang::DeclRefExpr::children
const_child_range children() const
Definition: Expr.h:1252
clang::OffsetOfExpr::setIndexExpr
void setIndexExpr(unsigned Idx, Expr *E)
Definition: Expr.h:2190
clang::Expr::Classification::CM_ArrayType
Definition: Expr.h:330
clang::OpaqueValueExpr::getLocation
SourceLocation getLocation() const
Retrieve the location of this expression.
Definition: Expr.h:975
TrailingObjects
friend TrailingObjects
Definition: OpenMPClause.h:99
clang::ImaginaryLiteral::children
child_range children()
Definition: Expr.h:1543
clang::ParenListExpr::getEndLoc
SourceLocation getEndLoc() const
Definition: Expr.h:4972
clang::BinaryConditionalOperator::getCond
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
Definition: Expr.h:3707
clang::ChooseExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4037
clang::OpaqueValueExpr::isUnique
bool isUnique() const
Definition: Expr.h:1011
clang::Expr::Classification::CM_ConstQualified
Definition: Expr.h:327
clang::ChooseExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:4040
clang::FloatingLiteral::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1499
clang::DesignatedInitExpr::Designator::getField
FieldDecl * getField() const
Definition: Expr.h:4553
clang::BinaryOperator::children
const_child_range children() const
Definition: Expr.h:3456
clang::AsTypeExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5263
clang::ImaginaryLiteral::ImaginaryLiteral
ImaginaryLiteral(Expr *val, QualType Ty)
Definition: Expr.h:1520
clang::UnaryExprOrTypeTraitExpr::setKind
void setKind(UnaryExprOrTypeTrait K)
Definition: Expr.h:2256
clang::UnaryExprOrTypeTraitExpr::setRParenLoc
void setRParenLoc(SourceLocation L)
Definition: Expr.h:2293
clang::UnaryOperator::getOpcode
Opcode getOpcode() const
Definition: Expr.h:1921
clang::BinaryOperator::isAdditiveOp
static bool isAdditiveOp(Opcode Opc)
Definition: Expr.h:3368
clang::ReferenceType
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2673
clang::ChooseExpr::setRHS
void setRHS(Expr *E)
Definition: Expr.h:4032
clang::Expr::LValueClassification
LValueClassification
Definition: Expr.h:254
clang::BinaryOperator::setOperatorLoc
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:3325
clang::FloatingLiteral::setValue
void setValue(const ASTContext &C, const llvm::APFloat &Val)
Definition: Expr.h:1462
clang::ParenListExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: Expr.h:4971
clang::StringLiteral::getBytes
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition: Expr.h:1657
clang::ArrayInitLoopExpr::children
child_range children()
Definition: Expr.h:4848
clang::GenericSelectionExpr::getDefaultLoc
SourceLocation getDefaultLoc() const
Definition: Expr.h:5045
clang::ArraySubscriptExpr::children
const_child_range children() const
Definition: Expr.h:2385
clang::UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr(EmptyShell Empty)
Construct an empty sizeof/alignof expression.
Definition: Expr.h:2250
clang::Expr::IgnoreImpCasts
const Expr * IgnoreImpCasts() const LLVM_READONLY
Definition: Expr.h:820
clang::SubobjectAdjustment::SubobjectAdjustment
SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
Definition: Expr.h:96
clang::CallExpr::arg_iterator
ExprIterator arg_iterator
Definition: Expr.h:2585
clang::CompoundLiteralExpr::setLParenLoc
void setLParenLoc(SourceLocation L)
Definition: Expr.h:2964
clang::MemberExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:2860
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Definition: APValue.h:38
clang::ArraySubscriptExpr::ArraySubscriptExpr
ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation rbracketloc)
Definition: Expr.h:2319
clang::CompoundLiteralExpr::children
const_child_range children() const
Definition: Expr.h:2994
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:192
clang::CharacterLiteral::CharacterLiteral
CharacterLiteral(unsigned value, CharacterKind kind, QualType type, SourceLocation l)
Definition: Expr.h:1407
clang::OK_BitField
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:129
clang::ASTVector::begin
iterator begin()
Definition: ASTVector.h:98
clang::Expr::Classification::isGLValue
bool isGLValue() const
Definition: Expr.h:354
clang::DesignatedInitExpr::children
const_child_range children() const
Definition: Expr.h:4701
clang::UnaryOperator::setOperatorLoc
void setOperatorLoc(SourceLocation L)
Definition: Expr.h:1931
clang::IntegerLiteral::setLocation
void setLocation(SourceLocation Location)
Definition: Expr.h:1336
clang::UnaryOperator::isIncrementOp
static bool isIncrementOp(Opcode Op)
Definition: Expr.h:1955
clang::ChooseExpr::getRHS
Expr * getRHS() const
Definition: Expr.h:4031
clang::PredefinedExpr::Func
Definition: Expr.h:1770
clang::DeclRefExpr::setHadMultipleCandidates
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
Definition: Expr.h:1233
clang::UnaryOperator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1991
clang::InitListExpr::rend
reverse_iterator rend()
Definition: Expr.h:4397
clang::ConvertVectorExpr::getSrcExpr
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:3943
clang::UnaryOperator::isArithmeticOp
bool isArithmeticOp() const
Definition: Expr.h:1977
clang::DesignatedInitExpr::Designator::Designator
Designator()
Definition: Expr.h:4516
clang::ImplicitValueInitExpr::ImplicitValueInitExpr
ImplicitValueInitExpr(EmptyShell Empty)
Construct an empty implicit value initialization.
Definition: Expr.h:4905
clang::CastExpr::children
child_range children()
Definition: Expr.h:3096
clang::BinaryOperator::Opcode
BinaryOperatorKind Opcode
Definition: Expr.h:3297
clang::BlockExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5215
ASTVector.h
clang::DeclRefExpr::template_arguments
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: Expr.h:1221
clang::StmtExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3834
clang::VAArgExpr::setBuiltinLoc
void setBuiltinLoc(SourceLocation L)
Definition: Expr.h:4126
clang::BinaryConditionalOperator::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3730
clang::Expr::NPCK_ZeroLiteral
Expression is a Null pointer constant built from a literal zero.
Definition: Expr.h:698
clang::ConvertVectorExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3959
clang::MemberExpr
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2687
clang::ImaginaryLiteral::children
const_child_range children() const
Definition: Expr.h:1544
clang::Expr::MLV_ConstQualified
Definition: Expr.h:277
clang::ExtVectorElementExpr::setBase
void setBase(Expr *E)
Definition: Expr.h:5141
clang::BinaryConditionalOperator::BinaryConditionalOperator
BinaryConditionalOperator(Expr *common, OpaqueValueExpr *opaqueValue, Expr *cond, Expr *lhs, Expr *rhs, SourceLocation qloc, SourceLocation cloc, QualType t, ExprValueKind VK, ExprObjectKind OK)
Definition: Expr.h:3673
clang::CastExpr::path_iterator
CXXBaseSpecifier ** path_iterator
Definition: Expr.h:3071
SyncScope.h
Provides definitions for the atomic synchronization scopes.
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
clang::BinaryOperator::isCompoundAssignmentOp
static bool isCompoundAssignmentOp(Opcode Opc)
Definition: Expr.h:3420
clang::ConditionalOperator::getTrueExpr
Expr * getTrueExpr() const
Definition: Expr.h:3625
clang::ArrayInitLoopExpr
Represents a loop initializing the elements of an array.
Definition: Expr.h:4808
clang::InitListExpr::isSyntacticForm
bool isSyntacticForm() const
Definition: Expr.h:4344
clang::ChooseExpr
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:3982
clang::ParenExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1864
clang::ExtVectorElementExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:5169
clang::BinaryConditionalOperator
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:3660
clang::OffsetOfExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:2202
clang::ParenListExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4970
clang::SourceLocation::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:109
clang::ConditionalOperator::getRHS
Expr * getRHS() const
Definition: Expr.h:3633
clang::BinaryOperator::isMultiplicativeOp
bool isMultiplicativeOp() const
Definition: Expr.h:3367
clang::AttrSyntax::C
clang::CallExpr::hasUnusedResultAttr
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
Definition: Expr.h:2636
clang::StringLiteral::getNumConcatenated
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Definition: Expr.h:1708
clang::StringLiteral::containsNonAscii
bool containsNonAscii() const
Definition: Expr.h:1692
clang::Expr::Classification::isPRValue
bool isPRValue() const
Definition: Expr.h:355
clang::Expr::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Definition: Expr.h:214
clang::Expr::isRValue
bool isRValue() const
Definition: Expr.h:250
clang::Expr::Classification::CL_ArrayTemporary
Definition: Expr.h:315
clang::OpaqueValueExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:977
clang::UnaryOperator::isPrefix
bool isPrefix() const
Definition: Expr.h:1952
clang::diag::kind
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Definition: DiagnosticIDs.h:61
clang::BuiltinType
This class is used for builtin types like &#39;int&#39;.
Definition: Type.h:2391
clang::Expr::Classification::isXValue
bool isXValue() const
Definition: Expr.h:353
clang::CallExpr::setPreArg
void setPreArg(unsigned I, Stmt *PreArg)
Definition: Expr.h:2472
clang::SubobjectAdjustment::DerivedToBaseAdjustment
Definition: Expr.h:63
clang::BlockExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:5208
clang::InitListExpr::getInit
Expr * getInit(unsigned Init)
Definition: Expr.h:4243
clang::SubobjectAdjustment::Field
FieldDecl * Field
Definition: Expr.h:80
clang::GNUNullExpr::setTokenLocation
void setTokenLocation(SourceLocation L)
Definition: Expr.h:4077
clang::ConvertVectorExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition: Expr.h:3954
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1566
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2396
clang::FloatingLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1496
clang::Expr::MLV_Valid
Definition: Expr.h:270
clang::SubobjectAdjustment::P::MPT
const MemberPointerType * MPT
Definition: Expr.h:74
clang::DesignatedInitExpr::designators
llvm::ArrayRef< Designator > designators() const
Definition: Expr.h:4631
clang::DesignatedInitExpr::getDesignator
Designator * getDesignator(unsigned Idx)
Definition: Expr.h:4635
clang::DesignatedInitExpr::setInit
void setInit(Expr *init)
Definition: Expr.h:4662
clang::BinaryOperator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3337
clang::AddrLabelExpr::children
child_range children()
Definition: Expr.h:3792
clang::AbstractConditionalOperator::AbstractConditionalOperator
AbstractConditionalOperator(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack, SourceLocation qloc, SourceLocation cloc)
Definition: Expr.h:3550
clang::ChooseExpr::getLHS
Expr * getLHS() const
Definition: Expr.h:4029
getKind
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:954
clang::SubobjectAdjustment::MemberPointerAdjustment
Definition: Expr.h:65
clang::Expr::EvalStatus::EvalStatus
EvalStatus()
Definition: Expr.h:560
clang::ImplicitValueInitExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4908
clang::BinaryConditionalOperator::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:3723
clang::MemberExprNameQualifier::FoundDecl
DeclAccessPair FoundDecl
The DeclAccessPair through which the MemberDecl was found due to name qualifiers. ...
Definition: Expr.h:2682
clang::OffsetOfExpr::getNumComponents
unsigned getNumComponents() const
Definition: Expr.h:2176
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2079
clang::CallExpr::ADLCallKind
ADLCallKind
Definition: Expr.h:2443
clang::ASTVector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: ASTVector.h:89
clang::CharacterLiteral::setKind
void setKind(CharacterKind kind)
Definition: Expr.h:1429
clang::DeclRefExpr
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1041
clang::BinaryOperator::getRHS
Expr * getRHS() const
Definition: Expr.h:3334
clang::UnaryExprOrTypeTraitExpr::Ex
Stmt * Ex
Definition: Expr.h:2225
PTR
#define PTR(CLASS)
Definition: AttrVisitor.h:28
clang::BinaryOperator::isBitwiseOp
bool isBitwiseOp() const
Definition: Expr.h:3374
clang::UnaryOperator::isIncrementDecrementOp
bool isIncrementDecrementOp() const
Definition: Expr.h:1970
clang::PseudoObjectExpr::getSemanticExpr
Expr * getSemanticExpr(unsigned index)
Definition: Expr.h:5392
clang::ChooseExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4041
clang::CharacterLiteral::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1418
clang::AtomicExpr::getSubExprs
const Expr *const * getSubExprs() const
Definition: Expr.h:5506
clang::InitListExpr::getInitializedFieldInUnion
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4302
clang::ChooseExpr::isConditionDependent
bool isConditionDependent() const
Definition: Expr.h:4017
clang::Expr::LV_InvalidMessageExpression
Definition: Expr.h:260
true
#define true
Definition: stdbool.h:32
clang::Expr::MLV_DuplicateVectorComponents
Definition: Expr.h:273
clang::VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:114
clang::ASTVector< Stmt * >
clang::StringLiteral::isUTF16
bool isUTF16() const
Definition: Expr.h:1688
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:198
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::MemberExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Definition: Expr.h:2812
clang::DeclRefExpr::getQualifier
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition: Expr.h:1141
clang::OffsetOfExpr
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2117
clang::OpaqueValueExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:980
clang::DesignatedInitExpr::Designator::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:4606
clang::ExplicitCastExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:3220
clang::AtomicExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:5528
clang::UnaryOperator::isDecrementOp
static bool isDecrementOp(Opcode Op)
Definition: Expr.h:1962
clang::BinaryConditionalOperator::getCommon
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:3700
clang::VAArgExpr::getWrittenTypeInfo
TypeSourceInfo * getWrittenTypeInfo() const
Definition: Expr.h:4122
clang::SubobjectAdjustment::DTB::DerivedClass
const CXXRecordDecl * DerivedClass
Definition: Expr.h:70
clang::Expr::MLV_ConstAddrSpace
Definition: Expr.h:279
clang::CastExpr::path_begin
path_const_iterator path_begin() const
Definition: Expr.h:3077
clang::PredefinedExpr::children
child_range children()
Definition: Expr.h:1836
clang::BlockExpr::getBlockDecl
BlockDecl * getBlockDecl()
Definition: Expr.h:5197
clang::Decl::isInStdNamespace
bool isInStdNamespace() const
Definition: DeclBase.cpp:357
clang::UnaryOperator::classof
static bool classof(const Stmt *T)
Definition: Expr.h:1999
clang::GenericSelectionExpr::getGenericLoc
SourceLocation getGenericLoc() const
Definition: Expr.h:5044
clang::Expr::Classification::isLValue
bool isLValue() const
Definition: Expr.h:352
clang::SubobjectAdjustment::SubobjectAdjustment
SubobjectAdjustment(const CastExpr *BasePath, const CXXRecordDecl *DerivedClass)
Definition: Expr.h:84
clang::ImaginaryLiteral::ImaginaryLiteral
ImaginaryLiteral(EmptyShell Empty)
Build an empty imaginary literal.
Definition: Expr.h:1526
clang::CallExpr::getCalleeDecl
Decl * getCalleeDecl()
Definition: Expr.h:2526
clang::MemberExpr::setBase
void setBase(Expr *E)
Definition: Expr.h:2771
clang::BinaryOperator::isComparisonOp
static bool isComparisonOp(Opcode Opc)
Definition: Expr.h:3382
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:207
clang::ConvertVectorExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition: Expr.h:3946
clang::InitListExpr::children
const_child_range children() const
Definition: Expr.h:4379
ColonLoc
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:108
clang::OffsetOfExpr::getRParenLoc
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition: Expr.h:2156
clang::ArrayInitLoopExpr::getArraySize
llvm::APInt getArraySize() const
Definition: Expr.h:4832
clang::ChooseExpr::isConditionTrue
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition: Expr.h:4010
clang::CastExpr::CastExpr
CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, Expr *op, unsigned BasePathSize)
Definition: Expr.h:3014
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:582
clang::InitListExpr::getSyntacticForm
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4347
clang::ChooseExpr::children
child_range children()
Definition: Expr.h:4048
clang::ImplicitValueInitExpr
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:4898
clang::Expr::NullPointerConstantKind
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
Definition: Expr.h:686
clang::AtomicExpr::getWeak
Expr * getWeak() const
Definition: Expr.h:5496
clang::ImplicitValueInitExpr::children
child_range children()
Definition: Expr.h:4916
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:44
clang::Expr::Classification::CM_NoSetterProperty
Definition: Expr.h:326
clang::ShuffleVectorExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:3876
clang::NoInitExpr::children
child_range children()
Definition: Expr.h:4735
clang::TypeSourceInfo::getType
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:98
clang::CallExpr::getDirectCallee
const FunctionDecl * getDirectCallee() const
Definition: Expr.h:2535
clang::MemberExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Definition: Expr.h:2877
clang::InitListExpr::getSemanticForm
InitListExpr * getSemanticForm() const
Definition: Expr.h:4341
clang::ParenExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Expr.h:1865
clang::Create
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.
clang::ParenListExpr::classof
static bool classof(const Stmt *T)
Definition: Expr.h:4974
clang::ChooseExpr::setCond
void setCond(Expr *E)
Definition: Expr.h:4028
clang::ChooseExpr::setIsConditionTrue
void setIsConditionTrue(bool isTrue)
Definition: Expr.h:4015
clang::CharacterLiteral::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:1423
clang::BinaryOperator::isCompoundAssignmentOp
bool isCompoundAssignmentOp() const
Definition: Expr.h:3423
clang::UnaryOperator::getExprLoc
SourceLocation getExprLoc() const
Definition: Expr.h:1997
clang::DesignatedInitExpr::Designator::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: Expr.h:4609
EvaluateAsRValue
static bool EvaluateAsRValue(EvalInfo &Info, const Expr *E, APValue &Result)
EvaluateAsRValue - Try to evaluate this expression, performing an implicit lvalue-to-rvalue cast if i...
Definition: ExprConstant.cpp:10851
clang::CallExpr::const_arg_range
llvm::iterator_range< const_arg_iterator > const_arg_range
Definition: Expr.h:2588