clang  11.0.0git
ComputeDependence.cpp
Go to the documentation of this file.
1 //===- ComputeDependence.cpp ----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "clang/AST/Attr.h"
11 #include "clang/AST/DeclCXX.h"
14 #include "clang/AST/Expr.h"
15 #include "clang/AST/ExprCXX.h"
16 #include "clang/AST/ExprConcepts.h"
17 #include "clang/AST/ExprObjC.h"
18 #include "clang/AST/ExprOpenMP.h"
20 #include "llvm/ADT/ArrayRef.h"
21 
22 using namespace clang;
23 
25  return E->getSubExpr()->getDependence();
26 }
27 
29  auto D = toExprDependence(E->getType()->getDependence());
30  if (auto *S = E->getSourceExpr())
31  D |= S->getDependence();
32  assert(!(D & ExprDependence::UnexpandedPack));
33  return D;
34 }
35 
37  return E->getSubExpr()->getDependence();
38 }
39 
41  return toExprDependence(E->getType()->getDependence()) |
42  E->getSubExpr()->getDependence();
43 }
44 
46  // Never type-dependent (C++ [temp.dep.expr]p3).
47  // Value-dependent if the argument is type-dependent.
48  if (E->isArgumentType())
51 
52  auto ArgDeps = E->getArgumentExpr()->getDependence();
53  auto Deps = ArgDeps & ~ExprDependence::TypeValue;
54  // Value-dependent if the argument is type-dependent.
55  if (ArgDeps & ExprDependence::Type)
56  Deps |= ExprDependence::Value;
57  // Check to see if we are in the situation where alignof(decl) should be
58  // dependent because decl's alignment is dependent.
59  auto ExprKind = E->getKind();
60  if (ExprKind != UETT_AlignOf && ExprKind != UETT_PreferredAlignOf)
61  return Deps;
62  if ((Deps & ExprDependence::Value) && (Deps & ExprDependence::Instantiation))
63  return Deps;
64 
65  auto *NoParens = E->getArgumentExpr()->IgnoreParens();
66  const ValueDecl *D = nullptr;
67  if (const auto *DRE = dyn_cast<DeclRefExpr>(NoParens))
68  D = DRE->getDecl();
69  else if (const auto *ME = dyn_cast<MemberExpr>(NoParens))
70  D = ME->getMemberDecl();
71  if (!D)
72  return Deps;
73  for (const auto *I : D->specific_attrs<AlignedAttr>()) {
74  if (I->isAlignmentErrorDependent())
75  Deps |= ExprDependence::Error;
76  if (I->isAlignmentDependent())
77  Deps |= ExprDependence::ValueInstantiation;
78  }
79  return Deps;
80 }
81 
83  return E->getLHS()->getDependence() | E->getRHS()->getDependence();
84 }
85 
87  return E->getBase()->getDependence() | E->getRowIdx()->getDependence() |
90 }
91 
95 }
96 
98  // Cast expressions are type-dependent if the type is
99  // dependent (C++ [temp.dep.expr]p3).
100  // Cast expressions are value-dependent if the type is
101  // dependent or if the subexpression is value-dependent.
102  auto D = toExprDependence(E->getType()->getDependence());
103  if (E->getStmtClass() == Stmt::ImplicitCastExprClass) {
104  // An implicit cast expression doesn't (lexically) contain an
105  // unexpanded pack, even if its target type does.
106  D &= ~ExprDependence::UnexpandedPack;
107  }
108  if (auto *S = E->getSubExpr())
109  D |= S->getDependence() & ~ExprDependence::Type;
110  return D;
111 }
112 
114  return E->getLHS()->getDependence() | E->getRHS()->getDependence();
115 }
116 
118  // The type of the conditional operator depends on the type of the conditional
119  // to support the GCC vector conditional extension. Additionally,
120  // [temp.dep.expr] does specify state that this should be dependent on ALL sub
121  // expressions.
122  return E->getCond()->getDependence() | E->getLHS()->getDependence() |
123  E->getRHS()->getDependence();
124 }
125 
127  return E->getCommon()->getDependence() | E->getFalseExpr()->getDependence();
128 }
129 
130 ExprDependence clang::computeDependence(StmtExpr *E, unsigned TemplateDepth) {
131  auto D = toExprDependence(E->getType()->getDependence());
132  // Propagate dependence of the result.
133  if (const auto *CompoundExprResult =
134  dyn_cast_or_null<ValueStmt>(E->getSubStmt()->getStmtExprResult()))
135  if (const Expr *ResultExpr = CompoundExprResult->getExprStmt())
136  D |= ResultExpr->getDependence();
137  // Note: we treat a statement-expression in a dependent context as always
138  // being value- and instantiation-dependent. This matches the behavior of
139  // lambda-expressions and GCC.
140  if (TemplateDepth)
141  D |= ExprDependence::ValueInstantiation;
142  // A param pack cannot be expanded over stmtexpr boundaries.
143  return D & ~ExprDependence::UnexpandedPack;
144 }
145 
147  auto D = toExprDependence(E->getType()->getDependence()) |
148  E->getSrcExpr()->getDependence();
149  if (!E->getType()->isDependentType())
150  D &= ~ExprDependence::Type;
151  return D;
152 }
153 
155  if (E->isConditionDependent())
156  return ExprDependence::TypeValueInstantiation |
157  E->getCond()->getDependence() | E->getLHS()->getDependence() |
158  E->getRHS()->getDependence();
159 
160  auto Cond = E->getCond()->getDependence();
161  auto Active = E->getLHS()->getDependence();
162  auto Inactive = E->getRHS()->getDependence();
163  if (!E->isConditionTrue())
164  std::swap(Active, Inactive);
165  // Take type- and value- dependency from the active branch. Propagate all
166  // other flags from all branches.
167  return (Active & ExprDependence::TypeValue) |
168  ((Cond | Active | Inactive) & ~ExprDependence::TypeValue);
169 }
170 
172  auto D = ExprDependence::None;
173  for (auto *E : P->exprs())
174  D |= E->getDependence();
175  return D;
176 }
177 
179  auto D =
182  return D & ~ExprDependence::Value;
183 }
184 
186  return toExprDependence(E->getType()->getDependence()) &
187  (ExprDependence::Instantiation | ExprDependence::Error);
188 }
189 
191  auto D = E->getCommonExpr()->getDependence() |
192  E->getSubExpr()->getDependence() | ExprDependence::Instantiation;
194  D &= ~ExprDependence::Instantiation;
195  return turnTypeToValueDependence(D);
196 }
197 
199  return toExprDependence(E->getType()->getDependence()) &
200  ExprDependence::Instantiation;
201 }
202 
204  return E->getBase()->getDependence();
205 }
206 
208  auto D = toExprDependence(E->getType()->getDependence());
209  if (E->getBlockDecl()->isDependentContext())
210  D |= ExprDependence::Instantiation;
211  return D & ~ExprDependence::UnexpandedPack;
212 }
213 
215  auto D = toExprDependence(E->getType()->getDependence()) |
216  E->getSrcExpr()->getDependence();
217  if (!E->getType()->isDependentType())
218  D &= ~ExprDependence::Type;
219  return D;
220 }
221 
223  return E->getSemanticForm()->getDependence();
224 }
225 
228  D |= toExprDependence(E->getType()->getDependence()) &
230  return D;
231 }
232 
234  auto D = ExprDependence::None;
235  if (E->isTypeOperand())
236  D = toExprDependence(
238  else
240  // typeid is never type-dependent (C++ [temp.dep.expr]p4)
241  return D & ~ExprDependence::Type;
242 }
243 
246 }
247 
249  return E->getIdx()->getDependence();
250 }
251 
253  if (E->isTypeOperand())
256 
258 }
259 
261  // 'this' is type-dependent if the class type of the enclosing
262  // member function is dependent (C++ [temp.dep.expr]p2)
263  auto D = toExprDependence(E->getType()->getDependence());
264  assert(!(D & ExprDependence::UnexpandedPack));
265  return D;
266 }
267 
269  auto *Op = E->getSubExpr();
270  if (!Op)
271  return ExprDependence::None;
272  return Op->getDependence() & ~ExprDependence::TypeValue;
273 }
274 
276  return E->getSubExpr()->getDependence();
277 }
278 
280  return toExprDependence(E->getType()->getDependence()) &
281  ~ExprDependence::TypeValue;
282 }
283 
286 }
287 
290  if (auto *Dim = E->getDimensionExpression())
291  D |= Dim->getDependence();
292  return turnTypeToValueDependence(D);
293 }
294 
296  // Never type-dependent.
298  // Value-dependent if the argument is type-dependent.
301  return D;
302 }
303 
305  auto D = E->getOperand()->getDependence() & ~ExprDependence::TypeValue;
306  if (CT == CT_Dependent)
307  D |= ExprDependence::ValueInstantiation;
308  return D;
309 }
310 
312  return (E->getPattern()->getDependence() & ~ExprDependence::UnexpandedPack) |
313  ExprDependence::TypeValueInstantiation;
314 }
315 
317  return E->getReplacement()->getDependence();
318 }
319 
321  if (auto *Resume = E->getResumeExpr())
322  return (Resume->getDependence() &
323  (ExprDependence::TypeValue | ExprDependence::Error)) |
324  (E->getCommonExpr()->getDependence() & ~ExprDependence::TypeValue);
325  return E->getCommonExpr()->getDependence() |
326  ExprDependence::TypeValueInstantiation;
327 }
328 
330  return E->getOperand()->getDependence() |
331  ExprDependence::TypeValueInstantiation;
332 }
333 
335  return E->getSubExpr()->getDependence();
336 }
337 
340 }
341 
344 }
345 
347  if (E->isObjectReceiver())
348  return E->getBase()->getDependence() & ~ExprDependence::Type;
349  if (E->isSuperReceiver())
351  ~ExprDependence::TypeValue;
352  assert(E->isClassReceiver());
353  return ExprDependence::None;
354 }
355 
357  return E->getBaseExpr()->getDependence() | E->getKeyExpr()->getDependence();
358 }
359 
361  return E->getBase()->getDependence() & ~ExprDependence::Type &
362  ~ExprDependence::UnexpandedPack;
363 }
364 
366  return E->getSubExpr()->getDependence();
367 }
368 
370  auto D = E->getBase()->getDependence();
371  if (auto *LB = E->getLowerBound())
372  D |= LB->getDependence();
373  if (auto *Len = E->getLength())
374  D |= Len->getDependence();
375  return D;
376 }
377 
379  auto D = E->getBase()->getDependence() |
381  for (Expr *Dim: E->getDimensions())
382  if (Dim)
383  D |= Dim->getDependence();
384  return D;
385 }
386 
388  auto D = toExprDependence(E->getType()->getDependence());
389  for (unsigned I = 0, End = E->numOfIterators(); I < End; ++I) {
390  if (auto *VD = cast_or_null<ValueDecl>(E->getIteratorDecl(I)))
391  D |= toExprDependence(VD->getType()->getDependence());
393  if (Expr *BE = IR.Begin)
394  D |= BE->getDependence();
395  if (Expr *EE = IR.End)
396  D |= EE->getDependence();
397  if (Expr *SE = IR.Step)
398  D |= SE->getDependence();
399  }
400  return D;
401 }
402 
403 /// Compute the type-, value-, and instantiation-dependence of a
404 /// declaration reference
405 /// based on the declaration being referenced.
407  auto Deps = ExprDependence::None;
408 
409  if (auto *NNS = E->getQualifier())
410  Deps |= toExprDependence(NNS->getDependence() &
411  ~NestedNameSpecifierDependence::Dependent);
412 
413  if (auto *FirstArg = E->getTemplateArgs()) {
414  unsigned NumArgs = E->getNumTemplateArgs();
415  for (auto *Arg = FirstArg, *End = FirstArg + NumArgs; Arg < End; ++Arg)
416  Deps |= toExprDependence(Arg->getArgument().getDependence());
417  }
418 
419  auto *Decl = E->getDecl();
420  auto Type = E->getType();
421 
422  if (Decl->isParameterPack())
423  Deps |= ExprDependence::UnexpandedPack;
425 
426  // (TD) C++ [temp.dep.expr]p3:
427  // An id-expression is type-dependent if it contains:
428  //
429  // and
430  //
431  // (VD) C++ [temp.dep.constexpr]p2:
432  // An identifier is value-dependent if it is:
433 
434  // (TD) - an identifier that was declared with dependent type
435  // (VD) - a name declared with a dependent type,
436  if (Type->isDependentType())
437  return Deps | ExprDependence::TypeValueInstantiation;
439  Deps |= ExprDependence::Instantiation;
440 
441  // (TD) - a conversion-function-id that specifies a dependent type
442  if (Decl->getDeclName().getNameKind() ==
444  QualType T = Decl->getDeclName().getCXXNameType();
445  if (T->isDependentType())
446  return Deps | ExprDependence::TypeValueInstantiation;
447 
449  Deps |= ExprDependence::Instantiation;
450  }
451 
452  // (VD) - the name of a non-type template parameter,
453  if (isa<NonTypeTemplateParmDecl>(Decl))
454  return Deps | ExprDependence::ValueInstantiation;
455 
456  // (VD) - a constant with integral or enumeration type and is
457  // initialized with an expression that is value-dependent.
458  // (VD) - a constant with literal type and is initialized with an
459  // expression that is value-dependent [C++11].
460  // (VD) - FIXME: Missing from the standard:
461  // - an entity with reference type and is initialized with an
462  // expression that is value-dependent [C++11]
463  if (VarDecl *Var = dyn_cast<VarDecl>(Decl)) {
464  if ((Ctx.getLangOpts().CPlusPlus11
465  ? Var->getType()->isLiteralType(Ctx)
466  : Var->getType()->isIntegralOrEnumerationType()) &&
467  (Var->getType().isConstQualified() ||
468  Var->getType()->isReferenceType())) {
469  if (const Expr *Init = Var->getAnyInitializer())
470  if (Init->isValueDependent()) {
471  Deps |= ExprDependence::ValueInstantiation;
472  }
473  }
474 
475  // (VD) - FIXME: Missing from the standard:
476  // - a member function or a static data member of the current
477  // instantiation
478  if (Var->isStaticDataMember() &&
479  Var->getDeclContext()->isDependentContext()) {
480  Deps |= ExprDependence::ValueInstantiation;
481  TypeSourceInfo *TInfo = Var->getFirstDecl()->getTypeSourceInfo();
482  if (TInfo->getType()->isIncompleteArrayType())
483  Deps |= ExprDependence::Type;
484  }
485 
486  return Deps;
487  }
488 
489  // (VD) - FIXME: Missing from the standard:
490  // - a member function or a static data member of the current
491  // instantiation
492  if (isa<CXXMethodDecl>(Decl) && Decl->getDeclContext()->isDependentContext())
493  Deps |= ExprDependence::ValueInstantiation;
494  return Deps;
495 }
496 
498  // Mark the expression as value- and instantiation- dependent to reuse
499  // existing suppressions for dependent code, e.g. avoiding
500  // constant-evaluation.
501  // FIXME: drop type+value+instantiation once Error is sufficient to suppress
502  // bogus dianostics.
503  auto D = toExprDependence(E->getType()->getDependence()) |
504  ExprDependence::ValueInstantiation | ExprDependence::Error;
505  for (auto *S : E->subExpressions())
506  D |= S->getDependence();
507  return D;
508 }
509 
511  return toExprDependence(E->getType()->getDependence()) &
512  ~ExprDependence::UnexpandedPack;
513 }
514 
516  llvm::ArrayRef<Expr *> PreArgs) {
517  auto D = E->getCallee()->getDependence();
518  for (auto *A : llvm::makeArrayRef(E->getArgs(), E->getNumArgs())) {
519  if (A)
520  D |= A->getDependence();
521  }
522  for (auto *A : PreArgs)
523  D |= A->getDependence();
524  return D;
525 }
526 
528  auto D = turnTypeToValueDependence(
530  for (unsigned I = 0, N = E->getNumExpressions(); I < N; ++I)
532  return D;
533 }
534 
536  auto *MemberDecl = E->getMemberDecl();
537  auto D = E->getBase()->getDependence();
538  if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl)) {
539  DeclContext *DC = MemberDecl->getDeclContext();
540  // dyn_cast_or_null is used to handle objC variables which do not
541  // have a declaration context.
542  CXXRecordDecl *RD = dyn_cast_or_null<CXXRecordDecl>(DC);
543  if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC)) {
544  if (!E->getType()->isDependentType())
545  D &= ~ExprDependence::Type;
546  }
547 
548  // Bitfield with value-dependent width is type-dependent.
549  if (FD && FD->isBitField() && FD->getBitWidth()->isValueDependent()) {
551  }
552  }
553  // FIXME: move remaining dependence computation from MemberExpr::Create()
554  return D;
555 }
556 
558  auto D = ExprDependence::None;
559  for (auto *A : E->inits())
560  D |= A->getDependence();
561  return D;
562 }
563 
565  auto D = toExprDependence(E->getType()->getDependence());
566  for (auto *C : llvm::makeArrayRef(E->getSubExprs(), E->getNumSubExprs()))
567  D |= C->getDependence();
568  return D;
569 }
570 
572  bool ContainsUnexpandedPack) {
573  auto D = ContainsUnexpandedPack ? ExprDependence::UnexpandedPack
575  for (auto *AE : E->getAssocExprs())
576  D |= AE->getDependence() & ExprDependence::Error;
578 
579  if (E->isResultDependent())
580  return D | ExprDependence::TypeValueInstantiation;
581  return D | (E->getResultExpr()->getDependence() &
582  ~ExprDependence::UnexpandedPack);
583 }
584 
586  auto Deps = E->getInit()->getDependence();
587  for (auto D : E->designators()) {
588  auto DesignatorDeps = ExprDependence::None;
589  if (D.isArrayDesignator())
590  DesignatorDeps |= E->getArrayIndex(D)->getDependence();
591  else if (D.isArrayRangeDesignator())
592  DesignatorDeps |= E->getArrayRangeStart(D)->getDependence() |
594  Deps |= DesignatorDeps;
595  if (DesignatorDeps & ExprDependence::TypeValue)
596  Deps |= ExprDependence::TypeValueInstantiation;
597  }
598  return Deps;
599 }
600 
602  auto D = O->getSyntacticForm()->getDependence();
603  for (auto *E : O->semantics())
604  D |= E->getDependence();
605  return D;
606 }
607 
609  auto D = ExprDependence::None;
610  for (auto *E : llvm::makeArrayRef(A->getSubExprs(), A->getNumSubExprs()))
611  D |= E->getDependence();
612  return D;
613 }
614 
616  auto D = toExprDependence(E->getType()->getDependence());
617  auto Size = E->getArraySize();
618  if (Size.hasValue() && *Size)
619  D |= turnTypeToValueDependence((*Size)->getDependence());
620  if (auto *I = E->getInitializer())
621  D |= turnTypeToValueDependence(I->getDependence());
622  for (auto *A : E->placement_arguments())
623  D |= turnTypeToValueDependence(A->getDependence());
624  return D;
625 }
626 
628  auto D = E->getBase()->getDependence();
629  if (!E->getDestroyedType().isNull())
631  if (auto *ST = E->getScopeTypeInfo())
633  toExprDependence(ST->getType()->getDependence()));
634  if (auto *Q = E->getQualifier())
635  D |= toExprDependence(Q->getDependence() &
636  ~NestedNameSpecifierDependence::Dependent);
637  return D;
638 }
639 
641  auto D = ExprDependence::None;
642  if (Name.isInstantiationDependent())
643  D |= ExprDependence::Instantiation;
645  D |= ExprDependence::UnexpandedPack;
646  return D;
647 }
648 
650 clang::computeDependence(OverloadExpr *E, bool KnownDependent,
651  bool KnownInstantiationDependent,
652  bool KnownContainsUnexpandedParameterPack) {
653  auto Deps = ExprDependence::None;
654  if (KnownDependent)
655  Deps |= ExprDependence::TypeValue;
656  if (KnownInstantiationDependent)
657  Deps |= ExprDependence::Instantiation;
658  if (KnownContainsUnexpandedParameterPack)
659  Deps |= ExprDependence::UnexpandedPack;
660  Deps |= getDependenceInExpr(E->getNameInfo());
661  if (auto *Q = E->getQualifier())
662  Deps |= toExprDependence(Q->getDependence() &
663  ~NestedNameSpecifierDependence::Dependent);
664  for (auto *D : E->decls()) {
665  if (D->getDeclContext()->isDependentContext() ||
666  isa<UnresolvedUsingValueDecl>(D))
667  Deps |= ExprDependence::TypeValueInstantiation;
668  }
669  // If we have explicit template arguments, check for dependent
670  // template arguments and whether they contain any unexpanded pack
671  // expansions.
672  for (auto A : E->template_arguments())
673  Deps |= toExprDependence(A.getArgument().getDependence());
674  return Deps;
675 }
676 
678  auto D = ExprDependence::TypeValue;
679  D |= getDependenceInExpr(E->getNameInfo());
680  if (auto *Q = E->getQualifier())
681  D |= toExprDependence(Q->getDependence());
682  for (auto A : E->template_arguments())
683  D |= toExprDependence(A.getArgument().getDependence());
684  return D;
685 }
686 
688  auto D = toExprDependence(E->getType()->getDependence());
689  for (auto *A : E->arguments())
690  D |= A->getDependence() & ~ExprDependence::Type;
691  return D;
692 }
693 
695  bool ContainsUnexpandedParameterPack) {
696  auto D = toExprDependence(E->getType()->getDependence());
697  if (ContainsUnexpandedParameterPack)
698  D |= ExprDependence::UnexpandedPack;
699  return D;
700 }
701 
703  auto D = ExprDependence::ValueInstantiation;
704  D |= toExprDependence(E->getType()->getDependence());
705  if (E->getType()->getContainedDeducedType())
707  for (auto *A : E->arguments())
708  D |= A->getDependence() &
709  (ExprDependence::UnexpandedPack | ExprDependence::Error);
710  return D;
711 }
712 
714  auto D = ExprDependence::TypeValueInstantiation;
715  if (!E->isImplicitAccess())
716  D |= E->getBase()->getDependence();
717  if (auto *Q = E->getQualifier())
718  D |= toExprDependence(Q->getDependence());
720  for (auto A : E->template_arguments())
721  D |= toExprDependence(A.getArgument().getDependence());
722  return D;
723 }
724 
726  return E->getSubExpr()->getDependence();
727 }
728 
730  auto D = ExprDependence::TypeValueInstantiation;
731  for (const auto *C : {E->getLHS(), E->getRHS()}) {
732  if (C)
733  D |= C->getDependence() & ~ExprDependence::UnexpandedPack;
734  }
735  return D;
736 }
737 
739  auto D = ExprDependence::None;
740  for (const auto *A : E->getArgs())
741  D |=
742  toExprDependence(A->getType()->getDependence()) & ~ExprDependence::Type;
743  return D;
744 }
745 
747  bool ValueDependent) {
749  const auto InterestingDeps = TemplateArgumentDependence::Instantiation |
750  TemplateArgumentDependence::UnexpandedPack;
751  for (const TemplateArgumentLoc &ArgLoc :
753  TA |= ArgLoc.getArgument().getDependence() & InterestingDeps;
754  if (TA == InterestingDeps)
755  break;
756  }
757 
758  ExprDependence D =
759  ValueDependent ? ExprDependence::Value : ExprDependence::None;
760  return D | toExprDependence(TA);
761 }
762 
764  auto D = ExprDependence::None;
765  Expr **Elements = E->getElements();
766  for (unsigned I = 0, N = E->getNumElements(); I != N; ++I)
767  D |= turnTypeToValueDependence(Elements[I]->getDependence());
768  return D;
769 }
770 
772  auto Deps = ExprDependence::None;
773  for (unsigned I = 0, N = E->getNumElements(); I < N; ++I) {
774  auto KV = E->getKeyValueElement(I);
775  auto KVDeps = turnTypeToValueDependence(KV.Key->getDependence() |
776  KV.Value->getDependence());
777  if (KV.EllipsisLoc.isValid())
778  KVDeps &= ~ExprDependence::UnexpandedPack;
779  Deps |= KVDeps;
780  }
781  return Deps;
782 }
783 
785  auto D = ExprDependence::None;
786  if (auto *R = E->getInstanceReceiver())
787  D |= R->getDependence();
788  else
789  D |= toExprDependence(E->getType()->getDependence());
790  for (auto *A : E->arguments())
791  D |= A->getDependence();
792  return D;
793 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
const Expr * getSubExpr() const
Definition: Expr.h:972
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1566
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1351
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5796
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:1059
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4727
Expr * getArrayIndex(const Designator &D) const
Definition: Expr.cpp:4368
Expr ** getArgs()
Retrieve the call arguments.
Definition: Expr.h:2900
Expr * getLHS() const
Definition: Expr.h:4004
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:5958
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:362
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1343
llvm::iterator_range< arg_iterator > placement_arguments()
Definition: ExprCXX.h:2306
A (possibly-)qualified type.
Definition: Type.h:655
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:3265
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:3133
Expr * getCond() const
Definition: Expr.h:4389
ExprDependence computeDependence(FullExpr *E)
const Expr * getSubExpr() const
Definition: ExprCXX.h:1167
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:4256
bool isSuperReceiver() const
Definition: ExprObjC.h:772
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2627
Expr * getResultExpr()
Return the result expression of this controlling expression.
Definition: Expr.h:5632
CompoundStmt * getSubStmt()
Definition: Expr.h:4191
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
Definition: Expr.h:5623
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2897
Expr * getDimensionExpression() const
Definition: ExprCXX.h:2762
Expr * getBase() const
Definition: Expr.h:3127
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:3324
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
const Expr * getSubExpr() const
Definition: Expr.h:4474
StringRef P
Expr * getBase()
Fetches base expression of array shaping expression.
Definition: ExprOpenMP.h:190
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2068
Expr * getLowerBound()
Get lower bound of array section.
Definition: ExprOpenMP.h:79
The base class of the type hierarchy.
Definition: Type.h:1472
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:3209
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1426
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2715
A container of type source information.
Definition: Type.h:6373
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: ExprCXX.h:2536
MS property subscript expression.
Definition: ExprCXX.h:960
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4414
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2463
Represents a variable declaration or definition.
Definition: Decl.h:820
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1482
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3291
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
Definition: Expr.h:5250
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:761
const Expr * getExprStmt() const
Definition: Stmt.cpp:334
unsigned getNumExpressions() const
Definition: Expr.h:2478
bool isParameterPack() const
Whether this declaration is a parameter pack.
Definition: DeclBase.cpp:211
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1147
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Definition: TemplateBase.h:633
Expr * getExprOperand() const
Definition: ExprCXX.h:852
Defines the clang::Expr interface and subclasses for C++ expressions.
Expr * getExprOperand() const
Definition: ExprCXX.h:1063
Represents a C99 designated initializer expression.
Definition: Expr.h:4846
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition: ExprCXX.h:302
MatchType Type
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2556
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4222
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:174
Expr * getInit() const
Retrieve the initializer value.
Definition: Expr.h:5084
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:6228
FullExpr - Represents a "full-expression" node.
Definition: Expr.h:959
Represents a member of a struct/union/class.
Definition: Decl.h:2740
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]...[sn])expr.
Definition: ExprOpenMP.h:122
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5144
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition: ExprCXX.h:2948
Stmt * getStmtExprResult()
Definition: Stmt.h:1458
ExprDependence toExprDependence(TemplateArgumentDependence TA)
Computes dependencies of a reference with the name having template arguments with TA dependencies...
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:321
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1140
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5724
Expr * getSubExpr()
Definition: Expr.h:3400
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:190
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:3008
Expr * getLHS() const
Definition: ExprCXX.h:4551
Describes an C or C++ initializer list.
Definition: Expr.h:4615
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:809
Expr * getKeyExpr() const
Definition: ExprObjC.h:883
Optional< Expr * > getArraySize()
Definition: ExprCXX.h:2226
Expr * getBaseExpr() const
Definition: ExprObjC.h:880
Expr * getOperand() const
Definition: ExprCXX.h:3975
ArrayRef< Expr * > getDimensions() const
Fetches the dimensions for array shaping expression.
Definition: ExprOpenMP.h:180
Expr * getInitializer()
The initializer of this new-expression.
Definition: ExprCXX.h:2276
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:248
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3632
bool isClassReceiver() const
Definition: ExprObjC.h:773
TypeDependence getDependence() const
Definition: Type.h:2174
Expr * getRHS() const
Definition: ExprCXX.h:4552
ArrayRef< Expr * > subExpressions()
Definition: Expr.h:6236
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition: ExprCXX.h:2957
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3361
Expr * getOperand() const
Definition: ExprCXX.h:4750
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1378
Expr * getCommonExpr() const
Definition: ExprCXX.h:4651
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1822
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:182
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
bool isTypeOperand() const
Definition: ExprCXX.h:1052
Represents the this expression in C++.
Definition: ExprCXX.h:1108
Expr ** getSubExprs()
Retrieve the array of expressions.
Definition: Expr.h:4259
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:45
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3970
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2479
QualType getQueriedType() const
Definition: ExprCXX.h:2756
Expr ** getSubExprs()
Definition: Expr.h:6115
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2505
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
Definition: ExprCXX.h:2685
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4458
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.h:3601
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition: Expr.cpp:4680
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:5864
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:2055
Expr * getCond() const
Definition: Expr.h:3993
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:5049
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:619
This represents one expression.
Definition: Expr.h:110
SourceLocation End
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5784
Expr * getCallee()
Definition: Expr.h:2871
Expr * getSubExpr() const
Get the initializer to use for each array element.
Definition: Expr.h:5255
QualType getArgumentType() const
Definition: Expr.h:2547
arg_range arguments()
Definition: ExprCXX.h:1558
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:306
DeclContext * getDeclContext()
Definition: DeclBase.h:439
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2442
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:5845
ArrayRef< Expr * > inits()
Definition: Expr.h:4655
QualType getType() const
Definition: Expr.h:142
ArrayRef< Expr * > getAssocExprs() const
Definition: Expr.h:5641
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4524
QualType getEncodedType() const
Definition: ExprObjC.h:428
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
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:2119
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
Definition: Expr.cpp:4894
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:889
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4206
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1138
ValueDecl * getDecl()
Definition: Expr.h:1250
const Expr * getSubExpr() const
Definition: Expr.h:2083
const Expr * getSubExpr() const
Definition: ExprCXX.h:1400
llvm::iterator_range< semantics_iterator > semantics()
Definition: Expr.h:5995
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:720
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2629
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: ASTConcept.h:158
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3626
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:3193
Expr * getArgument()
Definition: ExprCXX.h:2401
CanThrowResult
Possible results from evaluation of a noexcept expression.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:1090
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4290
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2842
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5914
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
Definition: Expr.cpp:4890
Expr * getSubExpr() const
Definition: Expr.h:2166
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2101
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:360
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:6048
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2536
Expr * getArrayRangeStart(const Designator &D) const
Definition: Expr.cpp:4373
Expr * getSubExpr()
Definition: ExprObjC.h:144
An expression trait intrinsic.
Definition: ExprCXX.h:2785
ArrayRef< Expr * > exprs()
Definition: Expr.h:5392
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4174
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:128
bool isArgumentType() const
Definition: Expr.h:2546
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:3720
unsigned numOfIterators() const
Returns number of iterator definitions.
Definition: ExprOpenMP.h:375
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2193
ExprDependence getDependence() const
Definition: Expr.h:156
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3153
const Expr * getInitializer() const
Definition: Expr.h:3314
Expr * getLHS() const
Definition: Expr.h:3681
Expr ** getElements()
Retrieve elements of array of literals.
Definition: ExprObjC.h:221
Represents a C11 generic selection.
Definition: Expr.h:5442
const Expr * getBase() const
Definition: Expr.h:5741
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1250
bool isCurrentInstantiation(const DeclContext *CurContext) const
Determine whether this dependent class is a current instantiation, when viewed from within the given ...
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:4086
bool isTypeOperand() const
Definition: ExprCXX.h:841
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
Definition: Expr.h:5620
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
Definition: Type.cpp:1892
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1912
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1299
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2360
StmtClass getStmtClass() const
Definition: Stmt.h:1148
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4012
Iterator range representation begin:end[:step].
Definition: ExprOpenMP.h:254
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:848
Expr * getArrayRangeEnd(const Designator &D) const
Definition: Expr.cpp:4379
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3958
bool isIncompleteArrayType() const
Definition: Type.h:6724
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:451
Expr * getBase() const
Definition: ExprObjC.h:1507
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2600
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition: ExprObjC.h:229
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
const Expr * getBase() const
Definition: ExprObjC.h:580
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
Represents an expression that might suspend coroutine execution; either a co_await or co_yield expres...
Definition: ExprCXX.h:4606
Expr * getRHS() const
Definition: Expr.h:4393
llvm::iterator_range< decls_iterator > decls() const
Definition: ExprCXX.h:2940
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
Definition: DeclBase.h:529
Expr * getResumeExpr() const
Definition: ExprCXX.h:4666
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:4310
QualType getSuperReceiverType() const
Definition: ExprObjC.h:763
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3050
llvm::iterator_range< arg_iterator > arguments()
Definition: ExprObjC.h:1453
Defines Expressions and AST nodes for C++2a concepts.
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
Represents a loop initializing the elements of an array.
Definition: Expr.h:5235
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4349
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4032
Expr * getRHS() const
Definition: Expr.h:4005
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
Definition: ExprConcepts.h:40
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3609
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2756
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:4041
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2678
Expr * getLHS() const
Definition: Expr.h:4391
bool isObjectReceiver() const
Definition: ExprObjC.h:771
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2185
static ExprDependence getDependenceInExpr(DeclarationNameInfo Name)
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:284
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1178
Expr * getRHS() const
Definition: Expr.h:3683
ExprDependence turnTypeToValueDependence(ExprDependence D)
bool isConditionDependent() const
Definition: Expr.h:4379
const Expr * getBase() const
Definition: ExprObjC.h:752
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition: Expr.h:1277
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2400
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2822
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1022
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:4067
TypeSourceInfo * getWrittenTypeInfo() const
Definition: Expr.h:4482
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
Definition: ExprCXX.h:4431
const LangOptions & getLangOpts() const
Definition: ASTContext.h:664
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
Definition: Expr.h:4372
Expr * getBaseExpr() const
Definition: ExprCXX.h:942
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5324
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6384
Expr * getLength()
Get length of array section.
Definition: ExprOpenMP.h:87
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3652
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
Definition: Expr.cpp:2943
Expr * getBase()
An array section can be written only as Base[LowerBound:Length].
Definition: ExprOpenMP.h:70