Lines Matching +full:openmp +full:- +full:build

1 //===------- TreeTransform.h - Semantic Tree Transformation -----*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
67 /// transformation is performed for non-type template parameters and
70 /// This tree-transformation template uses static polymorphism to allow
87 /// most coarse-grained transformations involve replacing TransformType(),
92 /// For more fine-grained transformations, subclasses can replace any of the
107 /// default locations and entity names used for type-checking
111 /// Private RAII object that helps us forget and then re-remember
112 /// the template argument corresponding to a partially-substituted parameter
117 // Set the pack expansion index to -1 to avoid pack substitution and
123 : Self(Self), ResetPackSubstIndex(Self.getSema(), -1) {
136 /// cases where we are forced to build new declarations within the transformer
168 bool AlwaysRebuild() { return SemaRef.ArgumentPackSubstitutionIndex != -1; }
185 /// By default, returns no source-location information. Subclasses can
230 /// to short-circuit evaluation when it is known that a given type will
232 /// non-dependent types.
252 return E->isDefaultArgument();
277 /// when extending explicitly-specified template argument packs per
301 /// "Forget" about the partially-substituted pack template argument,
310 /// "Remember" the partially-substituted pack template argument
332 /// Transforms the given type-with-location into a new
333 /// type-with-location.
336 /// appropriate TransformXXXType to build a new type. Subclasses
342 /// Transform the given type-with-location into a new
384 /// \returns the transformed OpenMP clause.
400 // specific kind of statement attribute. Unlike the non-statement taking
419 // delegates to the non-statement taking version.
432 /// appropriate TransformXXXExpr function to build a new expression.
461 /// function-call arguments, and any arguments that should be dropped, will
467 /// \param ArgChanged If non-NULL, will be set \c true if any argument changed
485 return Known->second;
527 /// nested-name-specifier in a member access expression.
530 /// identifier in a nested-name-specifier of a member access expression, e.g.,
531 /// the \c T in \c x->T::member
543 /// Transform the given nested-name-specifier with source-location
547 /// nested-name-specifier. Subclasses may override this function to provide
575 /// \param SS The nested-name-specifier that qualifies the template
576 /// name. This nested-name-specifier must already have been transformed.
586 /// \param FirstQualifierInScope If the first part of a nested-name-specifier
591 /// and nested-name-specifiers that occur within the template name.
620 /// should override the iterator-based member template version.
716 /// LastParamTransformed, if non-null, will be set to the index of the last
760 /// Transforms a single function-type parameter. Return null
763 /// \param indexAdjustment - A number to add to the parameter's
770 /// Transform the body of a lambda-expression.
779 LSI->Lambda->getLambdaDependencyKind());
827 #include "llvm/Frontend/OpenMP/OMP.inc"
829 /// Build a new qualified type given its unqualified type and type location.
837 /// Build a new pointer type given its pointee type.
843 /// Build a new block pointer type given its pointee type.
849 /// Build a new reference type given the type it references.
861 /// Build a new member pointer type given the pointee type and the
875 /// Build an Objective-C object type.
889 /// Build a new Objective-C object pointer type given the pointee type.
896 /// Build a new array type given the element type, size
907 /// Build a new constant array type given the element type, size
918 /// Build a new incomplete array type given the element type, size
928 /// Build a new variable-length array type given the element type,
938 /// Build a new dependent-sized array type given the element type,
949 /// Build a new vector type given the element type and
957 /// Build a new potentially dependently-sized extended vector type
965 /// Build a new extended vector type given the element type and
973 /// Build a new potentially dependently-sized extended vector type
982 /// Build a new matrix type given the element type and dimensions.
986 /// Build a new matrix type given the type and dependently-defined
992 /// Build a new DependentAddressSpaceType or return the pointee
1004 /// Build a new function type.
1012 /// Build a new unprototyped function type.
1019 /// Build a new type found via an alias.
1024 /// Build a new typedef type.
1029 /// Build a new MacroDefined type.
1035 /// Build a new class/struct/union type.
1040 /// Build a new Enum type.
1045 /// Build a new typeof(expr) type.
1052 /// Build a new typeof(type) type.
1057 /// Build a new unary transform type.
1062 /// Build a new C++11 decltype type.
1074 /// Build a new C++11 auto type.
1097 /// Build a new template specialization type.
1106 /// Build a new parenthesized type.
1114 /// Build a new qualified name type.
1117 /// the nested-name-specifier and the named type.
1128 /// Build a new typename type that refers to a template-id.
1131 /// nested-name-specifier and the given type. Subclasses may override
1158 // Otherwise, make an elaborated type wrapping a non-dependent
1168 /// Build a new typename type that refers to an identifier.
1182 if (QualifierLoc.getNestedNameSpecifier()->isDependent()) {
1183 // If the name is still dependent, just build a new dependent name type.
1198 // We had a dependent elaborated-type-specifier that has been transformed
1199 // into a non-dependent elaborated-type-specifier. Find the tag we're
1222 llvm_unreachable("Tag lookup cannot find non-tags");
1242 SemaRef.Diag(SomeDecl->getLocation(), diag::note_declared_at);
1257 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1261 // Build the elaborated-type-specifier type.
1268 /// Build a new pack expansion type.
1279 /// Build a new atomic type given its value type.
1285 /// Build a new pipe type given its value type.
1289 /// Build a bit-precise int given its value type.
1293 /// Build a dependent bit-precise int given its value type.
1297 /// Build a new template name given a nested name specifier, a flag
1307 /// Build a new template name given a nested name specifier and the
1321 /// Build a new template name given a nested name specifier and the
1334 /// Build a new template name given a template template parameter pack
1348 /// Build a new compound statement.
1350 /// By default, performs semantic analysis to build the new statement.
1360 /// Build a new case statement.
1362 /// By default, performs semantic analysis to build the new statement.
1375 /// By default, performs semantic analysis to build the new statement.
1382 /// Build a new default statement.
1384 /// By default, performs semantic analysis to build the new statement.
1393 /// Build a new label statement.
1395 /// By default, performs semantic analysis to build the new statement.
1402 /// Build a new attributed statement.
1404 /// By default, performs semantic analysis to build the new statement.
1414 /// Build a new "if" statement.
1416 /// By default, performs semantic analysis to build the new statement.
1428 /// By default, performs semantic analysis to build the new statement.
1440 /// By default, performs semantic analysis to build the new statement.
1447 /// Build a new while statement.
1449 /// By default, performs semantic analysis to build the new statement.
1457 /// Build a new do-while statement.
1459 /// By default, performs semantic analysis to build the new statement.
1468 /// Build a new for statement.
1470 /// By default, performs semantic analysis to build the new statement.
1480 /// Build a new goto statement.
1482 /// By default, performs semantic analysis to build the new statement.
1489 /// Build a new indirect goto statement.
1491 /// By default, performs semantic analysis to build the new statement.
1499 /// Build a new return statement.
1501 /// By default, performs semantic analysis to build the new statement.
1507 /// Build a new declaration statement.
1509 /// By default, performs semantic analysis to build the new statement.
1517 /// Build a new inline asm statement.
1519 /// By default, performs semantic analysis to build the new statement.
1533 /// Build a new MS style inline asm statement.
1535 /// By default, performs semantic analysis to build the new statement.
1550 /// Build a new co_return statement.
1552 /// By default, performs semantic analysis to build the new statement.
1559 /// Build a new co_await expression.
1561 /// By default, performs semantic analysis to build the new expression.
1566 // This function rebuilds a coawait-expr given its operator.
1567 // For an explicit coawait-expr, the rebuild involves the full set
1570 // For an implicit coawait-expr, we need to rebuild the "operator
1587 /// Build a new co_await expression.
1589 /// By default, performs semantic analysis to build the new expression.
1597 /// Build a new co_yield expression.
1599 /// By default, performs semantic analysis to build the new expression.
1609 /// Build a new Objective-C \@try statement.
1611 /// By default, performs semantic analysis to build the new statement.
1621 /// Rebuild an Objective-C exception declaration.
1623 /// By default, performs semantic analysis to build the new declaration.
1628 TInfo, T, ExceptionDecl->getInnerLocStart(),
1629 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
1632 /// Build a new Objective-C \@catch statement.
1634 /// By default, performs semantic analysis to build the new statement.
1643 /// Build a new Objective-C \@finally statement.
1645 /// By default, performs semantic analysis to build the new statement.
1652 /// Build a new Objective-C \@throw statement.
1654 /// By default, performs semantic analysis to build the new statement.
1661 /// Build a new OpenMP Canonical loop.
1666 return getSema().OpenMP().ActOnOpenMPCanonicalLoop(LoopStmt);
1669 /// Build a new OpenMP executable directive.
1671 /// By default, performs semantic analysis to build the new statement.
1680 return getSema().OpenMP().ActOnOpenMPExecutableDirective(
1684 /// Build a new OpenMP informational directive.
1692 return getSema().OpenMP().ActOnOpenMPInformationalDirective(
1696 /// Build a new OpenMP 'if' clause.
1698 /// By default, performs semantic analysis to build the new OpenMP clause.
1706 return getSema().OpenMP().ActOnOpenMPIfClause(
1711 /// Build a new OpenMP 'final' clause.
1713 /// By default, performs semantic analysis to build the new OpenMP clause.
1718 return getSema().OpenMP().ActOnOpenMPFinalClause(Condition, StartLoc,
1722 /// Build a new OpenMP 'num_threads' clause.
1724 /// By default, performs semantic analysis to build the new OpenMP clause.
1730 return getSema().OpenMP().ActOnOpenMPNumThreadsClause(NumThreads, StartLoc,
1734 /// Build a new OpenMP 'safelen' clause.
1736 /// By default, performs semantic analysis to build the new OpenMP clause.
1741 return getSema().OpenMP().ActOnOpenMPSafelenClause(Len, StartLoc, LParenLoc,
1745 /// Build a new OpenMP 'simdlen' clause.
1747 /// By default, performs semantic analysis to build the new OpenMP clause.
1752 return getSema().OpenMP().ActOnOpenMPSimdlenClause(Len, StartLoc, LParenLoc,
1760 return getSema().OpenMP().ActOnOpenMPSizesClause(Sizes, StartLoc, LParenLoc,
1764 /// Build a new OpenMP 'permutation' clause.
1769 return getSema().OpenMP().ActOnOpenMPPermutationClause(PermExprs, StartLoc,
1773 /// Build a new OpenMP 'full' clause.
1776 return getSema().OpenMP().ActOnOpenMPFullClause(StartLoc, EndLoc);
1779 /// Build a new OpenMP 'partial' clause.
1783 return getSema().OpenMP().ActOnOpenMPPartialClause(Factor, StartLoc,
1787 /// Build a new OpenMP 'allocator' clause.
1789 /// By default, performs semantic analysis to build the new OpenMP clause.
1794 return getSema().OpenMP().ActOnOpenMPAllocatorClause(A, StartLoc, LParenLoc,
1798 /// Build a new OpenMP 'collapse' clause.
1800 /// By default, performs semantic analysis to build the new OpenMP clause.
1805 return getSema().OpenMP().ActOnOpenMPCollapseClause(Num, StartLoc,
1809 /// Build a new OpenMP 'default' clause.
1811 /// By default, performs semantic analysis to build the new OpenMP clause.
1817 return getSema().OpenMP().ActOnOpenMPDefaultClause(
1821 /// Build a new OpenMP 'proc_bind' clause.
1823 /// By default, performs semantic analysis to build the new OpenMP clause.
1830 return getSema().OpenMP().ActOnOpenMPProcBindClause(
1834 /// Build a new OpenMP 'schedule' clause.
1836 /// By default, performs semantic analysis to build the new OpenMP clause.
1843 return getSema().OpenMP().ActOnOpenMPScheduleClause(
1848 /// Build a new OpenMP 'ordered' clause.
1850 /// By default, performs semantic analysis to build the new OpenMP clause.
1855 return getSema().OpenMP().ActOnOpenMPOrderedClause(StartLoc, EndLoc,
1859 /// Build a new OpenMP 'private' clause.
1861 /// By default, performs semantic analysis to build the new OpenMP clause.
1867 return getSema().OpenMP().ActOnOpenMPPrivateClause(VarList, StartLoc,
1871 /// Build a new OpenMP 'firstprivate' clause.
1873 /// By default, performs semantic analysis to build the new OpenMP clause.
1879 return getSema().OpenMP().ActOnOpenMPFirstprivateClause(VarList, StartLoc,
1883 /// Build a new OpenMP 'lastprivate' clause.
1885 /// By default, performs semantic analysis to build the new OpenMP clause.
1894 return getSema().OpenMP().ActOnOpenMPLastprivateClause(
1898 /// Build a new OpenMP 'shared' clause.
1900 /// By default, performs semantic analysis to build the new OpenMP clause.
1906 return getSema().OpenMP().ActOnOpenMPSharedClause(VarList, StartLoc,
1910 /// Build a new OpenMP 'reduction' clause.
1912 /// By default, performs semantic analysis to build the new statement.
1921 return getSema().OpenMP().ActOnOpenMPReductionClause(
1926 /// Build a new OpenMP 'task_reduction' clause.
1928 /// By default, performs semantic analysis to build the new statement.
1936 return getSema().OpenMP().ActOnOpenMPTaskReductionClause(
1941 /// Build a new OpenMP 'in_reduction' clause.
1943 /// By default, performs semantic analysis to build the new statement.
1952 return getSema().OpenMP().ActOnOpenMPInReductionClause(
1957 /// Build a new OpenMP 'linear' clause.
1959 /// By default, performs semantic analysis to build the new OpenMP clause.
1966 return getSema().OpenMP().ActOnOpenMPLinearClause(
1971 /// Build a new OpenMP 'aligned' clause.
1973 /// By default, performs semantic analysis to build the new OpenMP clause.
1980 return getSema().OpenMP().ActOnOpenMPAlignedClause(
1984 /// Build a new OpenMP 'copyin' clause.
1986 /// By default, performs semantic analysis to build the new OpenMP clause.
1992 return getSema().OpenMP().ActOnOpenMPCopyinClause(VarList, StartLoc,
1996 /// Build a new OpenMP 'copyprivate' clause.
1998 /// By default, performs semantic analysis to build the new OpenMP clause.
2004 return getSema().OpenMP().ActOnOpenMPCopyprivateClause(VarList, StartLoc,
2008 /// Build a new OpenMP 'flush' pseudo clause.
2010 /// By default, performs semantic analysis to build the new OpenMP clause.
2016 return getSema().OpenMP().ActOnOpenMPFlushClause(VarList, StartLoc,
2020 /// Build a new OpenMP 'depobj' pseudo clause.
2022 /// By default, performs semantic analysis to build the new OpenMP clause.
2027 return getSema().OpenMP().ActOnOpenMPDepobjClause(Depobj, StartLoc,
2031 /// Build a new OpenMP 'depend' pseudo clause.
2033 /// By default, performs semantic analysis to build the new OpenMP clause.
2040 return getSema().OpenMP().ActOnOpenMPDependClause(
2044 /// Build a new OpenMP 'device' clause.
2046 /// By default, performs semantic analysis to build the new statement.
2053 return getSema().OpenMP().ActOnOpenMPDeviceClause(
2057 /// Build a new OpenMP 'map' clause.
2059 /// By default, performs semantic analysis to build the new OpenMP clause.
2068 return getSema().OpenMP().ActOnOpenMPMapClause(
2075 /// Build a new OpenMP 'allocate' clause.
2077 /// By default, performs semantic analysis to build the new OpenMP clause.
2088 return getSema().OpenMP().ActOnOpenMPAllocateClause(
2093 /// Build a new OpenMP 'num_teams' clause.
2095 /// By default, performs semantic analysis to build the new statement.
2101 return getSema().OpenMP().ActOnOpenMPNumTeamsClause(VarList, StartLoc,
2105 /// Build a new OpenMP 'thread_limit' clause.
2107 /// By default, performs semantic analysis to build the new statement.
2113 return getSema().OpenMP().ActOnOpenMPThreadLimitClause(VarList, StartLoc,
2117 /// Build a new OpenMP 'priority' clause.
2119 /// By default, performs semantic analysis to build the new statement.
2124 return getSema().OpenMP().ActOnOpenMPPriorityClause(Priority, StartLoc,
2128 /// Build a new OpenMP 'grainsize' clause.
2130 /// By default, performs semantic analysis to build the new statement.
2137 return getSema().OpenMP().ActOnOpenMPGrainsizeClause(
2141 /// Build a new OpenMP 'num_tasks' clause.
2143 /// By default, performs semantic analysis to build the new statement.
2150 return getSema().OpenMP().ActOnOpenMPNumTasksClause(
2154 /// Build a new OpenMP 'hint' clause.
2156 /// By default, performs semantic analysis to build the new statement.
2161 return getSema().OpenMP().ActOnOpenMPHintClause(Hint, StartLoc, LParenLoc,
2165 /// Build a new OpenMP 'detach' clause.
2167 /// By default, performs semantic analysis to build the new statement.
2172 return getSema().OpenMP().ActOnOpenMPDetachClause(Evt, StartLoc, LParenLoc,
2176 /// Build a new OpenMP 'dist_schedule' clause.
2178 /// By default, performs semantic analysis to build the new OpenMP clause.
2185 return getSema().OpenMP().ActOnOpenMPDistScheduleClause(
2189 /// Build a new OpenMP 'to' clause.
2191 /// By default, performs semantic analysis to build the new statement.
2200 return getSema().OpenMP().ActOnOpenMPToClause(
2205 /// Build a new OpenMP 'from' clause.
2207 /// By default, performs semantic analysis to build the new statement.
2216 return getSema().OpenMP().ActOnOpenMPFromClause(
2221 /// Build a new OpenMP 'use_device_ptr' clause.
2223 /// By default, performs semantic analysis to build the new OpenMP clause.
2227 return getSema().OpenMP().ActOnOpenMPUseDevicePtrClause(VarList, Locs);
2230 /// Build a new OpenMP 'use_device_addr' clause.
2232 /// By default, performs semantic analysis to build the new OpenMP clause.
2236 return getSema().OpenMP().ActOnOpenMPUseDeviceAddrClause(VarList, Locs);
2239 /// Build a new OpenMP 'is_device_ptr' clause.
2241 /// By default, performs semantic analysis to build the new OpenMP clause.
2245 return getSema().OpenMP().ActOnOpenMPIsDevicePtrClause(VarList, Locs);
2248 /// Build a new OpenMP 'has_device_addr' clause.
2250 /// By default, performs semantic analysis to build the new OpenMP clause.
2254 return getSema().OpenMP().ActOnOpenMPHasDeviceAddrClause(VarList, Locs);
2257 /// Build a new OpenMP 'defaultmap' clause.
2259 /// By default, performs semantic analysis to build the new OpenMP clause.
2268 return getSema().OpenMP().ActOnOpenMPDefaultmapClause(
2272 /// Build a new OpenMP 'nontemporal' clause.
2274 /// By default, performs semantic analysis to build the new OpenMP clause.
2280 return getSema().OpenMP().ActOnOpenMPNontemporalClause(VarList, StartLoc,
2284 /// Build a new OpenMP 'inclusive' clause.
2286 /// By default, performs semantic analysis to build the new OpenMP clause.
2292 return getSema().OpenMP().ActOnOpenMPInclusiveClause(VarList, StartLoc,
2296 /// Build a new OpenMP 'exclusive' clause.
2298 /// By default, performs semantic analysis to build the new OpenMP clause.
2304 return getSema().OpenMP().ActOnOpenMPExclusiveClause(VarList, StartLoc,
2308 /// Build a new OpenMP 'uses_allocators' clause.
2310 /// By default, performs semantic analysis to build the new OpenMP clause.
2315 return getSema().OpenMP().ActOnOpenMPUsesAllocatorClause(
2319 /// Build a new OpenMP 'affinity' clause.
2321 /// By default, performs semantic analysis to build the new OpenMP clause.
2328 return getSema().OpenMP().ActOnOpenMPAffinityClause(
2332 /// Build a new OpenMP 'order' clause.
2334 /// By default, performs semantic analysis to build the new OpenMP clause.
2340 return getSema().OpenMP().ActOnOpenMPOrderClause(
2344 /// Build a new OpenMP 'init' clause.
2346 /// By default, performs semantic analysis to build the new OpenMP clause.
2353 return getSema().OpenMP().ActOnOpenMPInitClause(
2357 /// Build a new OpenMP 'use' clause.
2359 /// By default, performs semantic analysis to build the new OpenMP clause.
2364 return getSema().OpenMP().ActOnOpenMPUseClause(InteropVar, StartLoc,
2368 /// Build a new OpenMP 'destroy' clause.
2370 /// By default, performs semantic analysis to build the new OpenMP clause.
2376 return getSema().OpenMP().ActOnOpenMPDestroyClause(
2380 /// Build a new OpenMP 'novariants' clause.
2382 /// By default, performs semantic analysis to build the new OpenMP clause.
2388 return getSema().OpenMP().ActOnOpenMPNovariantsClause(Condition, StartLoc,
2392 /// Build a new OpenMP 'nocontext' clause.
2394 /// By default, performs semantic analysis to build the new OpenMP clause.
2399 return getSema().OpenMP().ActOnOpenMPNocontextClause(Condition, StartLoc,
2403 /// Build a new OpenMP 'filter' clause.
2405 /// By default, performs semantic analysis to build the new OpenMP clause.
2410 return getSema().OpenMP().ActOnOpenMPFilterClause(ThreadID, StartLoc,
2414 /// Build a new OpenMP 'bind' clause.
2416 /// By default, performs semantic analysis to build the new OpenMP clause.
2423 return getSema().OpenMP().ActOnOpenMPBindClause(Kind, KindLoc, StartLoc,
2427 /// Build a new OpenMP 'ompx_dyn_cgroup_mem' clause.
2429 /// By default, performs semantic analysis to build the new OpenMP clause.
2434 return getSema().OpenMP().ActOnOpenMPXDynCGroupMemClause(Size, StartLoc,
2438 /// Build a new OpenMP 'ompx_attribute' clause.
2440 /// By default, performs semantic analysis to build the new OpenMP clause.
2446 return getSema().OpenMP().ActOnOpenMPXAttributeClause(Attrs, StartLoc,
2450 /// Build a new OpenMP 'ompx_bare' clause.
2452 /// By default, performs semantic analysis to build the new OpenMP clause.
2456 return getSema().OpenMP().ActOnOpenMPXBareClause(StartLoc, EndLoc);
2459 /// Build a new OpenMP 'align' clause.
2461 /// By default, performs semantic analysis to build the new OpenMP clause.
2466 return getSema().OpenMP().ActOnOpenMPAlignClause(A, StartLoc, LParenLoc,
2470 /// Build a new OpenMP 'at' clause.
2472 /// By default, performs semantic analysis to build the new OpenMP clause.
2478 return getSema().OpenMP().ActOnOpenMPAtClause(Kind, KwLoc, StartLoc,
2482 /// Build a new OpenMP 'severity' clause.
2484 /// By default, performs semantic analysis to build the new OpenMP clause.
2491 return getSema().OpenMP().ActOnOpenMPSeverityClause(Kind, KwLoc, StartLoc,
2495 /// Build a new OpenMP 'message' clause.
2497 /// By default, performs semantic analysis to build the new OpenMP clause.
2502 return getSema().OpenMP().ActOnOpenMPMessageClause(MS, StartLoc, LParenLoc,
2506 /// Build a new OpenMP 'doacross' clause.
2508 /// By default, performs semantic analysis to build the new OpenMP clause.
2515 return getSema().OpenMP().ActOnOpenMPDoacrossClause(
2519 /// Build a new OpenMP 'holds' clause.
2523 return getSema().OpenMP().ActOnOpenMPHoldsClause(A, StartLoc, LParenLoc,
2527 /// Rebuild the operand to an Objective-C \@synchronized statement.
2529 /// By default, performs semantic analysis to build the new statement.
2536 /// Build a new Objective-C \@synchronized statement.
2538 /// By default, performs semantic analysis to build the new statement.
2545 /// Build a new Objective-C \@autoreleasepool statement.
2547 /// By default, performs semantic analysis to build the new statement.
2554 /// Build a new Objective-C fast enumeration statement.
2556 /// By default, performs semantic analysis to build the new statement.
2572 /// Build a new C++ exception declaration.
2574 /// By default, performs semantic analysis to build the new decaration.
2584 getSema().CurContext->addDecl(Var);
2588 /// Build a new C++ catch statement.
2590 /// By default, performs semantic analysis to build the new statement.
2599 /// Build a new C++ try statement.
2601 /// By default, performs semantic analysis to build the new statement.
2608 /// Build a new C++0x range-based for statement.
2610 /// By default, performs semantic analysis to build the new statement.
2617 // If we've just learned that the range is actually an Objective-C
2618 // collection, treat this as an Objective-C fast enumeration loop.
2620 if (RangeStmt->isSingleDecl()) {
2621 if (VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2622 if (RangeVar->isInvalidDecl())
2625 Expr *RangeExpr = RangeVar->getInit();
2626 if (!RangeExpr->isTypeDependent() &&
2627 RangeExpr->getType()->isObjCObjectPointerType()) {
2628 // FIXME: Support init-statements in Objective-C++20 ranged for
2631 return SemaRef.Diag(Init->getBeginLoc(),
2633 << Init->getSourceRange();
2647 /// Build a new C++0x range-based for statement.
2649 /// By default, performs semantic analysis to build the new statement.
2660 /// Attach body to a C++0x range-based for statement.
2690 /// Build a new predefined expression.
2692 /// By default, performs semantic analysis to build the new expression.
2698 /// Build a new expression that references a declaration.
2700 /// By default, performs semantic analysis to build the new expression.
2709 /// Build a new expression that references a declaration.
2711 /// By default, performs semantic analysis to build the new expression.
2724 /// Build a new expression in parentheses.
2726 /// By default, performs semantic analysis to build the new expression.
2733 /// Build a new pseudo-destructor expression.
2735 /// By default, performs semantic analysis to build the new expression.
2746 /// Build a new unary operator expression.
2748 /// By default, performs semantic analysis to build the new expression.
2756 /// Build a new builtin offsetof expression.
2758 /// By default, performs semantic analysis to build the new expression.
2768 /// Build a new sizeof, alignof or vec_step expression with a
2771 /// By default, performs semantic analysis to build the new expression.
2780 /// Build a new sizeof, alignof or vec step expression with an
2783 /// By default, performs semantic analysis to build the new expression.
2796 /// Build a new array subscript expression.
2798 /// By default, performs semantic analysis to build the new expression.
2809 /// Build a new matrix subscript expression.
2811 /// By default, performs semantic analysis to build the new expression.
2820 /// Build a new array section expression.
2822 /// By default, performs semantic analysis to build the new expression.
2832 return getSema().OpenMP().ActOnOMPArraySectionExpr(
2843 /// Build a new array shaping expression.
2845 /// By default, performs semantic analysis to build the new expression.
2851 return getSema().OpenMP().ActOnOMPArrayShapingExpr(
2855 /// Build a new iterator expression.
2857 /// By default, performs semantic analysis to build the new expression.
2863 return getSema().OpenMP().ActOnOMPIteratorExpr(
2867 /// Build a new call expression.
2869 /// By default, performs semantic analysis to build the new expression.
2886 /// Build a new member access expression.
2888 /// By default, performs semantic analysis to build the new expression.
2901 if (!Member->getDeclName()) {
2905 assert(Member->getType()->isRecordType() &&
2917 // from the AST, so we need to re-insert them if needed (since
2919 if (!isArrow && Base->isPRValue()) {
2929 DeclAccessPair::make(FoundDecl, FoundDecl->getAccess()),
2937 if (Base->containsErrors())
2940 QualType BaseType = Base->getType();
2942 if (isArrow && !BaseType->isPointerType())
2951 if (getSema().isUnevaluatedContext() && Base->isImplicitCXXThis() &&
2954 ->getType()
2955 ->getPointeeType()
2956 ->getAsCXXRecordDecl()) {
2957 auto *Class = cast<CXXRecordDecl>(Member->getDeclContext());
2960 if (!ThisClass->Equals(Class) && !ThisClass->isDerivedFrom(Class))
2961 return getSema().BuildDeclRefExpr(Member, Member->getType(),
2962 VK_LValue, Member->getLocation());
2973 /// Build a new binary operator expression.
2975 /// By default, performs semantic analysis to build the new expression.
2983 /// Build a new rewritten operator expression.
2985 /// By default, performs semantic analysis to build the new expression.
2994 /// Build a new conditional operator expression.
2996 /// By default, performs semantic analysis to build the new expression.
3007 /// Build a new C-style cast expression.
3009 /// By default, performs semantic analysis to build the new expression.
3019 /// Build a new compound literal expression.
3021 /// By default, performs semantic analysis to build the new expression.
3031 /// Build a new extended vector element access expression.
3033 /// By default, performs semantic analysis to build the new expression.
3043 Base, Base->getType(), OpLoc, IsArrow, SS, SourceLocation(),
3049 /// Build a new initializer list expression.
3051 /// By default, performs semantic analysis to build the new expression.
3059 /// Build a new designated initializer expression.
3061 /// By default, performs semantic analysis to build the new expression.
3077 /// Build a new value-initialized expression.
3086 /// Build a new \c va_arg expression.
3088 /// By default, performs semantic analysis to build the new expression.
3098 /// Build a new expression list in parentheses.
3100 /// By default, performs semantic analysis to build the new expression.
3108 /// Build a new address-of-label expression.
3118 /// Build a new GNU statement expression.
3120 /// By default, performs semantic analysis to build the new expression.
3128 /// Build a new __builtin_choose_expr expression.
3130 /// By default, performs semantic analysis to build the new expression.
3140 /// Build a new generic selection expression with an expression predicate.
3142 /// By default, performs semantic analysis to build the new expression.
3155 /// Build a new generic selection expression with a type predicate.
3157 /// By default, performs semantic analysis to build the new expression.
3170 /// Build a new overloaded operator call expression.
3172 /// By default, performs semantic analysis to build the new expression.
3176 /// argument-dependent lookup, etc. Subclasses may override this routine to
3185 /// Build a new C++ "named" cast expression, such as static_cast or
3188 /// By default, this routine dispatches to one of the more-specific routines
3230 /// Build a new C++ static_cast expression.
3232 /// By default, performs semantic analysis to build the new expression.
3247 /// Build a new C++ dynamic_cast expression.
3249 /// By default, performs semantic analysis to build the new expression.
3264 /// Build a new C++ reinterpret_cast expression.
3266 /// By default, performs semantic analysis to build the new expression.
3281 /// Build a new C++ const_cast expression.
3283 /// By default, performs semantic analysis to build the new expression.
3308 /// Build a new C++ functional-style cast expression.
3310 /// By default, performs semantic analysis to build the new expression.
3322 TInfo, LParenLoc, MultiExprArg(PLE->getExprs(), PLE->getNumExprs()),
3329 /// Build a new C++ __builtin_bit_cast expression.
3331 /// By default, performs semantic analysis to build the new expression.
3339 /// Build a new C++ typeid(type) expression.
3341 /// By default, performs semantic analysis to build the new expression.
3352 /// Build a new C++ typeid(expr) expression.
3354 /// By default, performs semantic analysis to build the new expression.
3364 /// Build a new C++ __uuidof(type) expression.
3366 /// By default, performs semantic analysis to build the new expression.
3374 /// Build a new C++ __uuidof(expr) expression.
3376 /// By default, performs semantic analysis to build the new expression.
3383 /// Build a new C++ "this" expression.
3385 /// By default, performs semantic analysis to build a new "this" expression.
3395 /// Build a new C++ throw expression.
3397 /// By default, performs semantic analysis to build the new expression.
3404 /// Build a new C++ default-argument expression.
3406 /// By default, builds a new default-argument expression, which does not
3415 /// Build a new C++11 default-initialization expression.
3425 /// Build a new C++ zero-initialization expression.
3427 /// By default, performs semantic analysis to build the new expression.
3436 /// Build a new C++ "new" expression.
3438 /// By default, performs semantic analysis to build the new expression.
3460 /// Build a new C++ "delete" expression.
3462 /// By default, performs semantic analysis to build the new expression.
3472 /// Build a new type trait expression.
3474 /// By default, performs semantic analysis to build the new expression.
3483 /// Build a new array type trait expression.
3485 /// By default, performs semantic analysis to build the new expression.
3495 /// Build a new expression trait expression.
3497 /// By default, performs semantic analysis to build the new expression.
3506 /// Build a new (previously unresolved) declaration reference
3509 /// By default, performs semantic analysis to build the new expression.
3529 /// Build a new template-id expression.
3531 /// By default, performs semantic analysis to build the new expression.
3542 /// Build a new object-construction expression.
3544 /// By default, performs semantic analysis to build the new expression.
3555 if (Constructor->isInheritingConstructor())
3556 FoundCtor = Constructor->getInheritedConstructor().getConstructor();
3573 /// Build a new implicit construction via inherited constructor
3583 /// Build a new object-construction expression.
3585 /// By default, performs semantic analysis to build the new expression.
3596 /// Build a new object-construction expression.
3598 /// By default, performs semantic analysis to build the new expression.
3609 /// Build a new member reference expression.
3611 /// By default, performs semantic analysis to build the new expression.
3633 /// Build a new member reference expression.
3635 /// By default, performs semantic analysis to build the new expression.
3655 /// Build a new noexcept expression.
3657 /// By default, performs semantic analysis to build the new expression.
3663 /// Build a new expression to compute the length of a parameter pack.
3690 /// Build a new expression representing a call to a source location
3693 /// By default, performs semantic analysis to build the new expression.
3703 /// Build a new Objective-C boxed expression.
3705 /// By default, performs semantic analysis to build the new expression.
3722 /// \brief Build a new requires expression.
3724 /// By default, performs semantic analysis to build the new expression.
3775 /// \brief Build a new Objective-C boxed expression.
3777 /// By default, performs semantic analysis to build the new expression.
3783 /// Build a new Objective-C array literal.
3785 /// By default, performs semantic analysis to build the new expression.
3801 /// Build a new Objective-C dictionary literal.
3803 /// By default, performs semantic analysis to build the new expression.
3810 /// Build a new Objective-C \@encode expression.
3812 /// By default, performs semantic analysis to build the new expression.
3821 /// Build a new Objective-C class message.
3830 ReceiverTypeInfo, ReceiverTypeInfo->getType(),
3835 /// Build a new Objective-C instance message.
3843 return SemaRef.ObjC().BuildInstanceMessage(Receiver, Receiver->getType(),
3849 /// Build a new Objective-C instance/class message to 'super'.
3858 return Method->isInstanceMethod()
3867 /// Build a new Objective-C ivar reference expression.
3869 /// By default, performs semantic analysis to build the new expression.
3875 DeclarationNameInfo NameInfo(Ivar->getDeclName(), IvarLoc);
3877 BaseArg, BaseArg->getType(),
3883 cast<ObjCIvarRefExpr>(Result.get())->setIsFreeIvar(IsFreeIvar);
3887 /// Build a new Objective-C property reference expression.
3889 /// By default, performs semantic analysis to build the new expression.
3895 DeclarationNameInfo NameInfo(Property->getDeclName(), PropertyLoc);
3896 return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(),
3906 /// Build a new Objective-C property reference expression.
3908 /// By default, performs semantic analysis to build the new expression.
3914 // Since these expressions can only be value-dependent, we do not
3922 /// Build a new Objective-C "isa" expression.
3924 /// By default, performs semantic analysis to build the new expression.
3930 return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(),
3939 /// Build a new shuffle vector expression.
3941 /// By default, performs semantic analysis to build the new expression.
3950 DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name));
3953 // Build a reference to the __builtin_shufflevector builtin
3958 QualType CalleePtrTy = SemaRef.Context.getPointerType(Builtin->getType());
3962 // Build the CallExpr
3964 SemaRef.Context, Callee, SubExprs, Builtin->getCallResultType(),
3965 Expr::getValueKindForType(Builtin->getReturnType()), RParenLoc,
3968 // Type-check the __builtin_shufflevector expression.
3972 /// Build a new convert vector expression.
3979 /// Build a new template argument pack expansion.
3981 /// By default, performs semantic analysis to build a new pack expansion
4020 return TemplateArgumentLoc(TemplateArgument(Expansion->getType()),
4028 /// Build a new expression pack expansion.
4030 /// By default, performs semantic analysis to build a new pack expansion
4038 /// Build a new C++1z fold-expression.
4040 /// By default, performs semantic analysis in order to build a new fold
4055 for (ParmVarDecl *PVD : LSI->CallOperator->parameters()) {
4056 if (Expr *Init = PVD->getInit())
4057 LSI->ContainsUnexpandedParameterPack |=
4058 Init->containsUnexpandedParameterPack();
4059 else if (PVD->hasUninstantiatedDefaultArg())
4060 LSI->ContainsUnexpandedParameterPack |=
4061 PVD->getUninstantiatedDefaultArg()
4062 ->containsUnexpandedParameterPack();
4067 /// Build an empty C++1z fold-expression with the given operator.
4069 /// By default, produces the fallback value for the fold-expression, or
4076 /// Build a new atomic operation expression.
4078 /// By default, performs semantic analysis to build the new expression.
4252 switch (S->getStmtClass()) {
4288 switch (S->getClauseKind()) {
4295 #include "llvm/Frontend/OpenMP/OMP.inc"
4307 switch (E->getStmtClass()) {
4328 Init = FE->getSubExpr();
4331 OpaqueValueExpr *OVE = AIL->getCommonExpr();
4332 Init = OVE->getSourceExpr();
4336 Init = MTE->getSubExpr();
4339 Init = Binder->getSubExpr();
4342 Init = ICE->getSubExprAsWritten();
4346 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
4348 // If this is copy-initialization, we only need to reconstruct
4349 // InitListExprs. Other forms of copy-initialization will be a no-op if
4352 if (!NotCopyInit && !(Construct && Construct->isListInitialization()))
4355 // Revert value-initialization back to empty parens.
4357 SourceRange Parens = VIE->getSourceRange();
4362 // FIXME: We shouldn't build ImplicitValueInitExprs for direct-initialization.
4374 if (Construct && Construct->isStdInitListInitialization())
4375 return TransformInitializer(Construct->getArg(0), NotCopyInit);
4377 // Enter a list-init context if this was list initialization.
4380 Construct->isListInitialization());
4388 if (getDerived().TransformExprs(Construct->getArgs(), Construct->getNumArgs(),
4393 if (Construct->isListInitialization())
4394 return getDerived().RebuildInitList(Construct->getBeginLoc(), NewArgs,
4395 Construct->getEndLoc());
4397 // Build a ParenListExpr to represent anything else.
4398 SourceRange Parens = Construct->getParenOrBraceRange();
4426 Expr *Pattern = Expansion->getPattern();
4436 std::optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
4438 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
4439 Pattern->getSourceRange(),
4449 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
4455 Expansion->getEllipsisLoc(),
4478 if (Out.get()->containsUnexpandedParameterPack()) {
4480 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4489 // forgetting the partially-substituted parameter pack.
4498 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
4528 getDerived().TransformDefinition(Var->getLocation(), Var));
4567 switch (QNNS->getKind()) {
4569 Sema::NestedNameSpecInfo IdInfo(QNNS->getAsIdentifier(),
4581 Q.getLocalBeginLoc(), QNNS->getAsNamespace()));
4589 Q.getLocalBeginLoc(), QNNS->getAsNamespaceAlias()));
4604 SourceLocation(), QNNS->getAsRecordDecl()));
4618 if (T->isDependentType() || T->isRecordType() ||
4619 (SemaRef.getLangOpts().CPlusPlus11 && T->isEnumeralType())) {
4620 if (T->isEnumeralType())
4633 // If the nested-name-specifier is an invalid type def, don't emit an
4636 if (!TTL || !TTL.getTypedefNameDecl()->isInvalidDecl()) {
4644 // The qualifier-in-scope and object type only apply to the leftmost entity.
4649 // Don't rebuild the nested-name-specifier if we don't have to.
4654 // If we can re-use the source-location data from the original
4655 // nested-name-specifier, do so.
4660 // Allocate new nested-name-specifier location information.
4704 NewCanTy = SemaRef.Context.getCanonicalType(NewTInfo->getType());
4737 TemplateDecl *Template = QTN->getUnderlyingTemplate().getAsTemplateDecl();
4747 SS.getScopeRep() == QTN->getQualifier() &&
4751 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
4763 SS.getScopeRep() == DTN->getQualifier() &&
4770 if (DTN->isIdentifier()) {
4773 *DTN->getIdentifier(),
4781 DTN->getOperator(), NameLoc,
4800 SubstPack->getArgumentPack(), SubstPack->getAssociatedDecl(),
4801 SubstPack->getIndex(), SubstPack->getFinal());
4831 // argument. We get here when substituting into an already-substituted
4878 Output = TemplateArgumentLoc(TemplateArgument(DI->getType()), DI);
4951 const TemplateArgumentLoc *operator->() const { return &Arg; }
4975 pointer operator->() const { return pointer(**this); }
5047 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
5079 // forgetting the partially-substituted parameter pack.
5108 //===----------------------------------------------------------------------===//
5110 //===----------------------------------------------------------------------===//
5127 return NewDI->getType();
5133 TemporaryBase Rebase(*this, DI->getTypeLoc().getBeginLoc(),
5135 if (getDerived().AlreadyTransformed(DI->getType()))
5140 TypeLoc TL = DI->getTypeLoc();
5175 return NewDI ? NewDI->getType() : QualType();
5181 if (!isa<DependentNameType>(DI->getType()))
5185 TemporaryBase Rebase(*this, DI->getTypeLoc().getBeginLoc(),
5187 if (getDerived().AlreadyTransformed(DI->getType()))
5192 TypeLoc TL = DI->getTypeLoc();
5266 // [When] adding cv-qualifications on top of the function type [...] the
5267 // cv-qualifiers are ignored.
5268 if (T->isFunctionType()) {
5275 // when the cv-qualifiers are introduced through the use of a typedef-name
5276 // or decltype-specifier [...] the cv-qualifiers are ignored.
5277 // Note that [dcl.ref]p1 lists all cases in which cv-qualifiers can be
5279 if (T->isReferenceType()) {
5286 // Suppress Objective-C lifetime qualifiers if they don't make sense for the
5289 if (!T->isObjCLifetimeType() && !T->isDependentType())
5292 // Objective-C ARC:
5296 if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
5298 QualType Deduced = AutoTy->getDeducedType();
5303 T = SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
5304 AutoTy->isDependentType(),
5306 AutoTy->getTypeConstraintConcept(),
5307 AutoTy->getTypeConstraintArguments());
5310 // already-qualified type.
5333 return TSI->getTypeLoc();
5343 if (getDerived().AlreadyTransformed(TSInfo->getType()))
5346 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
5365 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
5379 *SpecTL.getTypePtr()->getIdentifier(),
5474 if (PointeeType->getAs<ObjCObjectType>()) {
5476 // that an Objective-C class type is being replaced for 'T'. The
5493 // Objective-C ARC can add lifetime qualifiers to the type that we're
5495 TLB.TypeWasModifiedSafely(Result->getPointeeType());
5526 /// don't care whether the type itself is an l-value type or an r-value
5527 /// type; we only care if the type was *written* as an l-value type
5528 /// or an r-value type.
5535 // Note that this works with the pointee-as-written.
5542 PointeeType != T->getPointeeTypeAsWritten()) {
5544 T->isSpelledAsLValue(),
5550 // Objective-C ARC can add lifetime qualifiers to the type that we're
5553 Result->castAs<ReferenceType>()->getPointeeTypeAsWritten());
5555 // r-value references can be rebuilt as l-value references.
5597 QualType OldClsType = QualType(T->getClass(), 0);
5600 NewClsType = NewClsTInfo->getType();
5609 PointeeType != T->getPointeeType() ||
5619 const MemberPointerType *MPT = Result->getAs<MemberPointerType>();
5620 if (MPT && PointeeType != MPT->getPointeeType()) {
5621 assert(isa<AdjustedType>(MPT->getPointeeType()));
5622 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
5644 OldSize = const_cast<Expr*>(T->getSizeExpr());
5655 ElementType != T->getElementType() ||
5656 (T->getSizeExpr() && NewSize != OldSize)) {
5658 T->getSizeModifier(),
5659 T->getSize(), NewSize,
5660 T->getIndexTypeCVRQualifiers(),
5689 ElementType != T->getElementType()) {
5691 T->getSizeModifier(),
5692 T->getIndexTypeCVRQualifiers(),
5719 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
5732 ElementType != T->getElementType() ||
5733 Size != T->getSizeExpr()) {
5735 T->getSizeModifier(),
5737 T->getIndexTypeCVRQualifiers(),
5771 if (!origSize) origSize = T->getSizeExpr();
5783 ElementType != T->getElementType() ||
5786 T->getSizeModifier(),
5788 T->getIndexTypeCVRQualifiers(),
5815 ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
5821 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
5822 Size.get() != T->getSizeExpr()) {
5824 ElementType, Size.get(), T->getAttributeLoc(), T->getVectorKind());
5857 ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
5864 ElementType != T->getElementType() ||
5865 Size.get() != T->getSizeExpr()) {
5868 T->getAttributeLoc());
5891 QualType ElementType = getDerived().TransformType(T->getElementType());
5896 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType()) {
5898 ElementType, T->getNumRows(), T->getNumColumns());
5917 QualType ElementType = getDerived().TransformType(T->getElementType());
5928 origRows = T->getRowExpr();
5931 origColumns = T->getColumnExpr();
5947 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
5950 ElementType, rows, columns, T->getAttributeLoc());
5981 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
5987 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
5988 AddrSpace.get() != T->getAddrSpaceExpr()) {
5990 pointeeType, AddrSpace.get(), T->getAttributeLoc());
6021 ElementType != T->getElementType()) {
6022 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
6023 T->getVectorKind());
6044 ElementType != T->getElementType()) {
6046 T->getNumElements(),
6062 TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
6065 if (NumExpansions && isa<PackExpansionType>(OldDI->getType())) {
6068 TypeLoc OldTL = OldDI->getTypeLoc();
6072 TypeLoc NewTL = OldDI->getTypeLoc();
6100 OldParm->getDeclContext(),
6101 OldParm->getInnerLocStart(),
6102 OldParm->getLocation(),
6103 OldParm->getIdentifier(),
6104 NewDI->getType(),
6106 OldParm->getStorageClass(),
6108 newParm->setScopeInfo(OldParm->getFunctionScopeDepth(),
6109 OldParm->getFunctionScopeIndex() + indexAdjustment);
6130 assert(OldParm->getFunctionScopeIndex() == i);
6134 if (OldParm->isParameterPack()) {
6139 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
6149 OrigNumExpansions = ExpansionTL.getTypePtr()->getNumExpansions();
6162 Pattern.getType().getTypePtr()->getContainedAutoType();
6163 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
6184 OutParamTypes.push_back(NewParm->getType());
6186 PVars->push_back(NewParm);
6190 // forgetting the partially-substituted parameter pack.
6203 OutParamTypes.push_back(NewParm->getType());
6205 PVars->push_back(NewParm);
6209 // last thing we pushed, but we post-incremented indexAdjustment
6212 indexAdjustment--;
6220 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6225 assert(NewParm->isParameterPack() &&
6239 OutParamTypes.push_back(NewParm->getType());
6241 PVars->push_back(NewParm);
6255 QualType Pattern = Expansion->getPattern();
6279 if (NewType->containsUnexpandedParameterPack()) {
6291 PVars->push_back(nullptr);
6299 // forgetting the partially-substituted parameter pack.
6310 PVars->push_back(nullptr);
6315 OldType = Expansion->getPattern();
6317 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6334 PVars->push_back(nullptr);
6339 for (unsigned i = 0, e = PVars->size(); i != e; ++i)
6341 assert(parm->getFunctionScopeIndex() == i);
6380 if (T->hasTrailingReturn()) {
6383 TL.getTypePtr()->param_type_begin(),
6384 T->getExtParameterInfosOrNull(),
6392 // "pointer to cv-qualifier-seq X" between the optional cv-qualifer-seq
6393 // and the end of the function-definition, member-declarator, or
6411 TL.getTypePtr()->param_type_begin(),
6412 T->getExtParameterInfosOrNull(),
6417 FunctionProtoType::ExtProtoInfo EPI = T->getExtProtoInfo();
6457 // The condition expression has been transformed, and re-evaluated.
6478 NewFX->insert(NewEC, Errs);
6487 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType() ||
6488 T->getParamTypes() != llvm::ArrayRef(ParamTypes) || EPIChanged) {
6518 SemaRef, Method ? Method->getParent() : nullptr,
6519 Method ? Method->getMethodQualifiers() : Qualifiers{},
6545 T->getAs<PackExpansionType>()) {
6550 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6559 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6571 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6572 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6586 QualType U = getDerived().TransformType(PackExpansion->getPattern());
6619 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
6635 Decl *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
6640 if (getDerived().AlwaysRebuild() || D != T->getDecl()) {
6660 TL.getLocalSourceRange().getBegin(), T->getFoundDecl()));
6664 QualType Underlying = getDerived().TransformType(T->desugar());
6669 if (getDerived().AlwaysRebuild() || Found != T->getFoundDecl() ||
6670 Underlying != T->getUnderlyingType()) {
6686 T->getDecl()));
6692 Typedef != T->getDecl()) {
6721 TypeOfKind Kind = Result->castAs<TypeOfExprType>()->getKind();
6746 TypeOfKind Kind = Result->castAs<TypeOfType>()->getKind();
6748 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType(), Kind);
6772 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
6782 E.get() != T->getUnderlyingExpr()) {
6813 llvm::ArrayRef<QualType> Types = PIT->getExpansions();
6818 if (Types.empty() && !PIT->expandsToEmptyPack())
6822 if (!T->containsUnexpandedParameterPack()) {
6844 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6849 QualType Pack = getDerived().TransformType(TLB, TI->getTypeLoc());
6873 FullySubstituted &= !Out->containsUnexpandedParameterPack();
6876 // forgetting the partially-substituted parameter pack.
6890 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6909 if (Result->isDependentType()) {
6916 QualType NewBase = NewBaseTSI->getType();
6919 T->getUTTKind(),
6939 SS, T->getTemplateName(), TL.getTemplateNameLoc());
6943 QualType OldDeduced = T->getDeducedType();
6969 T->getDecl()));
6975 Record != T->getDecl()) {
6993 T->getDecl()));
6999 Enum != T->getDecl()) {
7016 TL.getTypePtr()->getDecl());
7046 getDerived().TransformDecl(TL.getNameLoc(), T->getAssociatedDecl());
7052 QualType Replacement = getDerived().TransformType(T->getReplacementType());
7057 Replacement, NewReplaced, T->getIndex(), T->getPackIndex());
7059 // Propagate type-source information.
7087 // The nested-name-specifier never matters in a TemplateSpecializationType,
7088 // because we can't have a dependent nested-name-specifier anyway.
7091 = getDerived().TransformTemplateName(SS, T->getTemplateName(),
7131 const PipeType *PT = Result->castAs<PipeType>();
7132 bool isReadPipe = PT->isReadOnly();
7151 Result = getDerived().RebuildBitIntType(EIT->isUnsigned(),
7152 EIT->getNumBits(), TL.getNameLoc());
7169 ExprResult BitsExpr = getDerived().TransformExpr(EIT->getNumBitsExpr());
7177 if (getDerived().AlwaysRebuild() || BitsExpr.get() != EIT->getNumBitsExpr()) {
7179 EIT->isUnsigned(), BitsExpr.get(), TL.getNameLoc());
7217 const TemplateArgumentLoc *operator->() const {
7241 return Container->getArgLoc(Index);
7244 pointer operator->() const {
7245 return pointer(Container->getArgLoc(Index));
7263 QualType OldDeduced = T->getDeducedType();
7274 if (T->isConstrained()) {
7277 TL.getConceptNameLoc(), T->getTypeConstraintConcept()));
7298 T->isDependentType() || T->isConstrained()) {
7304 Result = getDerived().RebuildAutoType(NewDeduced, T->getKeyword(), NewCD,
7315 if (T->isConstrained()) {
7317 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName(),
7319 TL.getTypePtr()->getTypeConstraintConcept()->getDeclName());
7322 TL.getFoundDecl(), TL.getTypePtr()->getTypeConstraintConcept(),
7406 TL.getTypePtr()->getKeyword(), DTN->getQualifier(),
7407 DTN->getIdentifier(), NewTemplateArgs.arguments());
7428 /// FIXME: Wrap this in an elaborated-type-specifier?
7462 // If the identifier resolves to a typedef-name or the simple-template-id
7464 // elaborated-type-specifier is ill-formed.
7465 if (T->getKeyword() != ElaboratedTypeKeyword::None &&
7466 T->getKeyword() != ElaboratedTypeKeyword::Typename) {
7468 NamedT->getAs<TemplateSpecializationType>()) {
7469 TemplateName Template = TST->getTemplateName();
7476 ElaboratedType::getTagTypeKindForKeyword(T->getKeyword()));
7477 SemaRef.Diag(TAT->getLocation(), diag::note_declared_at);
7485 NamedT != T->getNamedType()) {
7487 T->getKeyword(),
7517 modifiedType != oldType->getModifiedType()) {
7542 if (auto nullability = oldType->getImmediateNullability()) {
7543 if (!modifiedType->canHaveNullability()) {
7544 SemaRef.Diag((TL.getAttr() ? TL.getAttr()->getLocation()
7581 if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() ||
7585 InnerTy, NewCount, OldTy->isCountInBytes(), OldTy->isOrNull());
7610 QualType OldContainedTy = oldType->getContainedType();
7619 ContainedTy = ContainedTSI->getType();
7623 if (getDerived().AlwaysRebuild() || WrappedTy != oldType->getWrappedType() ||
7624 ContainedTy != oldType->getContainedType()) {
7626 WrappedTy, ContainedTy, oldType->getAttrs());
7693 = getDerived().RebuildDependentNameType(T->getKeyword(),
7696 T->getIdentifier(),
7702 if (const ElaboratedType* ElabT = Result->getAs<ElaboratedType>()) {
7703 QualType NamedT = ElabT->getNamedType();
7753 T->getKeyword(), QualifierLoc, TL.getTemplateKeywordLoc(),
7754 T->getIdentifier(), TL.getTemplateNameLoc(), NewTemplateArgs,
7760 QualType NamedT = ElabT->getNamedType();
7814 TL.getTypePtr()->getNumExpansions());
7839 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
7845 OTP != T->getDecl()) {
7848 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
7879 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
7880 QualType TypeArg = TypeArgInfo->getType();
7886 ->castAs<PackExpansionType>();
7888 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
7897 std::optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
7907 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
7969 llvm::ArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
8011 //===----------------------------------------------------------------------===//
8013 //===----------------------------------------------------------------------===//
8032 if (S->hasStoredFPFeatures())
8034 S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
8036 const Stmt *ExprResult = S->getStmtExprResult();
8040 for (auto *B : S->body()) {
8066 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
8068 S->getRBracLoc(),
8080 // Transform the left-hand case value.
8081 LHS = getDerived().TransformExpr(S->getLHS());
8082 LHS = SemaRef.ActOnCaseExpr(S->getCaseLoc(), LHS);
8086 // Transform the right-hand case value (for the GNU case-range extension).
8087 RHS = getDerived().TransformExpr(S->getRHS());
8088 RHS = SemaRef.ActOnCaseExpr(S->getCaseLoc(), RHS);
8093 // Build the case statement.
8096 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
8098 S->getEllipsisLoc(),
8100 S->getColonLoc());
8106 getDerived().TransformStmt(S->getSubStmt());
8118 getDerived().TransformStmt(S->getSubStmt());
8123 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
8130 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8134 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
8135 S->getDecl());
8139 // If we're transforming "in-place" (we're not creating new local
8142 if (LD == S->getDecl())
8143 S->getDecl()->setStmt(nullptr);
8146 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
8156 switch (R->getKind()) {
8173 switch (R->getKind()) {
8187 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
8195 for (const auto *I : S->getAttrs()) {
8197 getDerived().TransformStmtAttr(S->getSubStmt(), SubStmt.get(), I);
8203 if (SubStmt.get() == S->getSubStmt() && !AttrsChanged)
8211 return getDerived().RebuildAttributedStmt(S->getAttrLoc(), Attrs,
8219 StmtResult Init = getDerived().TransformStmt(S->getInit());
8224 if (!S->isConsteval()) {
8227 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
8228 S->isConstexpr() ? Sema::ConditionKind::ConstexprIf
8236 if (S->isConstexpr())
8245 S->isNonNegatedConsteval());
8247 Then = getDerived().TransformStmt(S->getThen());
8255 CompoundStmt(S->getThen()->getBeginLoc(), S->getThen()->getEndLoc());
8264 S->isNegatedConsteval());
8266 Else = getDerived().TransformStmt(S->getElse());
8269 } else if (S->getElse() && ConstexprConditionValue &&
8275 CompoundStmt(S->getElse()->getBeginLoc(), S->getElse()->getEndLoc());
8279 Init.get() == S->getInit() &&
8280 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8281 Then.get() == S->getThen() &&
8282 Else.get() == S->getElse())
8286 S->getIfLoc(), S->getStatementKind(), S->getLParenLoc(), Cond,
8287 S->getRParenLoc(), Init.get(), Then.get(), S->getElseLoc(), Else.get());
8294 StmtResult Init = getDerived().TransformStmt(S->getInit());
8300 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
8307 getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
8308 Init.get(), Cond, S->getRParenLoc());
8313 StmtResult Body = getDerived().TransformStmt(S->getBody());
8318 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(), Switch.get(),
8327 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
8332 // OpenACC Restricts a while-loop inside of certain construct/clause
8335 SemaRef.OpenACC().ActOnWhileStmt(S->getBeginLoc());
8338 StmtResult Body = getDerived().TransformStmt(S->getBody());
8343 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8344 Body.get() == S->getBody())
8347 return getDerived().RebuildWhileStmt(S->getWhileLoc(), S->getLParenLoc(),
8348 Cond, S->getRParenLoc(), Body.get());
8354 // OpenACC Restricts a do-loop inside of certain construct/clause
8357 SemaRef.OpenACC().ActOnDoStmt(S->getBeginLoc());
8360 StmtResult Body = getDerived().TransformStmt(S->getBody());
8365 ExprResult Cond = getDerived().TransformExpr(S->getCond());
8370 Cond.get() == S->getCond() &&
8371 Body.get() == S->getBody())
8374 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
8375 /*FIXME:*/S->getWhileLoc(), Cond.get(),
8376 S->getRParenLoc());
8382 if (getSema().getLangOpts().OpenMP)
8383 getSema().OpenMP().startOpenMPLoop();
8386 StmtResult Init = getDerived().TransformStmt(S->getInit());
8390 // In OpenMP loop region loop control variable must be captured and be
8392 if (getSema().getLangOpts().OpenMP && Init.isUsable())
8393 getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(),
8398 S->getForLoc(), S->getConditionVariable(), S->getCond(),
8404 ExprResult Inc = getDerived().TransformExpr(S->getInc());
8409 if (S->getInc() && !FullInc.get())
8412 // OpenACC Restricts a for-loop inside of certain construct/clause
8416 S->getBeginLoc(), S->getInit(), Init.get(), S->getCond(),
8417 Cond.get().second, S->getInc(), Inc.get());
8420 StmtResult Body = getDerived().TransformStmt(S->getBody());
8424 SemaRef.OpenACC().ActOnForStmtEnd(S->getBeginLoc(), Body);
8427 Init.get() == S->getInit() &&
8428 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
8429 Inc.get() == S->getInc() &&
8430 Body.get() == S->getBody())
8433 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
8435 S->getRParenLoc(), Body.get());
8441 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
8442 S->getLabel());
8447 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
8454 ExprResult Target = getDerived().TransformExpr(S->getTarget());
8460 Target.get() == S->getTarget())
8463 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
8482 ExprResult Result = getDerived().TransformInitializer(S->getRetValue(),
8489 return getDerived().RebuildReturnStmt(S->getReturnLoc(), Result.get());
8498 for (auto *D : S->decls()) {
8499 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
8508 LSI->ContainsUnexpandedParameterPack |=
8513 ->containsUnexpandedParameterPack();
8516 LSI->ContainsUnexpandedParameterPack |=
8517 VD->getType()->containsUnexpandedParameterPack();
8526 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
8543 for (unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
8544 Names.push_back(S->getOutputIdentifier(I));
8547 Constraints.push_back(S->getOutputConstraintLiteral(I));
8550 Expr *OutputExpr = S->getOutputExpr(I);
8561 for (unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
8562 Names.push_back(S->getInputIdentifier(I));
8565 Constraints.push_back(S->getInputConstraintLiteral(I));
8568 Expr *InputExpr = S->getInputExpr(I);
8579 for (unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
8580 Names.push_back(S->getLabelIdentifier(I));
8582 ExprResult Result = getDerived().TransformExpr(S->getLabelExpr(I));
8585 ExprsChanged |= Result.get() != S->getLabelExpr(I);
8592 for (unsigned I = 0, E = S->getNumClobbers(); I != E; ++I)
8593 Clobbers.push_back(S->getClobberStringLiteral(I));
8596 AsmString = S->getAsmString();
8597 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
8598 S->isVolatile(), S->getNumOutputs(),
8599 S->getNumInputs(), Names.data(),
8601 Clobbers, S->getNumLabels(),
8602 S->getRParenLoc());
8608 ArrayRef<Token> AsmToks = llvm::ArrayRef(S->getAsmToks(), S->getNumAsmToks());
8612 ArrayRef<Expr*> SrcExprs = S->getAllExprs();
8629 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
8630 AsmToks, S->getAsmString(),
8631 S->getNumOutputs(), S->getNumInputs(),
8632 S->getAllConstraints(), S->getClobbers(),
8633 TransformedExprs, S->getEndLoc());
8642 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
8643 ScopeInfo->NeedsCoroutineSuspends &&
8644 ScopeInfo->CoroutineSuspends.first == nullptr &&
8645 ScopeInfo->CoroutineSuspends.second == nullptr &&
8648 // Set that we have (possibly-invalid) suspend points before we do anything
8650 ScopeInfo->setNeedsCoroutineSuspends(false);
8652 // We re-build the coroutine promise object (and the coroutine parameters its
8658 if (!SemaRef.buildCoroutineParameterMoves(FD->getLocation()))
8660 auto *Promise = SemaRef.buildCoroutinePromise(FD->getLocation());
8663 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
8664 ScopeInfo->CoroutinePromise = Promise;
8669 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
8673 getDerived().TransformStmt(S->getFinalSuspendStmt());
8677 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
8680 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
8688 Expr *ReturnObject = S->getReturnValueInit();
8697 // statement, we may need to build some implicit coroutine statements
8699 if (S->hasDependentPromiseType()) {
8700 // We can only build these statements, however, if the current promise type
8702 if (!Promise->getType()->isDependentType()) {
8703 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
8704 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
8710 if (auto *OnFallthrough = S->getFallthroughHandler()) {
8717 if (auto *OnException = S->getExceptionHandler()) {
8724 if (auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
8732 assert(S->getAllocate() && S->getDeallocate() &&
8734 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
8739 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
8744 if (auto *ResultDecl = S->getResultDecl()) {
8751 if (auto *ReturnStmt = S->getReturnStmt()) {
8765 ExprResult Result = getDerived().TransformInitializer(S->getOperand(),
8772 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(), Result.get(),
8773 S->isImplicit());
8778 ExprResult Operand = getDerived().TransformInitializer(E->getOperand(),
8783 // Rebuild the common-expr from the operand rather than transforming it
8790 getSema().getCurScope(), E->getKeywordLoc());
8795 E->getKeywordLoc(), Operand.get(),
8796 cast<UnresolvedLookupExpr>(Lookup.get()), E->isImplicit());
8802 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
8808 E->getOperatorCoawaitLookup());
8816 E->getKeywordLoc(), OperandResult.get(),
8823 ExprResult Result = getDerived().TransformInitializer(E->getOperand(),
8830 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(), Result.get());
8833 // Objective-C Statements.
8839 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
8846 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
8847 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
8850 if (Catch.get() != S->getCatchStmt(I))
8857 if (S->getFinallyStmt()) {
8858 Finally = getDerived().TransformStmt(S->getFinallyStmt());
8865 TryBody.get() == S->getTryBody() &&
8867 Finally.get() == S->getFinallyStmt())
8870 // Build a new statement.
8871 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
8880 if (VarDecl *FromVar = S->getCatchParamDecl()) {
8882 if (FromVar->getTypeSourceInfo()) {
8883 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
8890 T = TSInfo->getType();
8892 T = getDerived().TransformType(FromVar->getType());
8902 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
8906 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
8907 S->getRParenLoc(),
8915 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
8921 Body.get() == S->getFinallyBody())
8924 // Build a new statement.
8925 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
8933 if (S->getThrowExpr()) {
8934 Operand = getDerived().TransformExpr(S->getThrowExpr());
8940 Operand.get() == S->getThrowExpr())
8943 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(), Operand.get());
8951 ExprResult Object = getDerived().TransformExpr(S->getSynchExpr());
8955 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
8961 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
8967 Object.get() == S->getSynchExpr() &&
8968 Body.get() == S->getSynchBody())
8971 // Build a new statement.
8972 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
8981 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
8987 Body.get() == S->getSubStmt())
8990 // Build a new statement.
8992 S->getAtLoc(), Body.get());
9001 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
9006 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
9011 StmtResult Body = getDerived().TransformStmt(S->getBody());
9017 Element.get() == S->getElement() &&
9018 Collection.get() == S->getCollection() &&
9019 Body.get() == S->getBody())
9022 // Build a new statement.
9023 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
9026 S->getRParenLoc(),
9034 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
9036 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
9041 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
9042 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
9043 if (!Var || Var->isInvalidDecl())
9048 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
9053 Handler.get() == S->getHandlerBlock())
9056 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
9062 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9069 for (unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
9070 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
9074 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
9078 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9082 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
9095 // P2718R0 - Lifetime extension in range-based for loops.
9102 S->getInit() ? getDerived().TransformStmt(S->getInit()) : StmtResult();
9106 StmtResult Range = getDerived().TransformStmt(S->getRangeStmt());
9116 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
9119 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
9123 ExprResult Cond = getDerived().TransformExpr(S->getCond());
9127 Cond = SemaRef.CheckBooleanCondition(S->getColonLoc(), Cond.get());
9133 ExprResult Inc = getDerived().TransformExpr(S->getInc());
9139 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
9145 Init.get() != S->getInit() ||
9146 Range.get() != S->getRangeStmt() ||
9147 Begin.get() != S->getBeginStmt() ||
9148 End.get() != S->getEndStmt() ||
9149 Cond.get() != S->getCond() ||
9150 Inc.get() != S->getInc() ||
9151 LoopVar.get() != S->getLoopVarStmt()) {
9153 S->getForLoc(), S->getCoawaitLoc(), Init.get(), S->getColonLoc(),
9155 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9156 if (NewStmt.isInvalid() && LoopVar.get() != S->getLoopVarStmt()) {
9159 cast<DeclStmt>(LoopVar.get())->getSingleDecl());
9164 // OpenACC Restricts a while-loop inside of certain construct/clause
9167 SemaRef.OpenACC().ActOnRangeForStmtBegin(S->getBeginLoc(), S, NewStmt.get());
9169 StmtResult Body = getDerived().TransformStmt(S->getBody());
9173 SemaRef.OpenACC().ActOnForStmtEnd(S->getBeginLoc(), Body);
9175 // Body has changed but we didn't rebuild the for-range statement. Rebuild
9177 if (Body.get() != S->getBody() && NewStmt.get() == S) {
9179 S->getForLoc(), S->getCoawaitLoc(), Init.get(), S->getColonLoc(),
9181 LoopVar.get(), S->getRParenLoc(), ForRangeLifetimeExtendTemps);
9196 // Transform the nested-name-specifier, if any.
9198 if (S->getQualifierLoc()) {
9200 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
9206 DeclarationNameInfo NameInfo = S->getNameInfo();
9215 QualifierLoc == S->getQualifierLoc() &&
9216 NameInfo.getName() == S->getNameInfo().getName())
9225 if (S->isIfExists())
9228 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9231 if (S->isIfNotExists())
9234 return new (getSema().Context) NullStmt(S->getKeywordLoc());
9245 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
9253 // The name is still dependent, so build a dependent expression again.
9254 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
9255 S->isIfExists(),
9265 if (E->getQualifierLoc()) {
9267 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9273 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
9277 ExprResult Base = getDerived().TransformExpr(E->getBaseExpr());
9282 MSPropertyRefExpr(Base.get(), PD, E->isArrow(),
9284 QualifierLoc, E->getMemberLoc());
9290 auto BaseRes = getDerived().TransformExpr(E->getBase());
9293 auto IdxRes = getDerived().TransformExpr(E->getIdx());
9298 BaseRes.get() == E->getBase() &&
9299 IdxRes.get() == E->getIdx())
9303 BaseRes.get(), SourceLocation(), IdxRes.get(), E->getRBracketLoc());
9308 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
9312 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
9316 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
9317 Handler.get() == S->getHandler())
9320 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
9326 StmtResult Block = getDerived().TransformCompoundStmt(S->getBlock());
9330 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(), Block.get());
9335 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
9339 StmtResult Block = getDerived().TransformCompoundStmt(S->getBlock());
9343 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
9361 //===----------------------------------------------------------------------===//
9362 // OpenMP directive transformation
9363 //===----------------------------------------------------------------------===//
9371 return getDerived().TransformStmt(L->getLoopStmt());
9380 ArrayRef<OMPClause *> Clauses = D->clauses();
9385 getDerived().getSema().OpenMP().StartOpenMPClause((*I)->getClauseKind());
9387 getDerived().getSema().OpenMP().EndOpenMPClause();
9395 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9396 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9397 D->getDirectiveKind(),
9403 if (D->getDirectiveKind() == OMPD_atomic ||
9404 D->getDirectiveKind() == OMPD_critical ||
9405 D->getDirectiveKind() == OMPD_section ||
9406 D->getDirectiveKind() == OMPD_master)
9407 CS = D->getAssociatedStmt();
9409 CS = D->getRawStmt();
9411 if (Body.isUsable() && isOpenMPLoopDirective(D->getDirectiveKind()) &&
9416 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9427 if (D->getDirectiveKind() == OMPD_critical) {
9428 DirName = cast<OMPCriticalDirective>(D)->getDirectiveName();
9432 if (D->getDirectiveKind() == OMPD_cancellation_point) {
9433 CancelRegion = cast<OMPCancellationPointDirective>(D)->getCancelRegion();
9434 } else if (D->getDirectiveKind() == OMPD_cancel) {
9435 CancelRegion = cast<OMPCancelDirective>(D)->getCancelRegion();
9439 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
9440 AssociatedStmt.get(), D->getBeginLoc(), D->getEndLoc());
9445 /// OMPExecutableDirective-type argument because we're reusing that as the
9447 /// mostly-identical OMPInformationalDirective parent class.
9454 ArrayRef<OMPClause *> Clauses = D->clauses();
9458 getDerived().getSema().OpenMP().StartOpenMPClause(C->getClauseKind());
9460 getDerived().getSema().OpenMP().EndOpenMPClause();
9468 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
9469 getDerived().getSema().OpenMP().ActOnOpenMPRegionStart(
9470 D->getDirectiveKind(),
9475 assert(D->getDirectiveKind() == OMPD_assume &&
9477 Stmt *CS = D->getAssociatedStmt();
9481 getDerived().getSema().OpenMP().ActOnOpenMPRegionEnd(Body, TClauses);
9491 D->getDirectiveKind(), DirName, TClauses, AssociatedStmt.get(),
9492 D->getBeginLoc(), D->getEndLoc());
9499 SemaRef.Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported)
9500 << getOpenMPDirectiveName(D->getDirectiveKind());
9508 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9509 OMPD_parallel, DirName, nullptr, D->getBeginLoc());
9511 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9519 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9520 OMPD_simd, DirName, nullptr, D->getBeginLoc());
9522 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9530 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9531 D->getDirectiveKind(), DirName, nullptr, D->getBeginLoc());
9533 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9541 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9542 D->getDirectiveKind(), DirName, nullptr, D->getBeginLoc());
9544 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9552 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9553 D->getDirectiveKind(), DirName, nullptr, D->getBeginLoc());
9555 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9563 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9564 D->getDirectiveKind(), DirName, nullptr, D->getBeginLoc());
9566 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9574 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9575 OMPD_for, DirName, nullptr, D->getBeginLoc());
9577 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9585 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9586 OMPD_for_simd, DirName, nullptr, D->getBeginLoc());
9588 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9596 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9597 OMPD_sections, DirName, nullptr, D->getBeginLoc());
9599 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9607 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9608 OMPD_section, DirName, nullptr, D->getBeginLoc());
9610 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9618 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9619 OMPD_scope, DirName, nullptr, D->getBeginLoc());
9621 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9629 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9630 OMPD_single, DirName, nullptr, D->getBeginLoc());
9632 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9640 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9641 OMPD_master, DirName, nullptr, D->getBeginLoc());
9643 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9650 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9651 OMPD_critical, D->getDirectiveName(), nullptr, D->getBeginLoc());
9653 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9661 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9662 OMPD_parallel_for, DirName, nullptr, D->getBeginLoc());
9664 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9672 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9673 OMPD_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
9675 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9683 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9684 OMPD_parallel_master, DirName, nullptr, D->getBeginLoc());
9686 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9694 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9695 OMPD_parallel_masked, DirName, nullptr, D->getBeginLoc());
9697 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9705 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9706 OMPD_parallel_sections, DirName, nullptr, D->getBeginLoc());
9708 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9716 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9717 OMPD_task, DirName, nullptr, D->getBeginLoc());
9719 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9727 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9728 OMPD_taskyield, DirName, nullptr, D->getBeginLoc());
9730 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9738 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9739 OMPD_barrier, DirName, nullptr, D->getBeginLoc());
9741 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9749 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9750 OMPD_taskwait, DirName, nullptr, D->getBeginLoc());
9752 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9760 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9761 OMPD_assume, DirName, nullptr, D->getBeginLoc());
9763 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9771 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9772 OMPD_error, DirName, nullptr, D->getBeginLoc());
9774 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9782 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9783 OMPD_taskgroup, DirName, nullptr, D->getBeginLoc());
9785 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9793 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9794 OMPD_flush, DirName, nullptr, D->getBeginLoc());
9796 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9804 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9805 OMPD_depobj, DirName, nullptr, D->getBeginLoc());
9807 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9815 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9816 OMPD_scan, DirName, nullptr, D->getBeginLoc());
9818 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9826 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9827 OMPD_ordered, DirName, nullptr, D->getBeginLoc());
9829 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9837 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9838 OMPD_atomic, DirName, nullptr, D->getBeginLoc());
9840 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9848 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9849 OMPD_target, DirName, nullptr, D->getBeginLoc());
9851 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9859 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9860 OMPD_target_data, DirName, nullptr, D->getBeginLoc());
9862 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9870 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9871 OMPD_target_enter_data, DirName, nullptr, D->getBeginLoc());
9873 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9881 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9882 OMPD_target_exit_data, DirName, nullptr, D->getBeginLoc());
9884 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9892 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9893 OMPD_target_parallel, DirName, nullptr, D->getBeginLoc());
9895 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9903 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9904 OMPD_target_parallel_for, DirName, nullptr, D->getBeginLoc());
9906 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9914 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9915 OMPD_target_update, DirName, nullptr, D->getBeginLoc());
9917 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9925 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9926 OMPD_teams, DirName, nullptr, D->getBeginLoc());
9928 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9936 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9937 OMPD_cancellation_point, DirName, nullptr, D->getBeginLoc());
9939 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9947 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9948 OMPD_cancel, DirName, nullptr, D->getBeginLoc());
9950 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9958 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9959 OMPD_taskloop, DirName, nullptr, D->getBeginLoc());
9961 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9969 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9970 OMPD_taskloop_simd, DirName, nullptr, D->getBeginLoc());
9972 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9980 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9981 OMPD_master_taskloop, DirName, nullptr, D->getBeginLoc());
9983 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
9991 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
9992 OMPD_masked_taskloop, DirName, nullptr, D->getBeginLoc());
9994 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10002 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10003 OMPD_master_taskloop_simd, DirName, nullptr, D->getBeginLoc());
10005 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10013 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10014 OMPD_masked_taskloop_simd, DirName, nullptr, D->getBeginLoc());
10016 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10024 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10025 OMPD_parallel_master_taskloop, DirName, nullptr, D->getBeginLoc());
10027 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10035 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10036 OMPD_parallel_masked_taskloop, DirName, nullptr, D->getBeginLoc());
10038 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10047 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10048 OMPD_parallel_master_taskloop_simd, DirName, nullptr, D->getBeginLoc());
10050 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10059 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10060 OMPD_parallel_masked_taskloop_simd, DirName, nullptr, D->getBeginLoc());
10062 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10070 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10071 OMPD_distribute, DirName, nullptr, D->getBeginLoc());
10073 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10081 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10082 OMPD_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
10084 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10093 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10094 OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
10096 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10104 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10105 OMPD_distribute_simd, DirName, nullptr, D->getBeginLoc());
10107 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10115 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10116 OMPD_target_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
10118 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10126 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10127 OMPD_target_simd, DirName, nullptr, D->getBeginLoc());
10129 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10137 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10138 OMPD_teams_distribute, DirName, nullptr, D->getBeginLoc());
10140 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10148 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10149 OMPD_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
10151 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10159 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10161 D->getBeginLoc());
10163 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10171 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10172 OMPD_teams_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
10174 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10182 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10183 OMPD_target_teams, DirName, nullptr, D->getBeginLoc());
10185 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10193 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10194 OMPD_target_teams_distribute, DirName, nullptr, D->getBeginLoc());
10196 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10205 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10207 D->getBeginLoc());
10209 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10218 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10220 D->getBeginLoc());
10222 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10231 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10232 OMPD_target_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
10234 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10242 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10243 OMPD_interop, DirName, nullptr, D->getBeginLoc());
10245 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10253 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10254 OMPD_dispatch, DirName, nullptr, D->getBeginLoc());
10256 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10264 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10265 OMPD_masked, DirName, nullptr, D->getBeginLoc());
10267 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10275 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10276 OMPD_loop, DirName, nullptr, D->getBeginLoc());
10278 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10286 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10287 OMPD_teams_loop, DirName, nullptr, D->getBeginLoc());
10289 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10297 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10298 OMPD_target_teams_loop, DirName, nullptr, D->getBeginLoc());
10300 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10308 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10309 OMPD_parallel_loop, DirName, nullptr, D->getBeginLoc());
10311 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10320 getDerived().getSema().OpenMP().StartOpenMPDSABlock(
10321 OMPD_target_parallel_loop, DirName, nullptr, D->getBeginLoc());
10323 getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
10327 //===----------------------------------------------------------------------===//
10328 // OpenMP clause transformation
10329 //===----------------------------------------------------------------------===//
10332 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
10336 C->getNameModifier(), Cond.get(), C->getBeginLoc(), C->getLParenLoc(),
10337 C->getNameModifierLoc(), C->getColonLoc(), C->getEndLoc());
10342 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
10345 return getDerived().RebuildOMPFinalClause(Cond.get(), C->getBeginLoc(),
10346 C->getLParenLoc(), C->getEndLoc());
10352 ExprResult NumThreads = getDerived().TransformExpr(C->getNumThreads());
10356 NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10362 ExprResult E = getDerived().TransformExpr(C->getSafelen());
10366 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10372 ExprResult E = getDerived().TransformExpr(C->getAllocator());
10376 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10382 ExprResult E = getDerived().TransformExpr(C->getSimdlen());
10386 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10392 TransformedSizes.reserve(C->getNumSizes());
10394 for (Expr *E : C->getSizesRefs()) {
10410 return RebuildOMPSizesClause(TransformedSizes, C->getBeginLoc(),
10411 C->getLParenLoc(), C->getEndLoc());
10418 TransformedArgs.reserve(C->getNumLoops());
10420 for (Expr *E : C->getArgsRefs()) {
10436 return RebuildOMPPermutationClause(TransformedArgs, C->getBeginLoc(),
10437 C->getLParenLoc(), C->getEndLoc());
10444 return RebuildOMPFullClause(C->getBeginLoc(), C->getEndLoc());
10450 ExprResult T = getDerived().TransformExpr(C->getFactor());
10454 bool Changed = Factor != C->getFactor();
10458 return RebuildOMPPartialClause(Factor, C->getBeginLoc(), C->getLParenLoc(),
10459 C->getEndLoc());
10465 ExprResult E = getDerived().TransformExpr(C->getNumForLoops());
10469 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10476 C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getBeginLoc(),
10477 C->getLParenLoc(), C->getEndLoc());
10484 C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getBeginLoc(),
10485 C->getLParenLoc(), C->getEndLoc());
10491 ExprResult E = getDerived().TransformExpr(C->getChunkSize());
10495 C->getFirstScheduleModifier(), C->getSecondScheduleModifier(),
10496 C->getScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
10497 C->getFirstScheduleModifierLoc(), C->getSecondScheduleModifierLoc(),
10498 C->getScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc());
10505 if (auto *Num = C->getNumForLoops()) {
10510 return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getEndLoc(),
10511 C->getLParenLoc(), E.get());
10518 if (Expr *Evt = C->getEventHandler()) {
10523 return getDerived().RebuildOMPDetachClause(E.get(), C->getBeginLoc(),
10524 C->getLParenLoc(), C->getEndLoc());
10530 // No need to rebuild this clause, no template-dependent parameters.
10537 // No need to rebuild this clause, no template-dependent parameters.
10544 // No need to rebuild this clause, no template-dependent parameters.
10550 // No need to rebuild this clause, no template-dependent parameters.
10556 // No need to rebuild this clause, no template-dependent parameters.
10563 // No need to rebuild this clause, no template-dependent parameters.
10570 // No need to rebuild this clause, no template-dependent parameters.
10577 // No need to rebuild this clause, no template-dependent parameters.
10583 // No need to rebuild this clause, no template-dependent parameters.
10595 ExprResult E = getDerived().TransformExpr(C->getExpr());
10598 return getDerived().RebuildOMPHoldsClause(E.get(), C->getBeginLoc(),
10599 C->getLParenLoc(), C->getEndLoc());
10627 // No need to rebuild this clause, no template-dependent parameters.
10634 // No need to rebuild this clause, no template-dependent parameters.
10641 // No need to rebuild this clause, no template-dependent parameters.
10648 // No need to rebuild this clause, no template-dependent parameters.
10655 // No need to rebuild this clause, no template-dependent parameters.
10661 // No need to rebuild this clause, no template-dependent parameters.
10668 // No need to rebuild this clause, no template-dependent parameters.
10674 // No need to rebuild this clause, no template-dependent parameters.
10681 // No need to rebuild this clause, no template-dependent parameters.
10687 ExprResult IVR = getDerived().TransformExpr(C->getInteropVar());
10691 OMPInteropInfo InteropInfo(C->getIsTarget(), C->getIsTargetSync());
10692 InteropInfo.PreferTypes.reserve(C->varlist_size() - 1);
10693 for (Expr *E : llvm::drop_begin(C->varlist())) {
10700 C->getBeginLoc(), C->getLParenLoc(),
10701 C->getVarLoc(), C->getEndLoc());
10706 ExprResult ER = getDerived().TransformExpr(C->getInteropVar());
10709 return getDerived().RebuildOMPUseClause(ER.get(), C->getBeginLoc(),
10710 C->getLParenLoc(), C->getVarLoc(),
10711 C->getEndLoc());
10718 if (Expr *IV = C->getInteropVar()) {
10723 return getDerived().RebuildOMPDestroyClause(ER.get(), C->getBeginLoc(),
10724 C->getLParenLoc(), C->getVarLoc(),
10725 C->getEndLoc());
10731 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
10735 Cond.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10741 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
10745 Cond.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10751 ExprResult ThreadID = getDerived().TransformExpr(C->getThreadID());
10754 return getDerived().RebuildOMPFilterClause(ThreadID.get(), C->getBeginLoc(),
10755 C->getLParenLoc(), C->getEndLoc());
10760 ExprResult E = getDerived().TransformExpr(C->getAlignment());
10763 return getDerived().RebuildOMPAlignClause(E.get(), C->getBeginLoc(),
10764 C->getLParenLoc(), C->getEndLoc());
10802 return getDerived().RebuildOMPAtClause(C->getAtKind(), C->getAtKindKwLoc(),
10803 C->getBeginLoc(), C->getLParenLoc(),
10804 C->getEndLoc());
10811 C->getSeverityKind(), C->getSeverityKindKwLoc(), C->getBeginLoc(),
10812 C->getLParenLoc(), C->getEndLoc());
10818 ExprResult E = getDerived().TransformExpr(C->getMessageString());
10822 C->getMessageString(), C->getBeginLoc(), C->getLParenLoc(),
10823 C->getEndLoc());
10830 Vars.reserve(C->varlist_size());
10831 for (auto *VE : C->varlist()) {
10838 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10845 Vars.reserve(C->varlist_size());
10846 for (auto *VE : C->varlist()) {
10853 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
10860 Vars.reserve(C->varlist_size());
10861 for (auto *VE : C->varlist()) {
10868 Vars, C->getKind(), C->getKindLoc(), C->getColonLoc(), C->getBeginLoc(),
10869 C->getLParenLoc(), C->getEndLoc());
10876 Vars.reserve(C->varlist_size());
10877 for (auto *VE : C->varlist()) {
10883 return getDerived().RebuildOMPSharedClause(Vars, C->getBeginLoc(),
10884 C->getLParenLoc(), C->getEndLoc());
10891 Vars.reserve(C->varlist_size());
10892 for (auto *VE : C->varlist()) {
10899 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
10901 DeclarationNameInfo NameInfo = C->getNameInfo();
10907 // Build a list of all UDR decls with the same names ranged by the Scopes.
10910 for (auto *E : C->reduction_ops()) {
10915 for (auto *D : ULE->decls()) {
10917 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10918 Decls.addDecl(InstD, InstD->getAccess());
10929 Vars, C->getModifier(), C->getBeginLoc(), C->getLParenLoc(),
10930 C->getModifierLoc(), C->getColonLoc(), C->getEndLoc(),
10938 Vars.reserve(C->varlist_size());
10939 for (auto *VE : C->varlist()) {
10946 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
10948 DeclarationNameInfo NameInfo = C->getNameInfo();
10954 // Build a list of all UDR decls with the same names ranged by the Scopes.
10957 for (auto *E : C->reduction_ops()) {
10962 for (auto *D : ULE->decls()) {
10964 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
10965 Decls.addDecl(InstD, InstD->getAccess());
10976 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
10977 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
10984 Vars.reserve(C->varlist_size());
10985 for (auto *VE : C->varlist()) {
10992 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
10994 DeclarationNameInfo NameInfo = C->getNameInfo();
11000 // Build a list of all UDR decls with the same names ranged by the Scopes.
11003 for (auto *E : C->reduction_ops()) {
11008 for (auto *D : ULE->decls()) {
11010 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
11011 Decls.addDecl(InstD, InstD->getAccess());
11022 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
11023 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
11030 Vars.reserve(C->varlist_size());
11031 for (auto *VE : C->varlist()) {
11037 ExprResult Step = getDerived().TransformExpr(C->getStep());
11041 Vars, Step.get(), C->getBeginLoc(), C->getLParenLoc(), C->getModifier(),
11042 C->getModifierLoc(), C->getColonLoc(), C->getStepModifierLoc(),
11043 C->getEndLoc());
11050 Vars.reserve(C->varlist_size());
11051 for (auto *VE : C->varlist()) {
11057 ExprResult Alignment = getDerived().TransformExpr(C->getAlignment());
11061 Vars, Alignment.get(), C->getBeginLoc(), C->getLParenLoc(),
11062 C->getColonLoc(), C->getEndLoc());
11069 Vars.reserve(C->varlist_size());
11070 for (auto *VE : C->varlist()) {
11076 return getDerived().RebuildOMPCopyinClause(Vars, C->getBeginLoc(),
11077 C->getLParenLoc(), C->getEndLoc());
11084 Vars.reserve(C->varlist_size());
11085 for (auto *VE : C->varlist()) {
11092 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11098 Vars.reserve(C->varlist_size());
11099 for (auto *VE : C->varlist()) {
11105 return getDerived().RebuildOMPFlushClause(Vars, C->getBeginLoc(),
11106 C->getLParenLoc(), C->getEndLoc());
11112 ExprResult E = getDerived().TransformExpr(C->getDepobj());
11115 return getDerived().RebuildOMPDepobjClause(E.get(), C->getBeginLoc(),
11116 C->getLParenLoc(), C->getEndLoc());
11123 Expr *DepModifier = C->getModifier();
11130 Vars.reserve(C->varlist_size());
11131 for (auto *VE : C->varlist()) {
11138 {C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(),
11139 C->getOmpAllMemoryLoc()},
11140 DepModifier, Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11146 ExprResult E = getDerived().TransformExpr(C->getDevice());
11150 C->getModifier(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
11151 C->getModifierLoc(), C->getEndLoc());
11161 Vars.reserve(C->varlist_size());
11162 for (auto *VE : C->varlist()) {
11170 if (C->getMapperQualifierLoc()) {
11172 C->getMapperQualifierLoc());
11177 MapperIdInfo = C->getMapperIdInfo();
11183 // Build a list of all candidate OMPDeclareMapperDecls, which is provided by
11184 // the previous user-defined mapper lookup in dependent environment.
11185 for (auto *E : C->mapperlists()) {
11190 for (auto *D : ULE->decls()) {
11192 cast<NamedDecl>(TT.getDerived().TransformDecl(E->getExprLoc(), D));
11193 Decls.addDecl(InstD, InstD->getAccess());
11209 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11211 Expr *IteratorModifier = C->getIteratorModifier();
11225 IteratorModifier, C->getMapTypeModifiers(), C->getMapTypeModifiersLoc(),
11226 MapperIdScopeSpec, MapperIdInfo, C->getMapType(), C->isImplicitMapType(),
11227 C->getMapLoc(), C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11233 Expr *Allocator = C->getAllocator();
11240 Expr *Alignment = C->getAlignment();
11248 Vars.reserve(C->varlist_size());
11249 for (auto *VE : C->varlist()) {
11256 Allocator, Alignment, C->getFirstAllocateModifier(),
11257 C->getFirstAllocateModifierLoc(), C->getSecondAllocateModifier(),
11258 C->getSecondAllocateModifierLoc(), Vars, C->getBeginLoc(),
11259 C->getLParenLoc(), C->getColonLoc(), C->getEndLoc());
11266 Vars.reserve(C->varlist_size());
11267 for (auto *VE : C->varlist()) {
11274 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11281 Vars.reserve(C->varlist_size());
11282 for (auto *VE : C->varlist()) {
11289 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11295 ExprResult E = getDerived().TransformExpr(C->getPriority());
11299 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11305 ExprResult E = getDerived().TransformExpr(C->getGrainsize());
11309 C->getModifier(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
11310 C->getModifierLoc(), C->getEndLoc());
11316 ExprResult E = getDerived().TransformExpr(C->getNumTasks());
11320 C->getModifier(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
11321 C->getModifierLoc(), C->getEndLoc());
11326 ExprResult E = getDerived().TransformExpr(C->getHint());
11329 return getDerived().RebuildOMPHintClause(E.get(), C->getBeginLoc(),
11330 C->getLParenLoc(), C->getEndLoc());
11336 ExprResult E = getDerived().TransformExpr(C->getChunkSize());
11340 C->getDistScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
11341 C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc());
11348 // defaultmap(none:variable-category) after template initialization.
11349 return getDerived().RebuildOMPDefaultmapClause(C->getDefaultmapModifier(),
11350 C->getDefaultmapKind(),
11351 C->getBeginLoc(),
11352 C->getLParenLoc(),
11353 C->getDefaultmapModifierLoc(),
11354 C->getDefaultmapKindLoc(),
11355 C->getEndLoc());
11360 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11369 C->getMotionModifiers(), C->getMotionModifiersLoc(), MapperIdScopeSpec,
11370 MapperIdInfo, C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11375 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11384 C->getMotionModifiers(), C->getMotionModifiersLoc(), MapperIdScopeSpec,
11385 MapperIdInfo, C->getColonLoc(), Vars, Locs, UnresolvedMappers);
11392 Vars.reserve(C->varlist_size());
11393 for (auto *VE : C->varlist()) {
11399 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11407 Vars.reserve(C->varlist_size());
11408 for (auto *VE : C->varlist()) {
11414 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11422 Vars.reserve(C->varlist_size());
11423 for (auto *VE : C->varlist()) {
11429 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11437 Vars.reserve(C->varlist_size());
11438 for (auto *VE : C->varlist()) {
11444 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11452 Vars.reserve(C->varlist_size());
11453 for (auto *VE : C->varlist()) {
11460 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11467 Vars.reserve(C->varlist_size());
11468 for (auto *VE : C->varlist()) {
11475 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11482 Vars.reserve(C->varlist_size());
11483 for (auto *VE : C->varlist()) {
11490 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11497 Data.reserve(C->getNumberOfAllocators());
11498 for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
11499 OMPUsesAllocatorsClause::Data D = C->getAllocatorData(I);
11516 Data, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11523 Locators.reserve(C->varlist_size());
11525 if (Expr *Modifier = C->getModifier()) {
11530 for (Expr *E : C->varlist()) {
11537 C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), C->getEndLoc(),
11544 C->getKind(), C->getKindKwLoc(), C->getBeginLoc(), C->getLParenLoc(),
11545 C->getEndLoc(), C->getModifier(), C->getModifierKwLoc());
11551 C->getBindKind(), C->getBindKindLoc(), C->getBeginLoc(),
11552 C->getLParenLoc(), C->getEndLoc());
11558 ExprResult Size = getDerived().TransformExpr(C->getSize());
11562 Size.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11569 Vars.reserve(C->varlist_size());
11570 for (auto *VE : C->varlist()) {
11577 C->getDependenceType(), C->getDependenceLoc(), C->getColonLoc(), Vars,
11578 C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11585 for (auto *A : C->getAttrs())
11588 NewAttrs, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
11593 return getDerived().RebuildOMPXBareClause(C->getBeginLoc(), C->getEndLoc());
11596 //===----------------------------------------------------------------------===//
11598 //===----------------------------------------------------------------------===//
11655 Cond->getExprLoc(), /*Var=*/nullptr, Cond, Sema::ConditionKind::Boolean);
11700 Self.TransformCondition(Cond->getExprLoc(), /*Var=*/nullptr, Cond,
12242 NewLoopCount.get()->getBeginLoc(), NewLoopCount.get());
12271 NewSizeExpr.get()->getBeginLoc(), NewSizeExpr.get());
12318 DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
12319 ParsedClause.setEndLoc(OldClause->getEndLoc());
12322 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
12347 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12350 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12351 C->clauses());
12354 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12359 getSema().OpenACC(), C->getDirectiveKind(), C->getDirectiveLoc(),
12360 C->clauses(), TransformedClauses);
12361 StmtResult StrBlock = getDerived().TransformStmt(C->getStructuredBlock());
12363 C->getBeginLoc(), C->getDirectiveKind(), TransformedClauses, StrBlock);
12366 C->getDirectiveKind(), C->getBeginLoc(), C->getDirectiveLoc(),
12367 C->getEndLoc(), TransformedClauses, StrBlock);
12374 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12377 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12378 C->clauses());
12381 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12386 getSema().OpenACC(), C->getDirectiveKind(), C->getDirectiveLoc(),
12387 C->clauses(), TransformedClauses);
12388 StmtResult Loop = getDerived().TransformStmt(C->getLoop());
12390 C->getBeginLoc(), C->getDirectiveKind(), TransformedClauses, Loop);
12393 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12400 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12403 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12404 C->clauses());
12407 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12412 getSema().OpenACC(), C->getDirectiveKind(), C->getDirectiveLoc(),
12413 C->clauses(), TransformedClauses);
12414 StmtResult Loop = getDerived().TransformStmt(C->getLoop());
12416 C->getBeginLoc(), C->getDirectiveKind(), TransformedClauses, Loop);
12419 C->getDirectiveKind(), C->getBeginLoc(), C->getDirectiveLoc(),
12420 C->getEndLoc(), TransformedClauses, Loop);
12426 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12429 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12430 C->clauses());
12432 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12436 getSema().OpenACC(), C->getDirectiveKind(), C->getDirectiveLoc(),
12437 C->clauses(), TransformedClauses);
12438 StmtResult StrBlock = getDerived().TransformStmt(C->getStructuredBlock());
12440 C->getBeginLoc(), C->getDirectiveKind(), TransformedClauses, StrBlock);
12443 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12450 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12453 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12454 C->clauses());
12456 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12460 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12467 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12470 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12471 C->clauses());
12473 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12477 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12484 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12487 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12488 C->clauses());
12490 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12494 getSema().OpenACC(), C->getDirectiveKind(), C->getDirectiveLoc(),
12495 C->clauses(), TransformedClauses);
12496 StmtResult StrBlock = getDerived().TransformStmt(C->getStructuredBlock());
12498 C->getBeginLoc(), C->getDirectiveKind(), TransformedClauses, StrBlock);
12501 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12508 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12511 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12512 C->clauses());
12514 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12518 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12525 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12528 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12529 C->clauses());
12531 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12535 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12541 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12544 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12545 C->clauses());
12547 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12551 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12558 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12561 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12562 C->clauses());
12564 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12568 C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(),
12575 getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc());
12578 if (C->hasDevNumExpr()) {
12579 DevNumExpr = getDerived().TransformExpr(C->getDevNumExpr());
12584 C->getBeginLoc(), DevNumExpr.get());
12589 for (Expr *QE : C->getQueueIdExprs()) {
12597 C->getBeginLoc(), NewEQ.get());
12603 getDerived().TransformOpenACCClauseList(C->getDirectiveKind(),
12604 C->clauses());
12607 C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses))
12611 C->getBeginLoc(), C->getDirectiveLoc(), C->getLParenLoc(),
12612 DevNumExpr.isUsable() ? DevNumExpr.get() : nullptr, C->getQueuesLoc(),
12613 QueueIdExprs, C->getRParenLoc(), C->getEndLoc(), TransformedClauses);
12620 return getDerived().RebuildOpenACCAsteriskSizeExpr(E->getLocation());
12625 //===----------------------------------------------------------------------===//
12627 //===----------------------------------------------------------------------===//
12631 return TransformExpr(E->getSubExpr());
12637 if (!E->isTypeDependent())
12640 TypeSourceInfo *NewT = getDerived().TransformType(E->getTypeSourceInfo());
12645 if (!getDerived().AlwaysRebuild() && E->getTypeSourceInfo() == NewT)
12649 E->getLocation(), E->getLParenLocation(), E->getRParenLocation(), NewT);
12655 if (!E->isTypeDependent())
12658 return getDerived().RebuildPredefinedExpr(E->getLocation(),
12659 E->getIdentKind());
12666 if (E->getQualifierLoc()) {
12668 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
12674 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
12675 E->getDecl()));
12680 if (E->getFoundDecl() != E->getDecl()) {
12682 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
12687 DeclarationNameInfo NameInfo = E->getNameInfo();
12695 !E->isCapturedByCopyInLambdaWithExplicitObjectParameter() &&
12696 QualifierLoc == E->getQualifierLoc() && ND == E->getDecl() &&
12697 Found == E->getFoundDecl() &&
12698 NameInfo.getName() == E->getDecl()->getDeclName() &&
12699 !E->hasExplicitTemplateArgs()) {
12702 // FIXME: this is a bit instantiation-specific.
12709 if (E->hasExplicitTemplateArgs()) {
12711 TransArgs.setLAngleLoc(E->getLAngleLoc());
12712 TransArgs.setRAngleLoc(E->getRAngleLoc());
12713 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12714 E->getNumTemplateArgs(),
12770 if (E->isExprPredicate())
12771 ControllingExpr = getDerived().TransformExpr(E->getControllingExpr());
12773 ControllingType = getDerived().TransformType(E->getControllingType());
12780 for (const GenericSelectionExpr::Association Assoc : E->associations()) {
12799 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
12800 E->getDefaultLoc(),
12801 E->getRParenLoc(),
12806 E->getGenericLoc(), E->getDefaultLoc(), E->getRParenLoc(),
12813 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12817 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
12820 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
12821 E->getRParen());
12824 /// The operand of a unary address-of operator has special rules: it's
12825 /// allowed to refer to a non-static member of a class even if there's no 'this'
12844 if (E->getOpcode() == UO_AddrOf)
12845 SubExpr = TransformAddressOfOperand(E->getSubExpr());
12847 SubExpr = TransformExpr(E->getSubExpr());
12851 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
12854 return getDerived().RebuildUnaryOperator(E->getOperatorLoc(),
12855 E->getOpcode(),
12863 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
12869 // FIXME: It would be slightly more efficient in the non-dependent case to
12876 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
12877 const OffsetOfNode &ON = E->getComponent(I);
12884 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
12914 Type == E->getTypeSourceInfo() &&
12918 // Build a new offsetof expression.
12919 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type,
12920 Components, E->getRParenLoc());
12926 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
12941 for (Expr *C : E->subExpressions()) {
12951 return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
12952 Children, E->getType());
12959 // opaque-value expressions in it, so strip those away and rebuild
12968 // If that gives us a pseudo-object result back, the pseudo-object
12969 // expression must have been an lvalue-to-rvalue conversion which we
12971 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
12981 if (E->isArgumentType()) {
12982 TypeSourceInfo *OldT = E->getArgumentTypeInfo();
12991 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
12992 E->getKind(),
12993 E->getSourceRange());
13007 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
13009 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) : nullptr)
13013 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
13017 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
13021 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
13025 E->getOperatorLoc(),
13026 E->getKind(),
13027 E->getSourceRange());
13033 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13037 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13043 LHS.get() == E->getLHS() &&
13044 RHS.get() == E->getRHS())
13049 /*FIXME:*/ E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
13055 ExprResult Base = getDerived().TransformExpr(E->getBase());
13059 ExprResult RowIdx = getDerived().TransformExpr(E->getRowIdx());
13063 ExprResult ColumnIdx = getDerived().TransformExpr(E->getColumnIdx());
13067 if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase() &&
13068 RowIdx.get() == E->getRowIdx() && ColumnIdx.get() == E->getColumnIdx())
13072 Base.get(), RowIdx.get(), ColumnIdx.get(), E->getRBracketLoc());
13078 ExprResult Base = getDerived().TransformExpr(E->getBase());
13083 if (E->getLowerBound()) {
13084 LowerBound = getDerived().TransformExpr(E->getLowerBound());
13090 if (E->getLength()) {
13091 Length = getDerived().TransformExpr(E->getLength());
13097 if (E->isOMPArraySection()) {
13098 if (Expr *Str = E->getStride()) {
13105 if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase() &&
13106 LowerBound.get() == E->getLowerBound() &&
13107 Length.get() == E->getLength() &&
13108 (E->isOpenACCArraySection() || Stride.get() == E->getStride()))
13112 E->isOMPArraySection(), Base.get(), E->getBase()->getEndLoc(),
13113 LowerBound.get(), E->getColonLocFirst(),
13114 E->isOMPArraySection() ? E->getColonLocSecond() : SourceLocation{},
13115 Length.get(), Stride.get(), E->getRBracketLoc());
13121 ExprResult Base = getDerived().TransformExpr(E->getBase());
13127 for (Expr *Dim : E->getDimensions()) {
13138 return getDerived().RebuildOMPArrayShapingExpr(Base.get(), E->getLParenLoc(),
13139 E->getRParenLoc(), Dims,
13140 E->getBracketsRanges());
13146 unsigned NumIterators = E->numOfIterators();
13152 auto *D = cast<VarDecl>(E->getIteratorDecl(I));
13153 Data[I].DeclIdent = D->getIdentifier();
13154 Data[I].DeclIdentLoc = D->getLocation();
13155 if (D->getLocation() == D->getBeginLoc()) {
13156 assert(SemaRef.Context.hasSameType(D->getType(), SemaRef.Context.IntTy) &&
13159 TypeSourceInfo *TSI = getDerived().TransformType(D->getTypeSourceInfo());
13160 QualType DeclTy = getDerived().TransformType(D->getType());
13163 OMPIteratorExpr::IteratorRange Range = E->getIteratorRange(I);
13168 !(!D->getTypeSourceInfo() || (Data[I].Type.getAsOpaquePtr() &&
13176 Data[I].AssignLoc = E->getAssignLoc(I);
13177 Data[I].ColonLoc = E->getColonLoc(I);
13178 Data[I].SecColonLoc = E->getSecondColonLoc(I);
13181 (D->getTypeSourceInfo() && Data[I].Type.get().getTypePtrOrNull() !=
13182 D->getType().getTypePtrOrNull()) ||
13192 E->getIteratorKwLoc(), E->getLParenLoc(), E->getRParenLoc(), Data);
13197 getDerived().transformedLocalDecl(E->getIteratorDecl(I),
13198 IE->getIteratorDecl(I));
13206 ExprResult Callee = getDerived().TransformExpr(E->getCallee());
13213 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
13218 Callee.get() == E->getCallee() &&
13224 = ((Expr *)Callee.get())->getSourceRange().getBegin();
13227 if (E->hasStoredFPFeatures()) {
13228 FPOptionsOverride NewOverrides = E->getFPFeatures();
13236 E->getRParenLoc());
13242 ExprResult Base = getDerived().TransformExpr(E->getBase());
13247 if (E->hasQualifier()) {
13249 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
13254 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
13257 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
13258 E->getMemberDecl()));
13262 NamedDecl *FoundDecl = E->getFoundDecl();
13263 if (FoundDecl == E->getMemberDecl()) {
13267 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
13273 Base.get() == E->getBase() &&
13274 QualifierLoc == E->getQualifierLoc() &&
13275 Member == E->getMemberDecl() &&
13276 FoundDecl == E->getFoundDecl() &&
13277 !E->hasExplicitTemplateArgs()) {
13279 // Skip for member expression of (this->f), rebuilt thisi->f is needed
13280 // for Openmp where the field need to be privatizized in the case.
13281 if (!(isa<CXXThisExpr>(E->getBase()) &&
13282 getSema().OpenMP().isOpenMPRebuildMemberExpr(
13285 // FIXME: this is a bit instantiation-specific.
13292 if (E->hasExplicitTemplateArgs()) {
13293 TransArgs.setLAngleLoc(E->getLAngleLoc());
13294 TransArgs.setRAngleLoc(E->getRAngleLoc());
13295 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
13296 E->getNumTemplateArgs(),
13303 SemaRef.getLocForEndOfToken(E->getBase()->getSourceRange().getEnd());
13306 // first-qualifier-in-scope here, just in case we had a dependent
13308 // nested-name-qualifier (and therefore could do the lookup).
13310 DeclarationNameInfo MemberNameInfo = E->getMemberNameInfo();
13318 E->isArrow(),
13324 (E->hasExplicitTemplateArgs()
13332 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13337 getDerived().TransformInitializer(E->getRHS(), /*NotCopyInit=*/false);
13342 LHS.get() == E->getLHS() &&
13343 RHS.get() == E->getRHS())
13346 if (E->isCompoundAssignmentOp())
13349 E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get());
13351 FPOptionsOverride NewOverrides(E->getFPFeatures());
13355 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
13362 CXXRewrittenBinaryOperator::DecomposedForm Decomp = E->getDecomposedForm();
13372 // Extract the already-resolved callee declarations so that we can restrict
13376 Expr *PossibleBinOps[] = {E->getSemanticForm(),
13379 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
13382 auto *Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
13383 if (!Callee || isa<CXXMethodDecl>(Callee->getDecl()))
13389 E->getOperatorLoc(), Callee->getFoundDecl()));
13392 if (Found != Callee->getFoundDecl())
13401 // function calls, and/or there might be a user-defined conversion sequence
13403 // FIXME: this is a bit instantiation-specific.
13410 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
13418 FPOptionsOverride NewOverrides(E->getFPFeatures());
13431 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
13435 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
13440 commonExpr.get() == e->getCommon() &&
13441 rhs.get() == e->getFalseExpr())
13445 e->getQuestionLoc(),
13447 e->getColonLoc(),
13454 ExprResult Cond = getDerived().TransformExpr(E->getCond());
13458 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13462 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13467 Cond.get() == E->getCond() &&
13468 LHS.get() == E->getLHS() &&
13469 RHS.get() == E->getRHS())
13473 E->getQuestionLoc(),
13475 E->getColonLoc(),
13484 return getDerived().TransformExpr(E->getSubExprAsWritten());
13490 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeInfoAsWritten());
13495 = getDerived().TransformExpr(E->getSubExprAsWritten());
13500 Type == E->getTypeInfoAsWritten() &&
13501 SubExpr.get() == E->getSubExpr())
13504 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
13506 E->getRParenLoc(),
13513 TypeSourceInfo *OldT = E->getTypeSourceInfo();
13518 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
13524 Init.get() == E->getInitializer())
13528 // type-as-written, but that's okay, because it should always be
13532 E->getLParenLoc(), NewT,
13533 /*FIXME:*/ E->getInitializer()->getEndLoc(), Init.get());
13539 ExprResult Base = getDerived().TransformExpr(E->getBase());
13544 Base.get() == E->getBase())
13549 SemaRef.getLocForEndOfToken(E->getBase()->getEndLoc());
13551 Base.get(), FakeOperatorLoc, E->isArrow(), E->getAccessorLoc(),
13552 E->getAccessor());
13558 if (InitListExpr *Syntactic = E->getSyntacticForm())
13567 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(), false,
13578 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
13579 E->getRBraceLoc());
13588 ExprResult Init = getDerived().TransformExpr(E->getInit());
13595 for (const DesignatedInitExpr::Designator &D : E->designators()) {
13604 if (Field->isAnonymousStructOrUnion())
13618 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
13625 ExprChanged = ExprChanged || Init.get() != E->getArrayIndex(D);
13632 = getDerived().TransformExpr(E->getArrayRangeStart(D));
13636 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
13643 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
13644 End.get() != E->getArrayRangeEnd(D);
13651 Init.get() == E->getInit() &&
13656 E->getEqualOrColonLoc(),
13657 E->usesGNUSyntax(), Init.get());
13697 TemporaryBase Rebase(*this, E->getBeginLoc(), DeclarationName());
13701 QualType T = getDerived().TransformType(E->getType());
13706 T == E->getType())
13715 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
13719 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
13724 TInfo == E->getWrittenTypeInfo() &&
13725 SubExpr.get() == E->getSubExpr())
13728 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
13729 TInfo, E->getRParenLoc());
13737 if (TransformExprs(E->getExprs(), E->getNumExprs(), true, Inits,
13741 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
13743 E->getRParenLoc());
13746 /// Transform an address-of-label expression.
13748 /// By default, the transformation of an address-of-label expression always
13754 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
13755 E->getLabel());
13759 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
13768 = getDerived().TransformCompoundStmt(E->getSubStmt(), true);
13774 unsigned OldDepth = E->getTemplateDepth();
13778 SubStmt.get() == E->getSubStmt()) {
13784 return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(),
13785 E->getRParenLoc(), NewDepth);
13791 ExprResult Cond = getDerived().TransformExpr(E->getCond());
13795 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
13799 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
13804 Cond.get() == E->getCond() &&
13805 LHS.get() == E->getLHS() &&
13806 RHS.get() == E->getRHS())
13809 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
13811 E->getRParenLoc());
13823 switch (E->getOperator()) {
13833 assert(E->getNumArgs() >= 1 && "Object call is missing arguments");
13836 ExprResult Object = getDerived().TransformExpr(E->getArg(0));
13842 static_cast<Expr *>(Object.get())->getEndLoc());
13846 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1, true,
13850 if (E->getOperator() == OO_Subscript)
13852 Args, E->getEndLoc());
13855 E->getEndLoc());
13874 if (E->getNumArgs() == 1 && E->getOperator() == OO_Amp)
13875 First = getDerived().TransformAddressOfOperand(E->getArg(0));
13877 First = getDerived().TransformExpr(E->getArg(0));
13882 if (E->getNumArgs() == 2) {
13884 getDerived().TransformInitializer(E->getArg(1), /*NotCopyInit=*/false);
13890 FPOptionsOverride NewOverrides(E->getFPFeatures());
13895 Expr *Callee = E->getCallee();
13897 LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
13899 if (getDerived().TransformOverloadExprDecls(ULE, ULE->requiresADL(), R))
13903 E->getOperator(), E->getOperatorLoc(), Callee->getBeginLoc(),
13904 ULE->requiresADL(), R.asUnresolvedSet(), First.get(), Second.get());
13909 Callee = ICE->getSubExprAsWritten();
13910 NamedDecl *DR = cast<DeclRefExpr>(Callee)->getDecl();
13912 getDerived().TransformDecl(DR->getLocation(), DR));
13920 E->getOperator(), E->getOperatorLoc(), Callee->getBeginLoc(),
13932 bool NeedRebuildFunc = SourceLocExpr::MayBeDependent(E->getIdentKind()) &&
13933 getSema().CurContext != E->getParentContext();
13938 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
13939 E->getBeginLoc(), E->getEndLoc(),
13952 ExprResult Callee = getDerived().TransformExpr(E->getCallee());
13957 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
13964 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
13969 Callee.get() == E->getCallee() &&
13975 = ((Expr *)Callee.get())->getSourceRange().getBegin();
13978 E->getRParenLoc(), EC.get());
13984 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeInfoAsWritten());
13989 = getDerived().TransformExpr(E->getSubExprAsWritten());
13994 Type == E->getTypeInfoAsWritten() &&
13995 SubExpr.get() == E->getSubExpr())
13998 E->getOperatorLoc(), E->getStmtClass(), E->getAngleBrackets().getBegin(),
13999 Type, E->getAngleBrackets().getEnd(),
14001 E->getAngleBrackets().getEnd(), SubExpr.get(), E->getRParenLoc());
14008 getDerived().TransformType(BCE->getTypeInfoAsWritten());
14012 ExprResult Sub = getDerived().TransformExpr(BCE->getSubExpr());
14016 return getDerived().RebuildBuiltinBitCastExpr(BCE->getBeginLoc(), TSI,
14017 Sub.get(), BCE->getEndLoc());
14056 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
14061 = getDerived().TransformExpr(E->getSubExprAsWritten());
14066 Type == E->getTypeInfoAsWritten() &&
14067 SubExpr.get() == E->getSubExpr())
14071 E->getLParenLoc(),
14073 E->getRParenLoc(),
14074 E->isListInitialization());
14080 if (E->isTypeOperand()) {
14082 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14087 TInfo == E->getTypeOperandSourceInfo())
14090 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14091 TInfo, E->getEndLoc());
14096 // semantic processing can re-transform an already transformed operand.
14097 Expr *Op = E->getExprOperand();
14099 if (E->isGLValue())
14100 if (auto *RecordT = Op->getType()->getAs<RecordType>())
14101 if (cast<CXXRecordDecl>(RecordT->getDecl())->isPolymorphic())
14112 SubExpr.get() == E->getExprOperand())
14115 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
14116 SubExpr.get(), E->getEndLoc());
14122 if (E->isTypeOperand()) {
14124 = getDerived().TransformType(E->getTypeOperandSourceInfo());
14129 TInfo == E->getTypeOperandSourceInfo())
14132 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14133 TInfo, E->getEndLoc());
14139 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
14144 SubExpr.get() == E->getExprOperand())
14147 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
14148 SubExpr.get(), E->getEndLoc());
14179 if (E->isCapturedByCopyInLambdaWithExplicitObjectParameter())
14182 return getDerived().TransformType(E->getType());
14186 if (!getDerived().AlwaysRebuild() && T == E->getType()) {
14188 // FIXME: this is a bit instantiation-specific.
14193 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
14199 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
14204 SubExpr.get() == E->getSubExpr())
14207 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
14208 E->isThrownVariableInScope());
14215 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
14220 if (E->hasRewrittenInit()) {
14221 InitRes = getDerived().TransformExpr(E->getRewrittenExpr());
14226 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
14227 E->getUsedContext() == SemaRef.CurContext &&
14228 InitRes.get() == E->getRewrittenExpr())
14231 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param,
14239 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
14243 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
14244 E->getUsedContext() == SemaRef.CurContext)
14247 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
14254 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
14259 T == E->getTypeSourceInfo())
14263 /*FIXME:*/T->getTypeLoc().getEndLoc(),
14264 E->getRParenLoc());
14272 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
14278 if (E->isArray()) {
14280 if (std::optional<Expr *> OldArraySize = E->getArraySize()) {
14291 if (getDerived().TransformExprs(E->getPlacementArgs(),
14292 E->getNumPlacementArgs(), true,
14297 Expr *OldInit = E->getInitializer();
14306 if (E->getOperatorNew()) {
14308 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
14314 if (E->getOperatorDelete()) {
14316 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14322 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
14323 ArraySize == E->getArraySize() &&
14325 OperatorNew == E->getOperatorNew() &&
14326 OperatorDelete == E->getOperatorDelete() &&
14329 // FIXME: instantiation-specific.
14331 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorNew);
14333 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
14335 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
14337 = SemaRef.Context.getBaseElementType(E->getAllocatedType());
14338 if (const RecordType *RecordT = ElementType->getAs<RecordType>()) {
14339 CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordT->getDecl());
14341 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Destructor);
14349 QualType AllocType = AllocTypeInfo->getType();
14355 // dependently-sized array types.
14361 ArraySize = IntegerLiteral::Create(SemaRef.Context, ConsArrayT->getSize(),
14363 /*FIXME:*/ E->getBeginLoc());
14364 AllocType = ConsArrayT->getElementType();
14367 if (DepArrayT->getSizeExpr()) {
14368 ArraySize = DepArrayT->getSizeExpr();
14369 AllocType = DepArrayT->getElementType();
14375 E->getBeginLoc(), E->isGlobalNew(),
14376 /*FIXME:*/ E->getBeginLoc(), PlacementArgs,
14377 /*FIXME:*/ E->getBeginLoc(), E->getTypeIdParens(), AllocType,
14378 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
14384 ExprResult Operand = getDerived().TransformExpr(E->getArgument());
14390 if (E->getOperatorDelete()) {
14392 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
14398 Operand.get() == E->getArgument() &&
14399 OperatorDelete == E->getOperatorDelete()) {
14401 // FIXME: instantiation-specific.
14403 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
14405 if (!E->getArgument()->isTypeDependent()) {
14407 E->getDestroyedType());
14408 if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
14409 CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
14410 SemaRef.MarkFunctionReferenced(E->getBeginLoc(),
14419 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(), Operand.get());
14426 ExprResult Base = getDerived().TransformExpr(E->getBase());
14433 E->getOperatorLoc(),
14434 E->isArrow()? tok::arrow : tok::period,
14441 NestedNameSpecifierLoc QualifierLoc = E->getQualifierLoc();
14452 if (E->getDestroyedTypeInfo()) {
14454 = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
14459 } else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
14462 Destroyed = PseudoDestructorTypeStorage(E->getDestroyedTypeIdentifier(),
14463 E->getDestroyedTypeLoc());
14467 *E->getDestroyedTypeIdentifier(), E->getDestroyedTypeLoc(),
14474 E->getDestroyedTypeLoc());
14478 if (E->getScopeTypeInfo()) {
14481 E->getScopeTypeInfo(), ObjectType, nullptr, EmptySS);
14487 E->getOperatorLoc(),
14488 E->isArrow(),
14491 E->getColonColonLoc(),
14492 E->getTildeLoc(),
14502 for (auto *OldD : Old->decls()) {
14503 Decl *InstD = getDerived().TransformDecl(Old->getNameLoc(), OldD);
14519 Decls = UPD->expansions();
14524 for (auto *SD : UD->shadows())
14535 // The program is ill-formed, no diagnostic required, if [...] lookup for
14536 // a name in the template definition found a using-declaration, but the
14538 // any declarations because the using-declaration was a pack expansion and
14541 getSema().Diag(Old->getNameLoc(), diag::err_using_pack_expansion_empty)
14542 << isa<UnresolvedMemberExpr>(Old) << Old->getName();
14550 if (Old->hasTemplateKeyword() && !R.empty()) {
14551 NamedDecl *FoundDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
14556 // If a 'template' keyword was used, a lookup that finds only non-template
14560 << R.getLookupName() << Old->getQualifierLoc().getSourceRange()
14561 << Old->hasTemplateKeyword() << Old->getTemplateKeywordLoc();
14562 getSema().Diag(FoundDecl->getLocation(),
14582 LookupResult R(SemaRef, Old->getName(), Old->getNameLoc(),
14586 if (TransformOverloadExprDecls(Old, Old->requiresADL(), R))
14589 // Rebuild the nested-name qualifier, if present.
14591 if (Old->getQualifierLoc()) {
14593 = getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
14600 if (Old->getNamingClass()) {
14603 Old->getNameLoc(),
14604 Old->getNamingClass()));
14614 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
14615 TemplateArgumentListInfo TransArgs(Old->getLAngleLoc(), Old->getRAngleLoc());
14616 if (Old->hasExplicitTemplateArgs() &&
14617 getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14618 Old->getNumTemplateArgs(),
14625 // a non-static data member is named in an unevaluated operand, or when
14632 Old->hasExplicitTemplateArgs() ? &TransArgs : nullptr,
14637 if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid())
14638 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
14640 // If we have template arguments, then rebuild the template-id expression.
14642 Old->requiresADL(), &TransArgs);
14650 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
14651 TypeSourceInfo *From = E->getArg(I);
14652 TypeLoc FromTL = From->getTypeLoc();
14660 if (To == From->getType())
14682 ExpansionTL.getTypePtr()->getNumExpansions();
14695 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
14698 TLB.reserve(From->getTypeLoc().getFullDataSize());
14728 if (To->containsUnexpandedParameterPack()) {
14748 // forgetting the partially-substituted parameter pack.
14752 TLB.reserve(From->getTypeLoc().getFullDataSize());
14774 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
14775 E->getEndLoc());
14782 const ASTTemplateArgumentListInfo *Old = E->getTemplateArgsAsWritten();
14783 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
14784 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
14785 Old->NumTemplateArgs, TransArgs))
14789 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
14790 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
14802 // Expressions appearing within a requirement-body are unevaluated operands.
14809 E->getBody()->getBeginLoc());
14814 E->getRequiresKWLoc(), E->getRBraceLoc(), E, Body,
14815 E->getLocalParameters(), TransParamTypes, TransParams, ExtParamInfos);
14819 Param->setDeclContext(Body);
14829 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
14835 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
14836 ER->getReturnTypeRequirement()
14837 .getTypeConstraintTemplateParameterList()->getParam(0)
14838 ->setDeclContext(Body);
14844 E->getRequiresKWLoc(), Body, E->getLParenLoc(), TransParams,
14845 E->getRParenLoc(), TransReqs, E->getRBraceLoc());
14872 if (Req->isSubstitutionFailure()) {
14875 Req->getSubstitutionDiagnostic());
14878 TypeSourceInfo *TransType = getDerived().TransformType(Req->getType());
14888 if (Req->isExprSubstitutionFailure())
14889 TransExpr = Req->getExprSubstitutionDiagnostic();
14891 ExprResult TransExprRes = getDerived().TransformExpr(Req->getExpr());
14892 if (TransExprRes.isUsable() && TransExprRes.get()->hasPlaceholderType())
14900 const auto &RetReq = Req->getReturnTypeRequirement();
14916 return getDerived().RebuildExprRequirement(E, Req->isSimple(),
14917 Req->getNoexceptLoc(),
14921 Req->isSimple(), Req->getNoexceptLoc(), std::move(*TransRetReq));
14928 if (Req->hasInvalidConstraint()) {
14931 Req->getInvalidConstraintEntity(), Req->getConstraintSatisfaction());
14935 getDerived().TransformExpr(Req->getConstraintExpr());
14944 TypeSourceInfo *T = getDerived().TransformType(E->getQueriedTypeSourceInfo());
14949 T == E->getQueriedTypeSourceInfo())
14956 SubExpr = getDerived().TransformExpr(E->getDimensionExpression());
14961 return getDerived().RebuildArrayTypeTrait(E->getTrait(), E->getBeginLoc(), T,
14962 SubExpr.get(), E->getEndLoc());
14972 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
14976 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
14980 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
14981 SubExpr.get(), E->getEndLoc());
14998 return getDerived().RebuildParenExpr(NewDRE.get(), PE->getLParen(),
14999 PE->getRParen());
15013 assert(E->getQualifierLoc());
15015 getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
15018 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
15020 // TODO: If this is a conversion-function-id, verify that the
15025 getDerived().TransformDeclarationNameInfo(E->getNameInfo());
15029 if (!E->hasExplicitTemplateArgs()) {
15030 if (!getDerived().AlwaysRebuild() && QualifierLoc == E->getQualifierLoc() &&
15033 NameInfo.getName() == E->getDeclName())
15041 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
15043 E->getTemplateArgs(), E->getNumTemplateArgs(), TransArgs))
15054 // CXXConstructExprs other than for list-initialization and
15056 // a 1-argument construction we just transform that argument.
15058 ((E->getNumArgs() == 1 ||
15059 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
15060 (!getDerived().DropCallArgument(E->getArg(0))) &&
15061 !E->isListInitialization()))
15062 return getDerived().TransformInitializer(E->getArg(0),
15065 TemporaryBase Rebase(*this, /*FIXME*/ E->getBeginLoc(), DeclarationName());
15067 QualType T = getDerived().TransformType(E->getType());
15072 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15081 E->isListInitialization());
15082 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
15088 T == E->getType() &&
15089 Constructor == E->getConstructor() &&
15092 // FIXME: Instantiation-specific
15093 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
15098 T, /*FIXME:*/ E->getBeginLoc(), Constructor, E->isElidable(), Args,
15099 E->hadMultipleCandidates(), E->isListInitialization(),
15100 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
15101 E->getConstructionKind(), E->getParenOrBraceRange());
15107 QualType T = getDerived().TransformType(E->getType());
15112 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15117 T == E->getType() &&
15118 Constructor == E->getConstructor()) {
15120 // FIXME: Instantiation-specific
15121 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
15126 T, E->getLocation(), Constructor,
15127 E->constructsVBase(), E->inheritedFromVBase());
15130 /// Transform a C++ temporary-binding expression.
15137 if (auto *Dtor = E->getTemporary()->getDestructor())
15138 SemaRef.MarkFunctionReferenced(E->getBeginLoc(),
15140 return getDerived().TransformExpr(E->getSubExpr());
15151 return getDerived().TransformExpr(E->getSubExpr());
15159 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15164 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
15170 Args.reserve(E->getNumArgs());
15174 E->isListInitialization());
15175 if (TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
15179 if (E->isListInitialization() && !E->isStdInitListInitialization()) {
15180 ExprResult Res = RebuildInitList(E->getBeginLoc(), Args, E->getEndLoc());
15188 T == E->getTypeSourceInfo() &&
15189 Constructor == E->getConstructor() &&
15191 // FIXME: Instantiation-specific
15192 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
15196 SourceLocation LParenLoc = T->getTypeLoc().getEndLoc();
15198 T, LParenLoc, Args, E->getEndLoc(), E->isListInitialization());
15204 // Transform any init-capture expressions before entering the scope of the
15210 // Zero or more expansions of the init-capture.
15214 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
15215 for (LambdaExpr::capture_iterator C = E->capture_begin(),
15216 CEnd = E->capture_end();
15218 if (!E->isInitCapture(C))
15221 TransformedInitCapture &Result = InitCaptures[C - E->capture_begin()];
15222 auto *OldVD = cast<VarDecl>(C->getCapturedVar());
15227 OldVD->getInit(), OldVD->getInitStyle() == VarDecl::CallInit);
15237 C->getLocation(), C->getCaptureKind() == LCK_ByRef,
15238 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
15239 cast<VarDecl>(C->getCapturedVar())->getInitStyle() !=
15246 // If this is an init-capture pack, consider expanding the pack now.
15247 if (OldVD->isParameterPack()) {
15248 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
15249 ->getTypeLoc()
15252 SemaRef.collectUnexpandedParameterPacks(OldVD->getInit(), Unexpanded);
15259 ExpansionTL.getTypePtr()->getNumExpansions();
15263 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
15290 // - as parameter types are not instantiated from within a function's DC. We
15312 while (DC->isRequiresExprBody())
15313 DC = DC->getParent();
15316 (DC->isFileContext() || !DC->getParent()->isDependentContext()))
15319 CXXRecordDecl *OldClass = E->getLambdaClass();
15321 E->getIntroducerRange(), /*Info=*/nullptr, DependencyKind,
15322 E->getCaptureDefault());
15326 getSema().CreateLambdaCallOperator(E->getIntroducerRange(), Class);
15329 getSema().buildLambdaScope(LSI, NewCallOperator, E->getIntroducerRange(),
15330 E->getCaptureDefault(), E->getCaptureDefaultLoc(),
15331 E->hasExplicitParameters(), E->isMutable());
15340 for (LambdaExpr::capture_iterator C = E->capture_begin(),
15341 CEnd = E->capture_end();
15345 if (C->isImplicit())
15349 if (C->capturesThis()) {
15354 // Otherwise, leave the type of 'this' as-is.
15360 getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(),
15362 C->getCaptureKind() == LCK_StarThis);
15367 if (C->capturesVLAType())
15370 // Rebuild init-captures, including the implied field declaration.
15371 if (E->isInitCapture(C)) {
15372 TransformedInitCapture &NewC = InitCaptures[C - E->capture_begin()];
15374 auto *OldVD = cast<VarDecl>(C->getCapturedVar());
15385 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
15386 OldVD->getIdentifier(), OldVD->getInitStyle(), Init.get(),
15393 getSema().addInitCapture(LSI, NewVD, C->getCaptureKind() == LCK_ByRef);
15399 LSI->ContainsUnexpandedParameterPack |=
15400 Init.get()->containsUnexpandedParameterPack();
15410 assert(C->capturesVariable() && "unexpected kind of lambda capture");
15414 = C->isImplicit()? Sema::TryCapture_Implicit
15415 : C->getCaptureKind() == LCK_ByCopy
15419 if (C->isPackExpansion()) {
15420 UnexpandedParameterPack Unexpanded(C->getCapturedVar(), C->getLocation());
15424 if (getDerived().TryExpandParameterPacks(C->getEllipsisLoc(),
15425 C->getLocation(),
15437 auto *Pack = cast<ValueDecl>(C->getCapturedVar());
15441 getDerived().TransformDecl(C->getLocation(), Pack));
15448 getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind);
15456 EllipsisLoc = C->getEllipsisLoc();
15461 getDerived().TransformDecl(C->getLocation(), C->getCapturedVar()));
15462 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
15467 // This is not an init-capture; however it contains an unexpanded pack e.g.
15469 if (auto *VD = dyn_cast<VarDecl>(CapturedVar); VD && !C->isPackExpansion())
15470 LSI->ContainsUnexpandedParameterPack |= VD->isParameterPack();
15473 getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind,
15481 E->getTemplateParameterList());
15482 LSI->GLTemplateParameterList = TPL;
15486 LSI->ContainsUnexpandedParameterPack |=
15487 TPL->containsUnexpandedParameterPack();
15492 E->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
15497 LSI->ContainsUnexpandedParameterPack |=
15498 NewCallOpType->containsUnexpandedParameterPack();
15504 auto FPTL = NewCallOpTSI->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>();
15508 NewCallOperator, E->getCallOperator()->getLocation(),
15509 E->getCallOperator()->getInnerLocStart(),
15510 E->getCallOperator()->getTrailingRequiresClause(), NewCallOpTSI,
15511 E->getCallOperator()->getConstexprKind(),
15512 E->getCallOperator()->getStorageClass(), FPTL.getParams(),
15513 E->hasExplicitResultType());
15515 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
15516 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
15520 Sema::ContextRAII ManglingContext(getSema(), Class->getDeclContext());
15524 Numbering = OldClass->getLambdaNumbering();
15530 // FIXME: Sema's lambda-building mechanism expects us to push an expression
15533 E->getCallOperator()->isConsteval() ?
15538 E->getCallOperator()->isImmediateEscalating();
15542 C.PointOfInstantiation = E->getBody()->getBeginLoc();
15547 Invalid ? StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
15556 getSema().ActOnLambdaError(E->getBeginLoc(), /*CurScope=*/nullptr,
15603 Class->setLambdaDependencyKind(DependencyKind);
15604 // Clean up the type cache created previously. Then, we re-create a type for
15606 Class->setTypeForDecl(nullptr);
15609 return getDerived().RebuildLambdaExpr(E->getBeginLoc(),
15610 Body.get()->getEndLoc(), &LSICopy);
15623 for (LambdaExpr::capture_iterator C = E->capture_begin(),
15624 CEnd = E->capture_end();
15628 if (!C->isImplicit())
15632 if (C->capturesThis()) {
15633 getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(),
15635 C->getCaptureKind() == LCK_StarThis);
15640 if (C->capturesVLAType())
15643 assert(C->capturesVariable() && "unexpected kind of lambda capture");
15644 assert(!E->isInitCapture(C) && "implicit init-capture?");
15648 getDerived().TransformDecl(C->getLocation(), C->getCapturedVar()));
15649 if (!CapturedVar || CapturedVar->isInvalidDecl())
15653 getSema().tryCaptureVariable(CapturedVar, C->getLocation());
15664 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
15670 Args.reserve(E->getNumArgs());
15674 E->isListInitialization());
15675 if (getDerived().TransformExprs(E->arg_begin(), E->getNumArgs(), true, Args,
15681 T == E->getTypeSourceInfo() &&
15687 T, E->getLParenLoc(), Args, E->getRParenLoc(), E->isListInitialization());
15699 if (!E->isImplicitAccess()) {
15700 OldBase = E->getBase();
15709 E->getOperatorLoc(),
15710 E->isArrow()? tok::arrow : tok::period,
15717 BaseType = ((Expr*) Base.get())->getType();
15720 BaseType = getDerived().TransformType(E->getBaseType());
15721 ObjectType = BaseType->castAs<PointerType>()->getPointeeType();
15724 // Transform the first part of the nested-name-specifier that qualifies
15728 E->getFirstQualifierFoundInScope(),
15729 E->getQualifierLoc().getBeginLoc());
15732 if (E->getQualifier()) {
15734 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
15741 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
15743 // TODO: If this is a conversion-function-id, verify that the
15748 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
15752 if (!E->hasExplicitTemplateArgs()) {
15753 // This is a reference to a member without an explicitly-specified
15757 BaseType == E->getBaseType() &&
15758 QualifierLoc == E->getQualifierLoc() &&
15759 NameInfo.getName() == E->getMember() &&
15760 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
15765 E->isArrow(),
15766 E->getOperatorLoc(),
15774 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
15775 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
15776 E->getNumTemplateArgs(),
15782 E->isArrow(),
15783 E->getOperatorLoc(),
15797 if (!Old->isImplicitAccess()) {
15798 Base = getDerived().TransformExpr(Old->getBase());
15802 getSema().PerformMemberExprBaseConversion(Base.get(), Old->isArrow());
15805 BaseType = Base.get()->getType();
15807 BaseType = getDerived().TransformType(Old->getBaseType());
15811 if (Old->getQualifierLoc()) {
15813 getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
15818 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
15820 LookupResult R(SemaRef, Old->getMemberNameInfo(), Sema::LookupOrdinaryName);
15827 if (Old->getNamingClass()) {
15829 getDerived().TransformDecl(Old->getMemberLoc(), Old->getNamingClass()));
15837 if (Old->hasExplicitTemplateArgs()) {
15838 TransArgs.setLAngleLoc(Old->getLAngleLoc());
15839 TransArgs.setRAngleLoc(Old->getRAngleLoc());
15841 Old->getTemplateArgs(), Old->getNumTemplateArgs(), TransArgs))
15846 // first-qualifier-in-scope here, just in case we had a dependent
15848 // nested-name-qualifier (and therefore could do the lookup).
15852 Base.get(), BaseType, Old->getOperatorLoc(), Old->isArrow(), QualifierLoc,
15854 (Old->hasExplicitTemplateArgs() ? &TransArgs : nullptr));
15862 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
15866 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
15869 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
15875 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
15879 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
15882 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
15883 E->getNumExpansions());
15889 // If E is not value-dependent, then nothing will change when we transform it.
15890 // Note: This is an instantiation-centric view.
15891 if (!E->isValueDependent())
15901 if (E->isPartiallySubstituted()) {
15902 PackArgs = E->getPartialArguments();
15903 } else if (E->isValueDependent()) {
15904 UnexpandedParameterPack Unexpanded(E->getPack(), E->getPackLoc());
15908 if (getDerived().TryExpandParameterPacks(E->getOperatorLoc(), E->getPackLoc(),
15914 // If we need to expand the pack, build a template argument from it and
15917 auto *Pack = E->getPack();
15926 VD, VD->getType().getNonLValueExprType(getSema().Context),
15927 VD->getType()->isReferenceType() ? VK_LValue : VK_PRValue,
15928 E->getPackLoc());
15933 E->getPackLoc(), std::nullopt);
15942 getDerived().TransformDecl(E->getPackLoc(), E->getPack()));
15946 E->getOperatorLoc(), Pack, E->getPackLoc(), E->getRParenLoc(),
15970 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
15991 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
15992 E->getPackLoc(),
15993 E->getRParenLoc(), *Result, {});
15995 TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(),
15996 E->getPackLoc());
15998 TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity());
16007 // Check whether we managed to fully-expand the pack.
16019 E->getOperatorLoc(), E->getPack(), E->getPackLoc(), E->getRParenLoc(),
16022 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
16023 E->getPackLoc(), E->getRParenLoc(),
16030 if (!E->isValueDependent())
16038 IndexExpr = getDerived().TransformExpr(E->getIndexExpr());
16045 if (!E->expandsToEmptyPack() && E->getExpressions().empty()) {
16046 Expr *Pattern = E->getPackIdExpression();
16048 getSema().collectUnexpandedParameterPacks(E->getPackIdExpression(),
16059 E->getEllipsisLoc(), Pattern->getSourceRange(), Unexpanded,
16063 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16068 E->getEllipsisLoc(), E->getRSquareLoc(), Pack.get(), IndexExpr.get(),
16076 if (Out.get()->containsUnexpandedParameterPack()) {
16077 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
16086 // forgetting the partially-substituted parameter pack.
16094 Out = getDerived().RebuildPackExpansion(Out.get(), E->getEllipsisLoc(),
16101 } else if (!E->expandsToEmptyPack()) {
16102 if (getDerived().TransformExprs(E->getExpressions().data(),
16103 E->getExpressions().size(), false,
16109 E->getEllipsisLoc(), E->getRSquareLoc(), E->getPackIdExpression(),
16141 if (TransformExprs(E->getExprs().begin(), E->getNumExprs(),
16150 return RebuildResolvedUnexpandedPackExpr(E->getBeginLoc(), E->getType(),
16158 return getDerived().TransformExpr(E->getSubExpr());
16165 if (Expr *OldCallee = E->getCallee()) {
16172 Expr *Pattern = E->getPattern();
16182 std::optional<unsigned> OrigNumExpansions = E->getNumExpansions(),
16184 if (getDerived().TryExpandParameterPacks(E->getEllipsisLoc(),
16185 Pattern->getSourceRange(),
16194 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16197 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) : ExprResult();
16202 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) : ExprResult();
16207 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
16211 Callee, E->getBeginLoc(), LHS.get(), E->getOperator(),
16212 E->getEllipsisLoc(), RHS.get(), E->getEndLoc(), NumExpansions);
16219 SemaRef.Diag(E->getEllipsisLoc(),
16222 << E->getSourceRange();
16223 SemaRef.Diag(E->getEllipsisLoc(), diag::note_bracket_depth);
16229 ExprResult Result = getDerived().TransformExpr(E->getInit());
16232 bool LeftFold = E->isLeftFold();
16244 Callee, E->getBeginLoc(), Out.get(), E->getOperator(),
16245 E->getEllipsisLoc(), Result.get(), E->getEndLoc(), OrigNumExpansions);
16252 getSema(), LeftFold ? I : *NumExpansions - I - 1);
16257 if (Out.get()->containsUnexpandedParameterPack()) {
16260 Callee, E->getBeginLoc(), LeftFold ? Result.get() : Out.get(),
16261 E->getOperator(), E->getEllipsisLoc(),
16262 LeftFold ? Out.get() : Result.get(), E->getEndLoc(),
16265 // We've got down to a single element; build a binary operator.
16270 Functions.append(Callee->decls_begin(), Callee->decls_end());
16272 BinaryOperator::getOverloadedOperator(E->getOperator()),
16273 E->getEllipsisLoc(), Callee->getBeginLoc(), Callee->requiresADL(),
16276 Result = getDerived().RebuildBinaryOperator(E->getEllipsisLoc(),
16277 E->getOperator(), LHS, RHS);
16296 Callee, E->getBeginLoc(), Result.get(), E->getOperator(),
16297 E->getEllipsisLoc(), Out.get(), E->getEndLoc(), OrigNumExpansions);
16303 PE->setIsProducedByFoldExpansion();
16308 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
16309 E->getOperator());
16317 ArrayRef<Expr *> InitExprs = E->getInitExprs();
16322 return getDerived().RebuildParenListExpr(E->getBeginLoc(), TransformedInits,
16323 E->getEndLoc());
16330 return getDerived().TransformExpr(E->getSubExpr());
16348 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
16353 SubExpr.get() == E->getSubExpr())
16356 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
16365 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
16372 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
16384 for (unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
16385 ObjCDictionaryElement OrigElement = E->getKeyValueElement(I);
16400 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
16401 OrigElement.Value->getEndLoc());
16411 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
16456 if (Key.get()->containsUnexpandedParameterPack() ||
16457 Value.get()->containsUnexpandedParameterPack())
16494 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
16502 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
16507 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
16510 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
16512 E->getRParenLoc());
16522 return getDerived().TransformExpr(E->getSubExpr());
16529 = getDerived().TransformType(E->getTypeInfoAsWritten());
16533 ExprResult Result = getDerived().TransformExpr(E->getSubExpr());
16538 TSInfo == E->getTypeInfoAsWritten() &&
16539 Result.get() == E->getSubExpr())
16543 E->getLParenLoc(), E->getBridgeKind(), E->getBridgeKeywordLoc(), TSInfo,
16559 Args.reserve(E->getNumArgs());
16560 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), false, Args,
16564 if (E->getReceiverKind() == ObjCMessageExpr::Class) {
16567 = getDerived().TransformType(E->getClassReceiverTypeInfo());
16573 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
16576 // Build a new class message send.
16578 E->getSelectorLocs(SelLocs);
16580 E->getSelector(),
16582 E->getMethodDecl(),
16583 E->getLeftLoc(),
16585 E->getRightLoc());
16587 else if (E->getReceiverKind() == ObjCMessageExpr::SuperClass ||
16588 E->getReceiverKind() == ObjCMessageExpr::SuperInstance) {
16589 if (!E->getMethodDecl())
16592 // Build a new class message send to 'super'.
16594 E->getSelectorLocs(SelLocs);
16595 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
16596 E->getSelector(),
16598 E->getReceiverType(),
16599 E->getMethodDecl(),
16600 E->getLeftLoc(),
16602 E->getRightLoc());
16606 assert(E->getReceiverKind() == ObjCMessageExpr::Instance &&
16609 = getDerived().TransformExpr(E->getInstanceReceiver());
16615 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
16618 // Build a new instance message send.
16620 E->getSelectorLocs(SelLocs);
16622 E->getSelector(),
16624 E->getMethodDecl(),
16625 E->getLeftLoc(),
16627 E->getRightLoc());
16646 ExprResult Base = getDerived().TransformExpr(E->getBase());
16654 Base.get() == E->getBase())
16657 return getDerived().RebuildObjCIvarRefExpr(Base.get(), E->getDecl(),
16658 E->getLocation(),
16659 E->isArrow(), E->isFreeIvar());
16667 if (!E->isObjectReceiver())
16671 ExprResult Base = getDerived().TransformExpr(E->getBase());
16679 Base.get() == E->getBase())
16682 if (E->isExplicitProperty())
16684 E->getExplicitProperty(),
16685 E->getLocation());
16689 E->getImplicitPropertyGetter(),
16690 E->getImplicitPropertySetter(),
16691 E->getLocation());
16698 ExprResult Base = getDerived().TransformExpr(E->getBaseExpr());
16703 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
16709 Key.get() == E->getKeyExpr() && Base.get() == E->getBaseExpr())
16712 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
16714 E->getAtIndexMethodDecl(),
16715 E->setAtIndexMethodDecl());
16722 ExprResult Base = getDerived().TransformExpr(E->getBase());
16728 Base.get() == E->getBase())
16731 return getDerived().RebuildObjCIsaExpr(Base.get(), E->getIsaMemberLoc(),
16732 E->getOpLoc(),
16733 E->isArrow());
16741 SubExprs.reserve(E->getNumSubExprs());
16742 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(), false,
16750 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
16752 E->getRParenLoc());
16758 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
16762 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
16767 Type == E->getTypeSourceInfo() &&
16768 SrcExpr.get() == E->getSrcExpr())
16771 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
16773 E->getRParenLoc());
16779 BlockDecl *oldBlock = E->getBlockDecl();
16781 SemaRef.ActOnBlockStart(E->getCaretLocation(), /*Scope=*/nullptr);
16784 blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
16785 blockScope->TheDecl->setBlockMissingReturnType(
16786 oldBlock->blockMissingReturnType());
16791 const FunctionProtoType *exprFunctionType = E->getFunctionType();
16796 E->getCaretLocation(), oldBlock->parameters(), nullptr,
16797 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, &params,
16799 getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
16804 getDerived().TransformType(exprFunctionType->getReturnType());
16806 auto epi = exprFunctionType->getExtProtoInfo();
16811 blockScope->FunctionType = functionType;
16815 blockScope->TheDecl->setParams(params);
16817 if (!oldBlock->blockMissingReturnType()) {
16818 blockScope->HasImplicitReturnType = false;
16819 blockScope->ReturnType = exprResultType;
16823 StmtResult body = getDerived().TransformStmt(E->getBody());
16825 getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
16833 for (const auto &I : oldBlock->captures()) {
16837 if (oldCapture->isParameterPack())
16841 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
16843 assert(blockScope->CaptureMap.count(newCapture));
16849 assert((!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
16854 return SemaRef.ActOnBlockStmtExpr(E->getCaretLocation(), body.get(),
16861 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
16865 QualType Type = getDerived().TransformType(E->getType());
16867 return SemaRef.BuildAsTypeExpr(SrcExpr.get(), Type, E->getBuiltinLoc(),
16868 E->getRParenLoc());
16876 SubExprs.reserve(E->getNumSubExprs());
16877 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(), false,
16885 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
16886 E->getOp(), E->getRParenLoc());
16889 //===----------------------------------------------------------------------===//
16891 //===----------------------------------------------------------------------===//
16978 if (Size->getBitWidth() == SemaRef.Context.getIntWidth(T)) {
17103 if (D->isInvalidDecl()) return QualType();
17110 if (UPD->expansions().empty()) {
17112 << UPD->isCXXClassMember() << UPD;
17121 for (auto *E : UPD->expansions()) {
17125 else if (ThisT->getAs<UnresolvedUsingType>())
17135 assert(Using->hasTypename() &&
17136 "UnresolvedUsingTypenameDecl transformed to non-typename using");
17139 assert(++Using->shadow_begin() == Using->shadow_end());
17141 UsingShadowDecl *Shadow = *Using->shadow_begin();
17142 if (SemaRef.DiagnoseUseOfDecl(Shadow->getTargetDecl(), Loc))
17146 cast<TypeDecl>(Shadow->getTargetDecl())));
17149 "UnresolvedUsingTypenameDecl transformed to non-using decl");
17281 if (First->getObjectKind() == OK_ObjCProperty) {
17292 if (Second && Second->getObjectKind() == OK_ObjCProperty) {
17301 if (!First->getType()->isOverloadableType() &&
17302 !Second->getType()->isOverloadableType())
17308 if (First->getType()->isDependentType())
17310 // -> is never a builtin operation.
17313 if (!First->getType()->isOverloadableType() ||
17316 // of the form &Class::member, so try to create a built-in unary
17324 if (!First->isTypeDependent() && !Second->isTypeDependent() &&
17325 !First->getType()->isOverloadableType() &&
17326 !Second->getType()->isOverloadableType()) {
17327 // Neither of the arguments is type-dependent or has an overloadable
17328 // type, so try to create a built-in binary operation.
17367 QualType BaseType = Base->getType();
17368 if (Base->isTypeDependent() || Destroyed.getIdentifier() ||
17369 (!isArrow && !BaseType->getAs<RecordType>()) ||
17370 (isArrow && BaseType->getAs<PointerType>() &&
17371 !BaseType->castAs<PointerType>()->getPointeeType()
17372 ->template getAs<RecordType>())){
17373 // This pseudo-destructor expression is still a pseudo-destructor.
17381 SemaRef.Context.getCanonicalType(DestroyedType->getType())));
17388 if (!ScopeType->getType()->getAs<TagType>()) {
17389 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
17391 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
17394 SS.Extend(SemaRef.Context, SourceLocation(), ScopeType->getTypeLoc(),
17411 SourceLocation Loc = S->getBeginLoc();
17412 CapturedDecl *CD = S->getCapturedDecl();
17413 unsigned NumParams = CD->getNumParams();
17414 unsigned ContextParamPos = CD->getContextParamPosition();
17420 CD->getParam(I)->getName(),
17421 getDerived().TransformType(CD->getParam(I)->getType())));
17427 S->getCapturedRegionKind(), Params);
17431 Body = getDerived().TransformStmt(S->getCapturedStmt());
17445 // SYCLKernelCallStmt nodes are inserted upon completion of a (non-template)
17456 return getDerived().TransformExpr(E->getArgLValue());