clang 10.0.0git

TreeTransform.h
Go to the documentation of this file.
1 //===------- TreeTransform.h - Semantic Tree Transformation -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //===----------------------------------------------------------------------===//
7 //
8 // This file implements a semantic tree transformation that takes a given
9 // AST and rebuilds it, possibly transforming some nodes in the process.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
14 #define LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
15
16 #include "CoroutineStmtBuilder.h"
17 #include "TypeLocBuilder.h"
18 #include "clang/AST/Decl.h"
19 #include "clang/AST/DeclObjC.h"
20 #include "clang/AST/DeclTemplate.h"
21 #include "clang/AST/Expr.h"
22 #include "clang/AST/ExprConcepts.h"
23 #include "clang/AST/ExprCXX.h"
24 #include "clang/AST/ExprObjC.h"
25 #include "clang/AST/ExprOpenMP.h"
26 #include "clang/AST/OpenMPClause.h"
27 #include "clang/AST/Stmt.h"
28 #include "clang/AST/StmtCXX.h"
29 #include "clang/AST/StmtObjC.h"
30 #include "clang/AST/StmtOpenMP.h"
31 #include "clang/Sema/Designator.h"
32 #include "clang/Sema/Lookup.h"
33 #include "clang/Sema/Ownership.h"
34 #include "clang/Sema/ParsedTemplate.h"
35 #include "clang/Sema/ScopeInfo.h"
36 #include "clang/Sema/SemaDiagnostic.h"
37 #include "clang/Sema/SemaInternal.h"
38 #include "llvm/ADT/ArrayRef.h"
39 #include "llvm/Support/ErrorHandling.h"
40 #include <algorithm>
41
42 using namespace llvm::omp;
43
44 namespace clang {
45 using namespace sema;
46
47 /// A semantic tree transformation that allows one to transform one
48 /// abstract syntax tree into another.
49 ///
50 /// A new tree transformation is defined by creating a new subclass \c X of
51 /// \c TreeTransform<X> and then overriding certain operations to provide
52 /// behavior specific to that transformation. For example, template
53 /// instantiation is implemented as a tree transformation where the
54 /// transformation of TemplateTypeParmType nodes involves substituting the
55 /// template arguments for their corresponding template parameters; a similar
56 /// transformation is performed for non-type template parameters and
57 /// template template parameters.
58 ///
59 /// This tree-transformation template uses static polymorphism to allow
60 /// subclasses to customize any of its operations. Thus, a subclass can
61 /// override any of the transformation or rebuild operators by providing an
62 /// operation with the same signature as the default implementation. The
63 /// overriding function should not be virtual.
64 ///
65 /// Semantic tree transformations are split into two stages, either of which
66 /// can be replaced by a subclass. The "transform" step transforms an AST node
67 /// or the parts of an AST node using the various transformation functions,
68 /// then passes the pieces on to the "rebuild" step, which constructs a new AST
69 /// node of the appropriate kind from the pieces. The default transformation
70 /// routines recursively transform the operands to composite AST nodes (e.g.,
71 /// the pointee type of a PointerType node) and, if any of those operand nodes
72 /// were changed by the transformation, invokes the rebuild operation to create
73 /// a new AST node.
74 ///
75 /// Subclasses can customize the transformation at various levels. The
76 /// most coarse-grained transformations involve replacing TransformType(),
77 /// TransformExpr(), TransformDecl(), TransformNestedNameSpecifierLoc(),
78 /// TransformTemplateName(), or TransformTemplateArgument() with entirely
79 /// new implementations.
80 ///
81 /// For more fine-grained transformations, subclasses can replace any of the
82 /// \c TransformXXX functions (where XXX is the name of an AST node, e.g.,
83 /// PointerType, StmtExpr) to alter the transformation. As mentioned previously,
84 /// replacing TransformTemplateTypeParmType() allows template instantiation
85 /// to substitute template arguments for their corresponding template
86 /// parameters. Additionally, subclasses can override the \c RebuildXXX
87 /// functions to control how AST nodes are rebuilt when their operands change.
88 /// By default, \c TreeTransform will invoke semantic analysis to rebuild
89 /// AST nodes. However, certain other tree transformations (e.g, cloning) may
90 /// be able to use more efficient rebuild steps.
91 ///
92 /// There are a handful of other functions that can be overridden, allowing one
93 /// to avoid traversing nodes that don't need any transformation
94 /// (\c AlreadyTransformed()), force rebuilding AST nodes even when their
95 /// operands have not changed (\c AlwaysRebuild()), and customize the
96 /// default locations and entity names used for type-checking
97 /// (\c getBaseLocation(), \c getBaseEntity()).
98 template<typename Derived>
99 class TreeTransform {
100 /// Private RAII object that helps us forget and then re-remember
101 /// the template argument corresponding to a partially-substituted parameter
102 /// pack.
103 class ForgetPartiallySubstitutedPackRAII {
104 Derived &Self;
105 TemplateArgument Old;
106
107 public:
108 ForgetPartiallySubstitutedPackRAII(Derived &Self) : Self(Self) {
109 Old = Self.ForgetPartiallySubstitutedPack();
110 }
111
112 ~ForgetPartiallySubstitutedPackRAII() {
113 Self.RememberPartiallySubstitutedPack(Old);
114 }
115 };
116
117 protected:
118 Sema &SemaRef;
119
120 /// The set of local declarations that have been transformed, for
121 /// cases where we are forced to build new declarations within the transformer
122 /// rather than in the subclass (e.g., lambda closure types).
123 llvm::DenseMap<Decl *, Decl *> TransformedLocalDecls;
124
125 public:
126 /// Initializes a new tree transformer.
127 TreeTransform(Sema &SemaRef) : SemaRef(SemaRef) { }
128
129 /// Retrieves a reference to the derived class.
130 Derived &getDerived() { return static_cast<Derived&>(*this); }
131
132 /// Retrieves a reference to the derived class.
133 const Derived &getDerived() const {
134 return static_cast<const Derived&>(*this);
135 }
136
137 static inline ExprResult Owned(Expr *E) { return E; }
138 static inline StmtResult Owned(Stmt *S) { return S; }
139
140 /// Retrieves a reference to the semantic analysis object used for
141 /// this tree transform.
142 Sema &getSema() const { return SemaRef; }
143
144 /// Whether the transformation should always rebuild AST nodes, even
145 /// if none of the children have changed.
146 ///
147 /// Subclasses may override this function to specify when the transformation
148 /// should rebuild all AST nodes.
149 ///
150 /// We must always rebuild all AST nodes when performing variadic template
151 /// pack expansion, in order to avoid violating the AST invariant that each
152 /// statement node appears at most once in its containing declaration.
153 bool AlwaysRebuild() { return SemaRef.ArgumentPackSubstitutionIndex != -1; }
154
155 /// Whether the transformation is forming an expression or statement that
156 /// replaces the original. In this case, we'll reuse mangling numbers from
157 /// existing lambdas.
158 bool ReplacingOriginal() { return false; }
159
160 /// Returns the location of the entity being transformed, if that
161 /// information was not available elsewhere in the AST.
162 ///
163 /// By default, returns no source-location information. Subclasses can
164 /// provide an alternative implementation that provides better location
165 /// information.
166 SourceLocation getBaseLocation() { return SourceLocation(); }
167
168 /// Returns the name of the entity being transformed, if that
169 /// information was not available elsewhere in the AST.
170 ///
171 /// By default, returns an empty name. Subclasses can provide an alternative
172 /// implementation with a more precise name.
173 DeclarationName getBaseEntity() { return DeclarationName(); }
174
175 /// Sets the "base" location and entity when that
176 /// information is known based on another transformation.
177 ///
178 /// By default, the source location and entity are ignored. Subclasses can
179 /// override this function to provide a customized implementation.
180 void setBase(SourceLocation Loc, DeclarationName Entity) { }
181
182 /// RAII object that temporarily sets the base location and entity
183 /// used for reporting diagnostics in types.
184 class TemporaryBase {
185 TreeTransform &Self;
186 SourceLocation OldLocation;
187 DeclarationName OldEntity;
188
189 public:
190 TemporaryBase(TreeTransform &Self, SourceLocation Location,
191 DeclarationName Entity) : Self(Self) {
192 OldLocation = Self.getDerived().getBaseLocation();
193 OldEntity = Self.getDerived().getBaseEntity();
194
195 if (Location.isValid())
196 Self.getDerived().setBase(Location, Entity);
197 }
198
199 ~TemporaryBase() {
200 Self.getDerived().setBase(OldLocation, OldEntity);
201 }
202 };
203
204 /// Determine whether the given type \p T has already been
205 /// transformed.
206 ///
207 /// Subclasses can provide an alternative implementation of this routine
208 /// to short-circuit evaluation when it is known that a given type will
209 /// not change. For example, template instantiation need not traverse
210 /// non-dependent types.
211 bool AlreadyTransformed(QualType T) {
212 return T.isNull();
213 }
214
215 /// Determine whether the given call argument should be dropped, e.g.,
216 /// because it is a default argument.
217 ///
218 /// Subclasses can provide an alternative implementation of this routine to
219 /// determine which kinds of call arguments get dropped. By default,
220 /// CXXDefaultArgument nodes are dropped (prior to transformation).
221 bool DropCallArgument(Expr *E) {
222 return E->isDefaultArgument();
223 }
224
225 /// Determine whether we should expand a pack expansion with the
226 /// given set of parameter packs into separate arguments by repeatedly
227 /// transforming the pattern.
228 ///
229 /// By default, the transformer never tries to expand pack expansions.
230 /// Subclasses can override this routine to provide different behavior.
231 ///
232 /// \param EllipsisLoc The location of the ellipsis that identifies the
233 /// pack expansion.
234 ///
235 /// \param PatternRange The source range that covers the entire pattern of
236 /// the pack expansion.
237 ///
238 /// \param Unexpanded The set of unexpanded parameter packs within the
239 /// pattern.
240 ///
241 /// \param ShouldExpand Will be set to \c true if the transformer should
242 /// expand the corresponding pack expansions into separate arguments. When
243 /// set, \c NumExpansions must also be set.
244 ///
245 /// \param RetainExpansion Whether the caller should add an unexpanded
246 /// pack expansion after all of the expanded arguments. This is used
247 /// when extending explicitly-specified template argument packs per
248 /// C++0x [temp.arg.explicit]p9.
249 ///
250 /// \param NumExpansions The number of separate arguments that will be in
251 /// the expanded form of the corresponding pack expansion. This is both an
252 /// input and an output parameter, which can be set by the caller if the
253 /// number of expansions is known a priori (e.g., due to a prior substitution)
254 /// and will be set by the callee when the number of expansions is known.
255 /// The callee must set this value when \c ShouldExpand is \c true; it may
256 /// set this value in other cases.
257 ///
258 /// \returns true if an error occurred (e.g., because the parameter packs
259 /// are to be instantiated with arguments of different lengths), false
260 /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
261 /// must be set.
262 bool TryExpandParameterPacks(SourceLocation EllipsisLoc,
263 SourceRange PatternRange,
264 ArrayRef<UnexpandedParameterPack> Unexpanded,
265 bool &ShouldExpand,
266 bool &RetainExpansion,
267 Optional<unsigned> &NumExpansions) {
268 ShouldExpand = false;
269 return false;
270 }
271
272 /// "Forget" about the partially-substituted pack template argument,
273 /// when performing an instantiation that must preserve the parameter pack
274 /// use.
275 ///
276 /// This routine is meant to be overridden by the template instantiator.
277 TemplateArgument ForgetPartiallySubstitutedPack() {
278 return TemplateArgument();
279 }
280
281 /// "Remember" the partially-substituted pack template argument
282 /// after performing an instantiation that must preserve the parameter pack
283 /// use.
284 ///
285 /// This routine is meant to be overridden by the template instantiator.
286 void RememberPartiallySubstitutedPack(TemplateArgument Arg) { }
287
288 /// Note to the derived class when a function parameter pack is
289 /// being expanded.
290 void ExpandingFunctionParameterPack(ParmVarDecl *Pack) { }
291
292 /// Transforms the given type into another type.
293 ///
294 /// By default, this routine transforms a type by creating a
295 /// TypeSourceInfo for it and delegating to the appropriate
296 /// function. This is expensive, but we don't mind, because
297 /// this method is deprecated anyway; all users should be
298 /// switched to storing TypeSourceInfos.
299 ///
300 /// \returns the transformed type.
301 QualType TransformType(QualType T);
302
303 /// Transforms the given type-with-location into a new
304 /// type-with-location.
305 ///
306 /// By default, this routine transforms a type by delegating to the
307 /// appropriate TransformXXXType to build a new type. Subclasses
308 /// may override this function (to take over all type
309 /// transformations) or some set of the TransformXXXType functions
310 /// to alter the transformation.
311 TypeSourceInfo *TransformType(TypeSourceInfo *DI);
312
313 /// Transform the given type-with-location into a new
314 /// type, collecting location information in the given builder
315 /// as necessary.
316 ///
317 QualType TransformType(TypeLocBuilder &TLB, TypeLoc TL);
318
319 /// Transform a type that is permitted to produce a
320 /// DeducedTemplateSpecializationType.
321 ///
322 /// This is used in the (relatively rare) contexts where it is acceptable
323 /// for transformation to produce a class template type with deduced
324 /// template arguments.
325 /// @{
326 QualType TransformTypeWithDeducedTST(QualType T);
327 TypeSourceInfo *TransformTypeWithDeducedTST(TypeSourceInfo *DI);
328 /// @}
329
330 /// The reason why the value of a statement is not discarded, if any.
331 enum StmtDiscardKind {
332 SDK_Discarded,
333 SDK_NotDiscarded,
334 SDK_StmtExprResult,
335 };
336
337 /// Transform the given statement.
338 ///
339 /// By default, this routine transforms a statement by delegating to the
340 /// appropriate TransformXXXStmt function to transform a specific kind of
341 /// statement or the TransformExpr() function to transform an expression.
342 /// Subclasses may override this function to transform statements using some
343 /// other mechanism.
344 ///
345 /// \returns the transformed statement.
346 StmtResult TransformStmt(Stmt *S, StmtDiscardKind SDK = SDK_Discarded);
347
348 /// Transform the given statement.
349 ///
350 /// By default, this routine transforms a statement by delegating to the
351 /// appropriate TransformOMPXXXClause function to transform a specific kind
352 /// of clause. Subclasses may override this function to transform statements
353 /// using some other mechanism.
354 ///
355 /// \returns the transformed OpenMP clause.
356 OMPClause *TransformOMPClause(OMPClause *S);
357
358 /// Transform the given attribute.
359 ///
360 /// By default, this routine transforms a statement by delegating to the
361 /// appropriate TransformXXXAttr function to transform a specific kind
362 /// of attribute. Subclasses may override this function to transform
363 /// attributed statements using some other mechanism.
364 ///
365 /// \returns the transformed attribute
366 const Attr *TransformAttr(const Attr *S);
367
368 /// Transform the specified attribute.
369 ///
370 /// Subclasses should override the transformation of attributes with a pragma
371 /// spelling to transform expressions stored within the attribute.
372 ///
373 /// \returns the transformed attribute.
374 #define ATTR(X)
375 #define PRAGMA_SPELLING_ATTR(X) \
376 const X##Attr *Transform##X##Attr(const X##Attr *R) { return R; }
377 #include "clang/Basic/AttrList.inc"
378
379 /// Transform the given expression.
380 ///
381 /// By default, this routine transforms an expression by delegating to the
382 /// appropriate TransformXXXExpr function to build a new expression.
383 /// Subclasses may override this function to transform expressions using some
384 /// other mechanism.
385 ///
386 /// \returns the transformed expression.
387 ExprResult TransformExpr(Expr *E);
388
389 /// Transform the given initializer.
390 ///
391 /// By default, this routine transforms an initializer by stripping off the
392 /// semantic nodes added by initialization, then passing the result to
393 /// TransformExpr or TransformExprs.
394 ///
395 /// \returns the transformed initializer.
396 ExprResult TransformInitializer(Expr *Init, bool NotCopyInit);
397
398 /// Transform the given list of expressions.
399 ///
400 /// This routine transforms a list of expressions by invoking
401 /// \c TransformExpr() for each subexpression. However, it also provides
402 /// support for variadic templates by expanding any pack expansions (if the
403 /// derived class permits such expansion) along the way. When pack expansions
404 /// are present, the number of outputs may not equal the number of inputs.
405 ///
406 /// \param Inputs The set of expressions to be transformed.
407 ///
408 /// \param NumInputs The number of expressions in \c Inputs.
409 ///
410 /// \param IsCall If \c true, then this transform is being performed on
411 /// function-call arguments, and any arguments that should be dropped, will
412 /// be.
413 ///
414 /// \param Outputs The transformed input expressions will be added to this
415 /// vector.
416 ///
417 /// \param ArgChanged If non-NULL, will be set \c true if any argument changed
418 /// due to transformation.
419 ///
420 /// \returns true if an error occurred, false otherwise.
421 bool TransformExprs(Expr *const *Inputs, unsigned NumInputs, bool IsCall,
422 SmallVectorImpl<Expr *> &Outputs,
423 bool *ArgChanged = nullptr);
424
425 /// Transform the given declaration, which is referenced from a type
426 /// or expression.
427 ///
428 /// By default, acts as the identity function on declarations, unless the
429 /// transformer has had to transform the declaration itself. Subclasses
430 /// may override this function to provide alternate behavior.
431 Decl *TransformDecl(SourceLocation Loc, Decl *D) {
432 llvm::DenseMap<Decl *, Decl *>::iterator Known
433 = TransformedLocalDecls.find(D);
434 if (Known != TransformedLocalDecls.end())
435 return Known->second;
436
437 return D;
438 }
439
440 /// Transform the specified condition.
441 ///
442 /// By default, this transforms the variable and expression and rebuilds
443 /// the condition.
444 Sema::ConditionResult TransformCondition(SourceLocation Loc, VarDecl *Var,
445 Expr *Expr,
446 Sema::ConditionKind Kind);
447
448 /// Transform the attributes associated with the given declaration and
449 /// place them on the new declaration.
450 ///
451 /// By default, this operation does nothing. Subclasses may override this
452 /// behavior to transform attributes.
453 void transformAttrs(Decl *Old, Decl *New) { }
454
455 /// Note that a local declaration has been transformed by this
456 /// transformer.
457 ///
458 /// Local declarations are typically transformed via a call to
459 /// TransformDefinition. However, in some cases (e.g., lambda expressions),
460 /// the transformer itself has to transform the declarations. This routine
461 /// can be overridden by a subclass that keeps track of such mappings.
462 void transformedLocalDecl(Decl *Old, ArrayRef<Decl *> New) {
463 assert(New.size() == 1 &&
464 "must override transformedLocalDecl if performing pack expansion");
465 TransformedLocalDecls[Old] = New.front();
466 }
467
468 /// Transform the definition of the given declaration.
469 ///
470 /// By default, invokes TransformDecl() to transform the declaration.
471 /// Subclasses may override this function to provide alternate behavior.
472 Decl *TransformDefinition(SourceLocation Loc, Decl *D) {
473 return getDerived().TransformDecl(Loc, D);
474 }
475
476 /// Transform the given declaration, which was the first part of a
477 /// nested-name-specifier in a member access expression.
478 ///
479 /// This specific declaration transformation only applies to the first
480 /// identifier in a nested-name-specifier of a member access expression, e.g.,
481 /// the \c T in \c x->T::member
482 ///
483 /// By default, invokes TransformDecl() to transform the declaration.
484 /// Subclasses may override this function to provide alternate behavior.
485 NamedDecl *TransformFirstQualifierInScope(NamedDecl *D, SourceLocation Loc) {
486 return cast_or_null<NamedDecl>(getDerived().TransformDecl(Loc, D));
487 }
488
489 /// Transform the set of declarations in an OverloadExpr.
490 bool TransformOverloadExprDecls(OverloadExpr *Old, bool RequiresADL,
491 LookupResult &R);
492
493 /// Transform the given nested-name-specifier with source-location
494 /// information.
495 ///
496 /// By default, transforms all of the types and declarations within the
497 /// nested-name-specifier. Subclasses may override this function to provide
498 /// alternate behavior.
499 NestedNameSpecifierLoc
500 TransformNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
501 QualType ObjectType = QualType(),
502 NamedDecl *FirstQualifierInScope = nullptr);
503
504 /// Transform the given declaration name.
505 ///
506 /// By default, transforms the types of conversion function, constructor,
507 /// and destructor names and then (if needed) rebuilds the declaration name.
508 /// Identifiers and selectors are returned unmodified. Sublcasses may
509 /// override this function to provide alternate behavior.
510 DeclarationNameInfo
511 TransformDeclarationNameInfo(const DeclarationNameInfo &NameInfo);
512
513 bool TransformRequiresExprRequirements(ArrayRef<concepts::Requirement *> Reqs,
514 llvm::SmallVectorImpl<concepts::Requirement *> &Transformed);
515 concepts::TypeRequirement *
516 TransformTypeRequirement(concepts::TypeRequirement *Req);
517 concepts::ExprRequirement *
518 TransformExprRequirement(concepts::ExprRequirement *Req);
519 concepts::NestedRequirement *
520 TransformNestedRequirement(concepts::NestedRequirement *Req);
521
522 /// Transform the given template name.
523 ///
524 /// \param SS The nested-name-specifier that qualifies the template
525 /// name. This nested-name-specifier must already have been transformed.
526 ///
527 /// \param Name The template name to transform.
528 ///
529 /// \param NameLoc The source location of the template name.
530 ///
531 /// \param ObjectType If we're translating a template name within a member
532 /// access expression, this is the type of the object whose member template
533 /// is being referenced.
534 ///
535 /// \param FirstQualifierInScope If the first part of a nested-name-specifier
536 /// also refers to a name within the current (lexical) scope, this is the
537 /// declaration it refers to.
538 ///
539 /// By default, transforms the template name by transforming the declarations
540 /// and nested-name-specifiers that occur within the template name.
541 /// Subclasses may override this function to provide alternate behavior.
542 TemplateName
543 TransformTemplateName(CXXScopeSpec &SS, TemplateName Name,
544 SourceLocation NameLoc,
545 QualType ObjectType = QualType(),
546 NamedDecl *FirstQualifierInScope = nullptr,
547 bool AllowInjectedClassName = false);
548
549 /// Transform the given template argument.
550 ///
551 /// By default, this operation transforms the type, expression, or
552 /// declaration stored within the template argument and constructs a
553 /// new template argument from the transformed result. Subclasses may
554 /// override this function to provide alternate behavior.
555 ///
556 /// Returns true if there was an error.
557 bool TransformTemplateArgument(const TemplateArgumentLoc &Input,
558 TemplateArgumentLoc &Output,
559 bool Uneval = false);
560
561 /// Transform the given set of template arguments.
562 ///
563 /// By default, this operation transforms all of the template arguments
564 /// in the input set using \c TransformTemplateArgument(), and appends
565 /// the transformed arguments to the output list.
566 ///
567 /// Note that this overload of \c TransformTemplateArguments() is merely
568 /// a convenience function. Subclasses that wish to override this behavior
569 /// should override the iterator-based member template version.
570 ///
571 /// \param Inputs The set of template arguments to be transformed.
572 ///
573 /// \param NumInputs The number of template arguments in \p Inputs.
574 ///
575 /// \param Outputs The set of transformed template arguments output by this
576 /// routine.
577 ///
578 /// Returns true if an error occurred.
579 bool TransformTemplateArguments(const TemplateArgumentLoc *Inputs,
580 unsigned NumInputs,
581 TemplateArgumentListInfo &Outputs,
582 bool Uneval = false) {
583 return TransformTemplateArguments(Inputs, Inputs + NumInputs, Outputs,
584 Uneval);
585 }
586
587 /// Transform the given set of template arguments.
588 ///
589 /// By default, this operation transforms all of the template arguments
590 /// in the input set using \c TransformTemplateArgument(), and appends
591 /// the transformed arguments to the output list.
592 ///
593 /// \param First An iterator to the first template argument.
594 ///
595 /// \param Last An iterator one step past the last template argument.
596 ///
597 /// \param Outputs The set of transformed template arguments output by this
598 /// routine.
599 ///
600 /// Returns true if an error occurred.
601 template<typename InputIterator>
602 bool TransformTemplateArguments(InputIterator First,
603 InputIterator Last,
604 TemplateArgumentListInfo &Outputs,
605 bool Uneval = false);
606
607 /// Fakes up a TemplateArgumentLoc for a given TemplateArgument.
608 void InventTemplateArgumentLoc(const TemplateArgument &Arg,
609 TemplateArgumentLoc &ArgLoc);
610
611 /// Fakes up a TypeSourceInfo for a type.
612 TypeSourceInfo *InventTypeSourceInfo(QualType T) {
613 return SemaRef.Context.getTrivialTypeSourceInfo(T,
614 getDerived().getBaseLocation());
615 }
616
617 #define ABSTRACT_TYPELOC(CLASS, PARENT)
618 #define TYPELOC(CLASS, PARENT) \
619 QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
620 #include "clang/AST/TypeLocNodes.def"
621
622 template<typename Fn>
623 QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
624 FunctionProtoTypeLoc TL,
625 CXXRecordDecl *ThisContext,
626 Qualifiers ThisTypeQuals,
627 Fn TransformExceptionSpec);
628
629 bool TransformExceptionSpec(SourceLocation Loc,
630 FunctionProtoType::ExceptionSpecInfo &ESI,
631 SmallVectorImpl<QualType> &Exceptions,
632 bool &Changed);
633
634 StmtResult TransformSEHHandler(Stmt *Handler);
635
636 QualType
637 TransformTemplateSpecializationType(TypeLocBuilder &TLB,
638 TemplateSpecializationTypeLoc TL,
639 TemplateName Template);
640
641 QualType
642 TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
643 DependentTemplateSpecializationTypeLoc TL,
644 TemplateName Template,
645 CXXScopeSpec &SS);
646
647 QualType TransformDependentTemplateSpecializationType(
648 TypeLocBuilder &TLB, DependentTemplateSpecializationTypeLoc TL,
649 NestedNameSpecifierLoc QualifierLoc);
650
651 /// Transforms the parameters of a function type into the
652 /// given vectors.
653 ///
654 /// The result vectors should be kept in sync; null entries in the
655 /// variables vector are acceptable.
656 ///
657 /// Return true on error.
658 bool TransformFunctionTypeParams(
659 SourceLocation Loc, ArrayRef<ParmVarDecl *> Params,
660 const QualType *ParamTypes,
661 const FunctionProtoType::ExtParameterInfo *ParamInfos,
662 SmallVectorImpl<QualType> &PTypes, SmallVectorImpl<ParmVarDecl *> *PVars,
663 Sema::ExtParameterInfoBuilder &PInfos);
664
665 /// Transforms a single function-type parameter. Return null
666 /// on error.
667 ///
668 /// \param indexAdjustment - A number to add to the parameter's
669 /// scope index; can be negative
670 ParmVarDecl *TransformFunctionTypeParam(ParmVarDecl *OldParm,
671 int indexAdjustment,
672 Optional<unsigned> NumExpansions,
673 bool ExpectParameterPack);
674
675 /// Transform the body of a lambda-expression.
676 StmtResult TransformLambdaBody(LambdaExpr *E, Stmt *Body);
677 /// Alternative implementation of TransformLambdaBody that skips transforming
678 /// the body.
679 StmtResult SkipLambdaBody(LambdaExpr *E, Stmt *Body);
680
681 QualType TransformReferenceType(TypeLocBuilder &TLB, ReferenceTypeLoc TL);
682
683 StmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr);
684 ExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E);
685
686 TemplateParameterList *TransformTemplateParameterList(
687 TemplateParameterList *TPL) {
688 return TPL;
689 }
690
691 ExprResult TransformAddressOfOperand(Expr *E);
692
693 ExprResult TransformDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E,
694 bool IsAddressOfOperand,
695 TypeSourceInfo **RecoveryTSI);
696
697 ExprResult TransformParenDependentScopeDeclRefExpr(
698 ParenExpr *PE, DependentScopeDeclRefExpr *DRE, bool IsAddressOfOperand,
699 TypeSourceInfo **RecoveryTSI);
700
701 StmtResult TransformOMPExecutableDirective(OMPExecutableDirective *S);
702
703 // FIXME: We use LLVM_ATTRIBUTE_NOINLINE because inlining causes a ridiculous
704 // amount of stack usage with clang.
705 #define STMT(Node, Parent) \
706 LLVM_ATTRIBUTE_NOINLINE \
707 StmtResult Transform##Node(Node *S);
708 #define VALUESTMT(Node, Parent) \
709 LLVM_ATTRIBUTE_NOINLINE \
710 StmtResult Transform##Node(Node *S, StmtDiscardKind SDK);
711 #define EXPR(Node, Parent) \
712 LLVM_ATTRIBUTE_NOINLINE \
713 ExprResult Transform##Node(Node *E);
714 #define ABSTRACT_STMT(Stmt)
715 #include "clang/AST/StmtNodes.inc"
716
717 #define OPENMP_CLAUSE(Name, Class) \
718 LLVM_ATTRIBUTE_NOINLINE \
719 OMPClause *Transform ## Class(Class *S);
720 #include "clang/Basic/OpenMPKinds.def"
721
722 /// Build a new qualified type given its unqualified type and type location.
723 ///
724 /// By default, this routine adds type qualifiers only to types that can
725 /// have qualifiers, and silently suppresses those qualifiers that are not
726 /// permitted. Subclasses may override this routine to provide different
727 /// behavior.
728 QualType RebuildQualifiedType(QualType T, QualifiedTypeLoc TL);
729
730 /// Build a new pointer type given its pointee type.
731 ///
732 /// By default, performs semantic analysis when building the pointer type.
733 /// Subclasses may override this routine to provide different behavior.
734 QualType RebuildPointerType(QualType PointeeType, SourceLocation Sigil);
735
736 /// Build a new block pointer type given its pointee type.
737 ///
738 /// By default, performs semantic analysis when building the block pointer
739 /// type. Subclasses may override this routine to provide different behavior.
740 QualType RebuildBlockPointerType(QualType PointeeType, SourceLocation Sigil);
741
742 /// Build a new reference type given the type it references.
743 ///
744 /// By default, performs semantic analysis when building the
745 /// reference type. Subclasses may override this routine to provide
746 /// different behavior.
747 ///
748 /// \param LValue whether the type was written with an lvalue sigil
749 /// or an rvalue sigil.
750 QualType RebuildReferenceType(QualType ReferentType,
751 bool LValue,
752 SourceLocation Sigil);
753
754 /// Build a new member pointer type given the pointee type and the
755 /// class type it refers into.
756 ///
757 /// By default, performs semantic analysis when building the member pointer
758 /// type. Subclasses may override this routine to provide different behavior.
759 QualType RebuildMemberPointerType(QualType PointeeType, QualType ClassType,
760 SourceLocation Sigil);
761
762 QualType RebuildObjCTypeParamType(const ObjCTypeParamDecl *Decl,
763 SourceLocation ProtocolLAngleLoc,
764 ArrayRef<ObjCProtocolDecl *> Protocols,
765 ArrayRef<SourceLocation> ProtocolLocs,
766 SourceLocation ProtocolRAngleLoc);
767
768 /// Build an Objective-C object type.
769 ///
770 /// By default, performs semantic analysis when building the object type.
771 /// Subclasses may override this routine to provide different behavior.
772 QualType RebuildObjCObjectType(QualType BaseType,
773 SourceLocation Loc,
774 SourceLocation TypeArgsLAngleLoc,
775 ArrayRef<TypeSourceInfo *> TypeArgs,
776 SourceLocation TypeArgsRAngleLoc,
777 SourceLocation ProtocolLAngleLoc,
778 ArrayRef<ObjCProtocolDecl *> Protocols,
779 ArrayRef<SourceLocation> ProtocolLocs,
780 SourceLocation ProtocolRAngleLoc);
781
782 /// Build a new Objective-C object pointer type given the pointee type.
783 ///
784 /// By default, directly builds the pointer type, with no additional semantic
785 /// analysis.
786 QualType RebuildObjCObjectPointerType(QualType PointeeType,
787 SourceLocation Star);
788
789 /// Build a new array type given the element type, size
790 /// modifier, size of the array (if known), size expression, and index type
791 /// qualifiers.
792 ///
793 /// By default, performs semantic analysis when building the array type.
794 /// Subclasses may override this routine to provide different behavior.
795 /// Also by default, all of the other Rebuild*Array
796 QualType RebuildArrayType(QualType ElementType,
797 ArrayType::ArraySizeModifier SizeMod,
798 const llvm::APInt *Size,
799 Expr *SizeExpr,
800 unsigned IndexTypeQuals,
801 SourceRange BracketsRange);
802
803 /// Build a new constant array type given the element type, size
804 /// modifier, (known) size of the array, and index type qualifiers.
805 ///
806 /// By default, performs semantic analysis when building the array type.
807 /// Subclasses may override this routine to provide different behavior.
808 QualType RebuildConstantArrayType(QualType ElementType,
809 ArrayType::ArraySizeModifier SizeMod,
810 const llvm::APInt &Size,
811 Expr *SizeExpr,
812 unsigned IndexTypeQuals,
813 SourceRange BracketsRange);
814
815 /// Build a new incomplete array type given the element type, size
816 /// modifier, and index type qualifiers.
817 ///
818 /// By default, performs semantic analysis when building the array type.
819 /// Subclasses may override this routine to provide different behavior.
820 QualType RebuildIncompleteArrayType(QualType ElementType,
821 ArrayType::ArraySizeModifier SizeMod,
822 unsigned IndexTypeQuals,
823 SourceRange BracketsRange);
824
825 /// Build a new variable-length array type given the element type,
826 /// size modifier, size expression, and index type qualifiers.
827 ///
828 /// By default, performs semantic analysis when building the array type.
829 /// Subclasses may override this routine to provide different behavior.
830 QualType RebuildVariableArrayType(QualType ElementType,
831 ArrayType::ArraySizeModifier SizeMod,
832 Expr *SizeExpr,
833 unsigned IndexTypeQuals,
834 SourceRange BracketsRange);
835
836 /// Build a new dependent-sized array type given the element type,
837 /// size modifier, size expression, and index type qualifiers.
838 ///
839 /// By default, performs semantic analysis when building the array type.
840 /// Subclasses may override this routine to provide different behavior.
841 QualType RebuildDependentSizedArrayType(QualType ElementType,
842 ArrayType::ArraySizeModifier SizeMod,
843 Expr *SizeExpr,
844 unsigned IndexTypeQuals,
845 SourceRange BracketsRange);
846
847 /// Build a new vector type given the element type and
848 /// number of elements.
849 ///
850 /// By default, performs semantic analysis when building the vector type.
851 /// Subclasses may override this routine to provide different behavior.
852 QualType RebuildVectorType(QualType ElementType, unsigned NumElements,
853 VectorType::VectorKind VecKind);
854
855 /// Build a new potentially dependently-sized extended vector type
856 /// given the element type and number of elements.
857 ///
858 /// By default, performs semantic analysis when building the vector type.
859 /// Subclasses may override this routine to provide different behavior.
860 QualType RebuildDependentVectorType(QualType ElementType, Expr *SizeExpr,
861 SourceLocation AttributeLoc,
862 VectorType::VectorKind);
863
864 /// Build a new extended vector type given the element type and
865 /// number of elements.
866 ///
867 /// By default, performs semantic analysis when building the vector type.
868 /// Subclasses may override this routine to provide different behavior.
869 QualType RebuildExtVectorType(QualType ElementType, unsigned NumElements,
870 SourceLocation AttributeLoc);
871
872 /// Build a new potentially dependently-sized extended vector type
873 /// given the element type and number of elements.
874 ///
875 /// By default, performs semantic analysis when building the vector type.
876 /// Subclasses may override this routine to provide different behavior.
877 QualType RebuildDependentSizedExtVectorType(QualType ElementType,
878 Expr *SizeExpr,
879 SourceLocation AttributeLoc);
880
881 /// Build a new DependentAddressSpaceType or return the pointee
882 /// type variable with the correct address space (retrieved from
883 /// AddrSpaceExpr) applied to it. The former will be returned in cases
884 /// where the address space remains dependent.
885 ///
886 /// By default, performs semantic analysis when building the type with address
887 /// space applied. Subclasses may override this routine to provide different
888 /// behavior.
889 QualType RebuildDependentAddressSpaceType(QualType PointeeType,
890 Expr *AddrSpaceExpr,
891 SourceLocation AttributeLoc);
892
893 /// Build a new function type.
894 ///
895 /// By default, performs semantic analysis when building the function type.
896 /// Subclasses may override this routine to provide different behavior.
897 QualType RebuildFunctionProtoType(QualType T,
898 MutableArrayRef<QualType> ParamTypes,
899 const FunctionProtoType::ExtProtoInfo &EPI);
900
901 /// Build a new unprototyped function type.
902 QualType RebuildFunctionNoProtoType(QualType ResultType);
903
904 /// Rebuild an unresolved typename type, given the decl that
905 /// the UnresolvedUsingTypenameDecl was transformed to.
906 QualType RebuildUnresolvedUsingType(SourceLocation NameLoc, Decl *D);
907
908 /// Build a new typedef type.
909 QualType RebuildTypedefType(TypedefNameDecl *Typedef) {
910 return SemaRef.Context.getTypeDeclType(Typedef);
911 }
912
913 /// Build a new MacroDefined type.
914 QualType RebuildMacroQualifiedType(QualType T,
915 const IdentifierInfo *MacroII) {
916 return SemaRef.Context.getMacroQualifiedType(T, MacroII);
917 }
918
919 /// Build a new class/struct/union type.
920 QualType RebuildRecordType(RecordDecl *Record) {
921 return SemaRef.Context.getTypeDeclType(Record);
922 }
923
924 /// Build a new Enum type.
925 QualType RebuildEnumType(EnumDecl *Enum) {
926 return SemaRef.Context.getTypeDeclType(Enum);
927 }
928
929 /// Build a new typeof(expr) type.
930 ///
931 /// By default, performs semantic analysis when building the typeof type.
932 /// Subclasses may override this routine to provide different behavior.
933 QualType RebuildTypeOfExprType(Expr *Underlying, SourceLocation Loc);
934
935 /// Build a new typeof(type) type.
936 ///
937 /// By default, builds a new TypeOfType with the given underlying type.
938 QualType RebuildTypeOfType(QualType Underlying);
939
940 /// Build a new unary transform type.
941 QualType RebuildUnaryTransformType(QualType BaseType,
942 UnaryTransformType::UTTKind UKind,
943 SourceLocation Loc);
944
945 /// Build a new C++11 decltype type.
946 ///
947 /// By default, performs semantic analysis when building the decltype type.
948 /// Subclasses may override this routine to provide different behavior.
949 QualType RebuildDecltypeType(Expr *Underlying, SourceLocation Loc);
950
951 /// Build a new C++11 auto type.
952 ///
953 /// By default, builds a new AutoType with the given deduced type.
954 QualType RebuildAutoType(QualType Deduced, AutoTypeKeyword Keyword,
955 ConceptDecl *TypeConstraintConcept,
956 ArrayRef<TemplateArgument> TypeConstraintArgs) {
957 // Note, IsDependent is always false here: we implicitly convert an 'auto'
958 // which has been deduced to a dependent type into an undeduced 'auto', so
959 // that we'll retry deduction after the transformation.
960 return SemaRef.Context.getAutoType(Deduced, Keyword,
961 /*IsDependent*/ false, /*IsPack=*/false,
962 TypeConstraintConcept,
963 TypeConstraintArgs);
964 }
965
966 /// By default, builds a new DeducedTemplateSpecializationType with the given
967 /// deduced type.
968 QualType RebuildDeducedTemplateSpecializationType(TemplateName Template,
969 QualType Deduced) {
970 return SemaRef.Context.getDeducedTemplateSpecializationType(
971 Template, Deduced, /*IsDependent*/ false);
972 }
973
974 /// Build a new template specialization type.
975 ///
976 /// By default, performs semantic analysis when building the template
977 /// specialization type. Subclasses may override this routine to provide
978 /// different behavior.
979 QualType RebuildTemplateSpecializationType(TemplateName Template,
980 SourceLocation TemplateLoc,
981 TemplateArgumentListInfo &Args);
982
983 /// Build a new parenthesized type.
984 ///
985 /// By default, builds a new ParenType type from the inner type.
986 /// Subclasses may override this routine to provide different behavior.
987 QualType RebuildParenType(QualType InnerType) {
988 return SemaRef.BuildParenType(InnerType);
989 }
990
991 /// Build a new qualified name type.
992 ///
993 /// By default, builds a new ElaboratedType type from the keyword,
994 /// the nested-name-specifier and the named type.
995 /// Subclasses may override this routine to provide different behavior.
996 QualType RebuildElaboratedType(SourceLocation KeywordLoc,
997 ElaboratedTypeKeyword Keyword,
998 NestedNameSpecifierLoc QualifierLoc,
999 QualType Named) {
1000 return SemaRef.Context.getElaboratedType(Keyword,
1001 QualifierLoc.getNestedNameSpecifier(),
1002 Named);
1003 }
1004
1005 /// Build a new typename type that refers to a template-id.
1006 ///
1007 /// By default, builds a new DependentNameType type from the
1008 /// nested-name-specifier and the given type. Subclasses may override
1009 /// this routine to provide different behavior.
1010 QualType RebuildDependentTemplateSpecializationType(
1011 ElaboratedTypeKeyword Keyword,
1012 NestedNameSpecifierLoc QualifierLoc,
1013 SourceLocation TemplateKWLoc,
1014 const IdentifierInfo *Name,
1015 SourceLocation NameLoc,
1016 TemplateArgumentListInfo &Args,
1017 bool AllowInjectedClassName) {
1018 // Rebuild the template name.
1019 // TODO: avoid TemplateName abstraction
1020 CXXScopeSpec SS;
1021 SS.Adopt(QualifierLoc);
1022 TemplateName InstName = getDerived().RebuildTemplateName(
1023 SS, TemplateKWLoc, *Name, NameLoc, QualType(), nullptr,
1024 AllowInjectedClassName);
1025
1026 if (InstName.isNull())
1027 return QualType();
1028
1029 // If it's still dependent, make a dependent specialization.
1030 if (InstName.getAsDependentTemplateName())
1031 return SemaRef.Context.getDependentTemplateSpecializationType(Keyword,
1032 QualifierLoc.getNestedNameSpecifier(),
1033 Name,
1034 Args);
1035
1036 // Otherwise, make an elaborated type wrapping a non-dependent
1037 // specialization.
1038 QualType T =
1039 getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
1040 if (T.isNull()) return QualType();
1041
1042 if (Keyword == ETK_None && QualifierLoc.getNestedNameSpecifier() == nullptr)
1043 return T;
1044
1045 return SemaRef.Context.getElaboratedType(Keyword,
1046 QualifierLoc.getNestedNameSpecifier(),
1047 T);
1048 }
1049
1050 /// Build a new typename type that refers to an identifier.
1051 ///
1052 /// By default, performs semantic analysis when building the typename type
1053 /// (or elaborated type). Subclasses may override this routine to provide
1054 /// different behavior.
1055 QualType RebuildDependentNameType(ElaboratedTypeKeyword Keyword,
1056 SourceLocation KeywordLoc,
1057 NestedNameSpecifierLoc QualifierLoc,
1058 const IdentifierInfo *Id,
1059 SourceLocation IdLoc,
1060 bool DeducedTSTContext) {
1061 CXXScopeSpec SS;
1062 SS.Adopt(QualifierLoc);
1063
1064 if (QualifierLoc.getNestedNameSpecifier()->isDependent()) {
1065 // If the name is still dependent, just build a new dependent name type.
1066 if (!SemaRef.computeDeclContext(SS))
1067 return SemaRef.Context.getDependentNameType(Keyword,
1068 QualifierLoc.getNestedNameSpecifier(),
1069 Id);
1070 }
1071
1072 if (Keyword == ETK_None || Keyword == ETK_Typename) {
1073 return SemaRef.CheckTypenameType(Keyword, KeywordLoc, QualifierLoc,
1074 *Id, IdLoc, DeducedTSTContext);
1075 }
1076
1077 TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForKeyword(Keyword);
1078
1079 // We had a dependent elaborated-type-specifier that has been transformed
1080 // into a non-dependent elaborated-type-specifier. Find the tag we're
1081 // referring to.
1082 LookupResult Result(SemaRef, Id, IdLoc, Sema::LookupTagName);
1083 DeclContext *DC = SemaRef.computeDeclContext(SS, false);
1084 if (!DC)
1085 return QualType();
1086
1087 if (SemaRef.RequireCompleteDeclContext(SS, DC))
1088 return QualType();
1089
1090 TagDecl *Tag = nullptr;
1091 SemaRef.LookupQualifiedName(Result, DC);
1092 switch (Result.getResultKind()) {
1093 case LookupResult::NotFound:
1094 case LookupResult::NotFoundInCurrentInstantiation:
1095 break;
1096
1097 case LookupResult::Found:
1098 Tag = Result.getAsSingle<TagDecl>();
1099 break;
1100
1101 case LookupResult::FoundOverloaded:
1102 case LookupResult::FoundUnresolvedValue:
1103 llvm_unreachable("Tag lookup cannot find non-tags");
1104
1105 case LookupResult::Ambiguous:
1106 // Let the LookupResult structure handle ambiguities.
1107 return QualType();
1108 }
1109
1110 if (!Tag) {
1111 // Check where the name exists but isn't a tag type and use that to emit
1112 // better diagnostics.
1113 LookupResult Result(SemaRef, Id, IdLoc, Sema::LookupTagName);
1114 SemaRef.LookupQualifiedName(Result, DC);
1115 switch (Result.getResultKind()) {
1116 case LookupResult::Found:
1117 case LookupResult::FoundOverloaded:
1118 case LookupResult::FoundUnresolvedValue: {
1119 NamedDecl *SomeDecl = Result.getRepresentativeDecl();
1120 Sema::NonTagKind NTK = SemaRef.getNonTagTypeDeclKind(SomeDecl, Kind);
1121 SemaRef.Diag(IdLoc, diag::err_tag_reference_non_tag) << SomeDecl
1122 << NTK << Kind;
1123 SemaRef.Diag(SomeDecl->getLocation(), diag::note_declared_at);
1124 break;
1125 }
1126 default:
1127 SemaRef.Diag(IdLoc, diag::err_not_tag_in_scope)
1128 << Kind << Id << DC << QualifierLoc.getSourceRange();
1129 break;
1130 }
1131 return QualType();
1132 }
1133
1134 if (!SemaRef.isAcceptableTagRedeclaration(Tag, Kind, /*isDefinition*/false,
1135 IdLoc, Id)) {
1136 SemaRef.Diag(KeywordLoc, diag::err_use_with_wrong_tag) << Id;
1137 SemaRef.Diag(Tag->getLocation(), diag::note_previous_use);
1138 return QualType();
1139 }
1140
1141 // Build the elaborated-type-specifier type.
1142 QualType T = SemaRef.Context.getTypeDeclType(Tag);
1143 return SemaRef.Context.getElaboratedType(Keyword,
1144 QualifierLoc.getNestedNameSpecifier(),
1145 T);
1146 }
1147
1148 /// Build a new pack expansion type.
1149 ///
1150 /// By default, builds a new PackExpansionType type from the given pattern.
1151 /// Subclasses may override this routine to provide different behavior.
1152 QualType RebuildPackExpansionType(QualType Pattern,
1153 SourceRange PatternRange,
1154 SourceLocation EllipsisLoc,
1155 Optional<unsigned> NumExpansions) {
1156 return getSema().CheckPackExpansion(Pattern, PatternRange, EllipsisLoc,
1157 NumExpansions);
1158 }
1159
1160 /// Build a new atomic type given its value type.
1161 ///
1162 /// By default, performs semantic analysis when building the atomic type.
1163 /// Subclasses may override this routine to provide different behavior.
1164 QualType RebuildAtomicType(QualType ValueType, SourceLocation KWLoc);
1165
1166 /// Build a new pipe type given its value type.
1167 QualType RebuildPipeType(QualType ValueType, SourceLocation KWLoc,
1168 bool isReadPipe);
1169
1170 /// Build a new template name given a nested name specifier, a flag
1171 /// indicating whether the "template" keyword was provided, and the template
1172 /// that the template name refers to.
1173 ///
1174 /// By default, builds the new template name directly. Subclasses may override
1175 /// this routine to provide different behavior.
1176 TemplateName RebuildTemplateName(CXXScopeSpec &SS,
1177 bool TemplateKW,
1178 TemplateDecl *Template);
1179
1180 /// Build a new template name given a nested name specifier and the
1181 /// name that is referred to as a template.
1182 ///
1183 /// By default, performs semantic analysis to determine whether the name can
1184 /// be resolved to a specific template, then builds the appropriate kind of
1185 /// template name. Subclasses may override this routine to provide different
1186 /// behavior.
1187 TemplateName RebuildTemplateName(CXXScopeSpec &SS,
1188 SourceLocation TemplateKWLoc,
1189 const IdentifierInfo &Name,
1190 SourceLocation NameLoc, QualType ObjectType,
1191 NamedDecl *FirstQualifierInScope,
1192 bool AllowInjectedClassName);
1193
1194 /// Build a new template name given a nested name specifier and the
1195 /// overloaded operator name that is referred to as a template.
1196 ///
1197 /// By default, performs semantic analysis to determine whether the name can
1198 /// be resolved to a specific template, then builds the appropriate kind of
1199 /// template name. Subclasses may override this routine to provide different
1200 /// behavior.
1201 TemplateName RebuildTemplateName(CXXScopeSpec &SS,
1202 SourceLocation TemplateKWLoc,
1203 OverloadedOperatorKind Operator,
1204 SourceLocation NameLoc, QualType ObjectType,
1205 bool AllowInjectedClassName);
1206
1207 /// Build a new template name given a template template parameter pack
1208 /// and the
1209 ///
1210 /// By default, performs semantic analysis to determine whether the name can
1211 /// be resolved to a specific template, then builds the appropriate kind of
1212 /// template name. Subclasses may override this routine to provide different
1213 /// behavior.
1214 TemplateName RebuildTemplateName(TemplateTemplateParmDecl *Param,
1215 const TemplateArgument &ArgPack) {
1216 return getSema().Context.getSubstTemplateTemplateParmPack(Param, ArgPack);
1217 }
1218
1219 /// Build a new compound statement.
1220 ///
1221 /// By default, performs semantic analysis to build the new statement.
1222 /// Subclasses may override this routine to provide different behavior.
1223 StmtResult RebuildCompoundStmt(SourceLocation LBraceLoc,
1224 MultiStmtArg Statements,
1225 SourceLocation RBraceLoc,
1226 bool IsStmtExpr) {
1227 return getSema().ActOnCompoundStmt(LBraceLoc, RBraceLoc, Statements,
1228 IsStmtExpr);
1229 }
1230
1231 /// Build a new case statement.
1232 ///
1233 /// By default, performs semantic analysis to build the new statement.
1234 /// Subclasses may override this routine to provide different behavior.
1235 StmtResult RebuildCaseStmt(SourceLocation CaseLoc,
1236 Expr *LHS,
1237 SourceLocation EllipsisLoc,
1238 Expr *RHS,
1239 SourceLocation ColonLoc) {
1240 return getSema().ActOnCaseStmt(CaseLoc, LHS, EllipsisLoc, RHS,
1241 ColonLoc);
1242 }
1243
1244 /// Attach the body to a new case statement.
1245 ///
1246 /// By default, performs semantic analysis to build the new statement.
1247 /// Subclasses may override this routine to provide different behavior.
1248 StmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body) {
1249 getSema().ActOnCaseStmtBody(S, Body);
1250 return S;
1251 }
1252
1253 /// Build a new default statement.
1254 ///
1255 /// By default, performs semantic analysis to build the new statement.
1256 /// Subclasses may override this routine to provide different behavior.
1257 StmtResult RebuildDefaultStmt(SourceLocation DefaultLoc,
1258 SourceLocation ColonLoc,
1259 Stmt *SubStmt) {
1260 return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt,
1261 /*CurScope=*/nullptr);
1262 }
1263
1264 /// Build a new label statement.
1265 ///
1266 /// By default, performs semantic analysis to build the new statement.
1267 /// Subclasses may override this routine to provide different behavior.
1268 StmtResult RebuildLabelStmt(SourceLocation IdentLoc, LabelDecl *L,
1269 SourceLocation ColonLoc, Stmt *SubStmt) {
1270 return SemaRef.ActOnLabelStmt(IdentLoc, L, ColonLoc, SubStmt);
1271 }
1272
1273 /// Build a new label statement.
1274 ///
1275 /// By default, performs semantic analysis to build the new statement.
1276 /// Subclasses may override this routine to provide different behavior.
1277 StmtResult RebuildAttributedStmt(SourceLocation AttrLoc,
1278 ArrayRef<const Attr*> Attrs,
1279 Stmt *SubStmt) {
1280 return SemaRef.ActOnAttributedStmt(AttrLoc, Attrs, SubStmt);
1281 }
1282
1283 /// Build a new "if" statement.
1284 ///
1285 /// By default, performs semantic analysis to build the new statement.
1286 /// Subclasses may override this routine to provide different behavior.
1287 StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
1288 Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
1289 SourceLocation ElseLoc, Stmt *Else) {
1290 return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
1291 ElseLoc, Else);
1292 }
1293
1294 /// Start building a new switch statement.
1295 ///
1296 /// By default, performs semantic analysis to build the new statement.
1297 /// Subclasses may override this routine to provide different behavior.
1298 StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init,
1299 Sema::ConditionResult Cond) {
1300 return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond);
1301 }
1302
1303 /// Attach the body to the switch statement.
1304 ///
1305 /// By default, performs semantic analysis to build the new statement.
1306 /// Subclasses may override this routine to provide different behavior.
1307 StmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc,
1308 Stmt *Switch, Stmt *Body) {
1309 return getSema().ActOnFinishSwitchStmt(SwitchLoc, Switch, Body);
1310 }
1311
1312 /// Build a new while statement.
1313 ///
1314 /// By default, performs semantic analysis to build the new statement.
1315 /// Subclasses may override this routine to provide different behavior.
1316 StmtResult RebuildWhileStmt(SourceLocation WhileLoc,
1317 Sema::ConditionResult Cond, Stmt *Body) {
1318 return getSema().ActOnWhileStmt(WhileLoc, Cond, Body);
1319 }
1320
1321 /// Build a new do-while statement.
1322 ///
1323 /// By default, performs semantic analysis to build the new statement.
1324 /// Subclasses may override this routine to provide different behavior.
1325 StmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body,
1326 SourceLocation WhileLoc, SourceLocation LParenLoc,
1327 Expr *Cond, SourceLocation RParenLoc) {
1328 return getSema().ActOnDoStmt(DoLoc, Body, WhileLoc, LParenLoc,
1329 Cond, RParenLoc);
1330 }
1331
1332 /// Build a new for statement.
1333 ///
1334 /// By default, performs semantic analysis to build the new statement.
1335 /// Subclasses may override this routine to provide different behavior.
1336 StmtResult RebuildForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
1337 Stmt *Init, Sema::ConditionResult Cond,
1338 Sema::FullExprArg Inc, SourceLocation RParenLoc,
1339 Stmt *Body) {
1340 return getSema().ActOnForStmt(ForLoc, LParenLoc, Init, Cond,
1341 Inc, RParenLoc, Body);
1342 }
1343
1344 /// Build a new goto statement.
1345 ///
1346 /// By default, performs semantic analysis to build the new statement.
1347 /// Subclasses may override this routine to provide different behavior.
1348 StmtResult RebuildGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
1349 LabelDecl *Label) {
1350 return getSema().ActOnGotoStmt(GotoLoc, LabelLoc, Label);
1351 }
1352
1353 /// Build a new indirect goto statement.
1354 ///
1355 /// By default, performs semantic analysis to build the new statement.
1356 /// Subclasses may override this routine to provide different behavior.
1357 StmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc,
1358 SourceLocation StarLoc,
1359 Expr *Target) {
1360 return getSema().ActOnIndirectGotoStmt(GotoLoc, StarLoc, Target);
1361 }
1362
1363 /// Build a new return statement.
1364 ///
1365 /// By default, performs semantic analysis to build the new statement.
1366 /// Subclasses may override this routine to provide different behavior.
1367 StmtResult RebuildReturnStmt(SourceLocation ReturnLoc, Expr *Result) {
1368 return getSema().BuildReturnStmt(ReturnLoc, Result);
1369 }
1370
1371 /// Build a new declaration statement.
1372 ///
1373 /// By default, performs semantic analysis to build the new statement.
1374 /// Subclasses may override this routine to provide different behavior.
1375 StmtResult RebuildDeclStmt(MutableArrayRef<Decl *> Decls,
1376 SourceLocation StartLoc, SourceLocation EndLoc) {
1377 Sema::DeclGroupPtrTy DG = getSema().BuildDeclaratorGroup(Decls);
1378 return getSema().ActOnDeclStmt(DG, StartLoc, EndLoc);
1379 }
1380
1381 /// Build a new inline asm statement.
1382 ///
1383 /// By default, performs semantic analysis to build the new statement.
1384 /// Subclasses may override this routine to provide different behavior.
1385 StmtResult RebuildGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
1386 bool IsVolatile, unsigned NumOutputs,
1387 unsigned NumInputs, IdentifierInfo **Names,
1388 MultiExprArg Constraints, MultiExprArg Exprs,
1389 Expr *AsmString, MultiExprArg Clobbers,
1390 unsigned NumLabels,
1391 SourceLocation RParenLoc) {
1392 return getSema().ActOnGCCAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs,
1393 NumInputs, Names, Constraints, Exprs,
1394 AsmString, Clobbers, NumLabels, RParenLoc);
1395 }
1396
1397 /// Build a new MS style inline asm statement.
1398 ///
1399 /// By default, performs semantic analysis to build the new statement.
1400 /// Subclasses may override this routine to provide different behavior.
1401 StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
1402 ArrayRef<Token> AsmToks,
1403 StringRef AsmString,
1404 unsigned NumOutputs, unsigned NumInputs,
1405 ArrayRef<StringRef> Constraints,
1406 ArrayRef<StringRef> Clobbers,
1407 ArrayRef<Expr*> Exprs,
1408 SourceLocation EndLoc) {
1409 return getSema().ActOnMSAsmStmt(AsmLoc, LBraceLoc, AsmToks, AsmString,
1410 NumOutputs, NumInputs,
1411 Constraints, Clobbers, Exprs, EndLoc);
1412 }
1413
1414 /// Build a new co_return statement.
1415 ///
1416 /// By default, performs semantic analysis to build the new statement.
1417 /// Subclasses may override this routine to provide different behavior.
1418 StmtResult RebuildCoreturnStmt(SourceLocation CoreturnLoc, Expr *Result,
1419 bool IsImplicit) {
1420 return getSema().BuildCoreturnStmt(CoreturnLoc, Result, IsImplicit);
1421 }
1422
1423 /// Build a new co_await expression.
1424 ///
1425 /// By default, performs semantic analysis to build the new expression.
1426 /// Subclasses may override this routine to provide different behavior.
1427 ExprResult RebuildCoawaitExpr(SourceLocation CoawaitLoc, Expr *Result,
1428 bool IsImplicit) {
1429 return getSema().BuildResolvedCoawaitExpr(CoawaitLoc, Result, IsImplicit);
1430 }
1431
1432 /// Build a new co_await expression.
1433 ///
1434 /// By default, performs semantic analysis to build the new expression.
1435 /// Subclasses may override this routine to provide different behavior.
1436 ExprResult RebuildDependentCoawaitExpr(SourceLocation CoawaitLoc,
1437 Expr *Result,
1438 UnresolvedLookupExpr *Lookup) {
1439 return getSema().BuildUnresolvedCoawaitExpr(CoawaitLoc, Result, Lookup);
1440 }
1441
1442 /// Build a new co_yield expression.
1443 ///
1444 /// By default, performs semantic analysis to build the new expression.
1445 /// Subclasses may override this routine to provide different behavior.
1446 ExprResult RebuildCoyieldExpr(SourceLocation CoyieldLoc, Expr *Result) {
1447 return getSema().BuildCoyieldExpr(CoyieldLoc, Result);
1448 }
1449
1450 StmtResult RebuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs Args) {
1451 return getSema().BuildCoroutineBodyStmt(Args);
1452 }
1453
1454 /// Build a new Objective-C \@try statement.
1455 ///
1456 /// By default, performs semantic analysis to build the new statement.
1457 /// Subclasses may override this routine to provide different behavior.
1458 StmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc,
1459 Stmt *TryBody,
1460 MultiStmtArg CatchStmts,
1461 Stmt *Finally) {
1462 return getSema().ActOnObjCAtTryStmt(AtLoc, TryBody, CatchStmts,
1463 Finally);
1464 }
1465
1466 /// Rebuild an Objective-C exception declaration.
1467 ///
1468 /// By default, performs semantic analysis to build the new declaration.
1469 /// Subclasses may override this routine to provide different behavior.
1470 VarDecl *RebuildObjCExceptionDecl(VarDecl *ExceptionDecl,
1471 TypeSourceInfo *TInfo, QualType T) {
1472 return getSema().BuildObjCExceptionDecl(TInfo, T,
1473 ExceptionDecl->getInnerLocStart(),
1474 ExceptionDecl->getLocation(),
1475 ExceptionDecl->getIdentifier());
1476 }
1477
1478 /// Build a new Objective-C \@catch statement.
1479 ///
1480 /// By default, performs semantic analysis to build the new statement.
1481 /// Subclasses may override this routine to provide different behavior.
1482 StmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc,
1483 SourceLocation RParenLoc,
1484 VarDecl *Var,
1485 Stmt *Body) {
1486 return getSema().ActOnObjCAtCatchStmt(AtLoc, RParenLoc,
1487 Var, Body);
1488 }
1489
1490 /// Build a new Objective-C \@finally statement.
1491 ///
1492 /// By default, performs semantic analysis to build the new statement.
1493 /// Subclasses may override this routine to provide different behavior.
1494 StmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc,
1495 Stmt *Body) {
1496 return getSema().ActOnObjCAtFinallyStmt(AtLoc, Body);
1497 }
1498
1499 /// Build a new Objective-C \@throw statement.
1500 ///
1501 /// By default, performs semantic analysis to build the new statement.
1502 /// Subclasses may override this routine to provide different behavior.
1503 StmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc,
1504 Expr *Operand) {
1505 return getSema().BuildObjCAtThrowStmt(AtLoc, Operand);
1506 }
1507
1508 /// Build a new OpenMP executable directive.
1509 ///
1510 /// By default, performs semantic analysis to build the new statement.
1511 /// Subclasses may override this routine to provide different behavior.
1512 StmtResult RebuildOMPExecutableDirective(OpenMPDirectiveKind Kind,
1513 DeclarationNameInfo DirName,
1514 OpenMPDirectiveKind CancelRegion,
1515 ArrayRef<OMPClause *> Clauses,
1516 Stmt *AStmt, SourceLocation StartLoc,
1517 SourceLocation EndLoc) {
1518 return getSema().ActOnOpenMPExecutableDirective(
1519 Kind, DirName, CancelRegion, Clauses, AStmt, StartLoc, EndLoc);
1520 }
1521
1522 /// Build a new OpenMP 'if' clause.
1523 ///
1524 /// By default, performs semantic analysis to build the new OpenMP clause.
1525 /// Subclasses may override this routine to provide different behavior.
1526 OMPClause *RebuildOMPIfClause(OpenMPDirectiveKind NameModifier,
1527 Expr *Condition, SourceLocation StartLoc,
1528 SourceLocation LParenLoc,
1529 SourceLocation NameModifierLoc,
1530 SourceLocation ColonLoc,
1531 SourceLocation EndLoc) {
1532 return getSema().ActOnOpenMPIfClause(NameModifier, Condition, StartLoc,
1533 LParenLoc, NameModifierLoc, ColonLoc,
1534 EndLoc);
1535 }
1536
1537 /// Build a new OpenMP 'final' clause.
1538 ///
1539 /// By default, performs semantic analysis to build the new OpenMP clause.
1540 /// Subclasses may override this routine to provide different behavior.
1541 OMPClause *RebuildOMPFinalClause(Expr *Condition, SourceLocation StartLoc,
1542 SourceLocation LParenLoc,
1543 SourceLocation EndLoc) {
1544 return getSema().ActOnOpenMPFinalClause(Condition, StartLoc, LParenLoc,
1545 EndLoc);
1546 }
1547
1548 /// Build a new OpenMP 'num_threads' clause.
1549 ///
1550 /// By default, performs semantic analysis to build the new OpenMP clause.
1551 /// Subclasses may override this routine to provide different behavior.
1552 OMPClause *RebuildOMPNumThreadsClause(Expr *NumThreads,
1553 SourceLocation StartLoc,
1554 SourceLocation LParenLoc,
1555 SourceLocation EndLoc) {
1556 return getSema().ActOnOpenMPNumThreadsClause(NumThreads, StartLoc,
1557 LParenLoc, EndLoc);
1558 }
1559
1560 /// Build a new OpenMP 'safelen' clause.
1561 ///
1562 /// By default, performs semantic analysis to build the new OpenMP clause.
1563 /// Subclasses may override this routine to provide different behavior.
1564 OMPClause *RebuildOMPSafelenClause(Expr *Len, SourceLocation StartLoc,
1565 SourceLocation LParenLoc,
1566 SourceLocation EndLoc) {
1567 return getSema().ActOnOpenMPSafelenClause(Len, StartLoc, LParenLoc, EndLoc);
1568 }
1569
1570 /// Build a new OpenMP 'simdlen' clause.
1571 ///
1572 /// By default, performs semantic analysis to build the new OpenMP clause.
1573 /// Subclasses may override this routine to provide different behavior.
1574 OMPClause *RebuildOMPSimdlenClause(Expr *Len, SourceLocation StartLoc,
1575 SourceLocation LParenLoc,
1576 SourceLocation EndLoc) {
1577 return getSema().ActOnOpenMPSimdlenClause(Len, StartLoc, LParenLoc, EndLoc);
1578 }
1579
1580 /// Build a new OpenMP 'allocator' clause.
1581 ///
1582 /// By default, performs semantic analysis to build the new OpenMP clause.
1583 /// Subclasses may override this routine to provide different behavior.
1584 OMPClause *RebuildOMPAllocatorClause(Expr *A, SourceLocation StartLoc,
1585 SourceLocation LParenLoc,
1586 SourceLocation EndLoc) {
1587 return getSema().ActOnOpenMPAllocatorClause(A, StartLoc, LParenLoc, EndLoc);
1588 }
1589
1590 /// Build a new OpenMP 'collapse' clause.
1591 ///
1592 /// By default, performs semantic analysis to build the new OpenMP clause.
1593 /// Subclasses may override this routine to provide different behavior.
1594 OMPClause *RebuildOMPCollapseClause(Expr *Num, SourceLocation StartLoc,
1595 SourceLocation LParenLoc,
1596 SourceLocation EndLoc) {
1597 return getSema().ActOnOpenMPCollapseClause(Num, StartLoc, LParenLoc,
1598 EndLoc);
1599 }
1600
1601 /// Build a new OpenMP 'default' clause.
1602 ///
1603 /// By default, performs semantic analysis to build the new OpenMP clause.
1604 /// Subclasses may override this routine to provide different behavior.
1605 OMPClause *RebuildOMPDefaultClause(OpenMPDefaultClauseKind Kind,
1606 SourceLocation KindKwLoc,
1607 SourceLocation StartLoc,
1608 SourceLocation LParenLoc,
1609 SourceLocation EndLoc) {
1610 return getSema().ActOnOpenMPDefaultClause(Kind, KindKwLoc,
1611 StartLoc, LParenLoc, EndLoc);
1612 }
1613
1614 /// Build a new OpenMP 'proc_bind' clause.
1615 ///
1616 /// By default, performs semantic analysis to build the new OpenMP clause.
1617 /// Subclasses may override this routine to provide different behavior.
1618 OMPClause *RebuildOMPProcBindClause(ProcBindKind Kind,
1619 SourceLocation KindKwLoc,
1620 SourceLocation StartLoc,
1621 SourceLocation LParenLoc,
1622 SourceLocation EndLoc) {
1623 return getSema().ActOnOpenMPProcBindClause(Kind, KindKwLoc,
1624 StartLoc, LParenLoc, EndLoc);
1625 }
1626
1627 /// Build a new OpenMP 'schedule' clause.
1628 ///
1629 /// By default, performs semantic analysis to build the new OpenMP clause.
1630 /// Subclasses may override this routine to provide different behavior.
1631 OMPClause *RebuildOMPScheduleClause(
1632 OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2,
1633 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
1634 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
1635 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc) {
1636 return getSema().ActOnOpenMPScheduleClause(
1637 M1, M2, Kind, ChunkSize, StartLoc, LParenLoc, M1Loc, M2Loc, KindLoc,
1638 CommaLoc, EndLoc);
1639 }
1640
1641 /// Build a new OpenMP 'ordered' clause.
1642 ///
1643 /// By default, performs semantic analysis to build the new OpenMP clause.
1644 /// Subclasses may override this routine to provide different behavior.
1645 OMPClause *RebuildOMPOrderedClause(SourceLocation StartLoc,
1646 SourceLocation EndLoc,
1647 SourceLocation LParenLoc, Expr *Num) {
1648 return getSema().ActOnOpenMPOrderedClause(StartLoc, EndLoc, LParenLoc, Num);
1649 }
1650
1651 /// Build a new OpenMP 'private' clause.
1652 ///
1653 /// By default, performs semantic analysis to build the new OpenMP clause.
1654 /// Subclasses may override this routine to provide different behavior.
1655 OMPClause *RebuildOMPPrivateClause(ArrayRef<Expr *> VarList,
1656 SourceLocation StartLoc,
1657 SourceLocation LParenLoc,
1658 SourceLocation EndLoc) {
1659 return getSema().ActOnOpenMPPrivateClause(VarList, StartLoc, LParenLoc,
1660 EndLoc);
1661 }
1662
1663 /// Build a new OpenMP 'firstprivate' clause.
1664 ///
1665 /// By default, performs semantic analysis to build the new OpenMP clause.
1666 /// Subclasses may override this routine to provide different behavior.
1667 OMPClause *RebuildOMPFirstprivateClause(ArrayRef<Expr *> VarList,
1668 SourceLocation StartLoc,
1669 SourceLocation LParenLoc,
1670 SourceLocation EndLoc) {
1671 return getSema().ActOnOpenMPFirstprivateClause(VarList, StartLoc, LParenLoc,
1672 EndLoc);
1673 }
1674
1675 /// Build a new OpenMP 'lastprivate' clause.
1676 ///
1677 /// By default, performs semantic analysis to build the new OpenMP clause.
1678 /// Subclasses may override this routine to provide different behavior.
1679 OMPClause *RebuildOMPLastprivateClause(ArrayRef<Expr *> VarList,
1680 OpenMPLastprivateModifier LPKind,
1681 SourceLocation LPKindLoc,
1682 SourceLocation ColonLoc,
1683 SourceLocation StartLoc,
1684 SourceLocation LParenLoc,
1685 SourceLocation EndLoc) {
1686 return getSema().ActOnOpenMPLastprivateClause(
1687 VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
1688 }
1689
1690 /// Build a new OpenMP 'shared' clause.
1691 ///
1692 /// By default, performs semantic analysis to build the new OpenMP clause.
1693 /// Subclasses may override this routine to provide different behavior.
1694 OMPClause *RebuildOMPSharedClause(ArrayRef<Expr *> VarList,
1695 SourceLocation StartLoc,
1696 SourceLocation LParenLoc,
1697 SourceLocation EndLoc) {
1698 return getSema().ActOnOpenMPSharedClause(VarList, StartLoc, LParenLoc,
1699 EndLoc);
1700 }
1701
1702 /// Build a new OpenMP 'reduction' clause.
1703 ///
1704 /// By default, performs semantic analysis to build the new statement.
1705 /// Subclasses may override this routine to provide different behavior.
1706 OMPClause *RebuildOMPReductionClause(ArrayRef<Expr *> VarList,
1707 SourceLocation StartLoc,
1708 SourceLocation LParenLoc,
1709 SourceLocation ColonLoc,
1710 SourceLocation EndLoc,
1711 CXXScopeSpec &ReductionIdScopeSpec,
1712 const DeclarationNameInfo &ReductionId,
1713 ArrayRef<Expr *> UnresolvedReductions) {
1714 return getSema().ActOnOpenMPReductionClause(
1715 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1716 ReductionId, UnresolvedReductions);
1717 }
1718
1719 /// Build a new OpenMP 'task_reduction' clause.
1720 ///
1721 /// By default, performs semantic analysis to build the new statement.
1722 /// Subclasses may override this routine to provide different behavior.
1723 OMPClause *RebuildOMPTaskReductionClause(
1724 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1725 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1726 CXXScopeSpec &ReductionIdScopeSpec,
1727 const DeclarationNameInfo &ReductionId,
1728 ArrayRef<Expr *> UnresolvedReductions) {
1729 return getSema().ActOnOpenMPTaskReductionClause(
1730 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1731 ReductionId, UnresolvedReductions);
1732 }
1733
1734 /// Build a new OpenMP 'in_reduction' clause.
1735 ///
1736 /// By default, performs semantic analysis to build the new statement.
1737 /// Subclasses may override this routine to provide different behavior.
1738 OMPClause *
1739 RebuildOMPInReductionClause(ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1740 SourceLocation LParenLoc, SourceLocation ColonLoc,
1741 SourceLocation EndLoc,
1742 CXXScopeSpec &ReductionIdScopeSpec,
1743 const DeclarationNameInfo &ReductionId,
1744 ArrayRef<Expr *> UnresolvedReductions) {
1745 return getSema().ActOnOpenMPInReductionClause(
1746 VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec,
1747 ReductionId, UnresolvedReductions);
1748 }
1749
1750 /// Build a new OpenMP 'linear' clause.
1751 ///
1752 /// By default, performs semantic analysis to build the new OpenMP clause.
1753 /// Subclasses may override this routine to provide different behavior.
1754 OMPClause *RebuildOMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step,
1755 SourceLocation StartLoc,
1756 SourceLocation LParenLoc,
1757 OpenMPLinearClauseKind Modifier,
1758 SourceLocation ModifierLoc,
1759 SourceLocation ColonLoc,
1760 SourceLocation EndLoc) {
1761 return getSema().ActOnOpenMPLinearClause(VarList, Step, StartLoc, LParenLoc,
1762 Modifier, ModifierLoc, ColonLoc,
1763 EndLoc);
1764 }
1765
1766 /// Build a new OpenMP 'aligned' clause.
1767 ///
1768 /// By default, performs semantic analysis to build the new OpenMP clause.
1769 /// Subclasses may override this routine to provide different behavior.
1770 OMPClause *RebuildOMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1771 SourceLocation StartLoc,
1772 SourceLocation LParenLoc,
1773 SourceLocation ColonLoc,
1774 SourceLocation EndLoc) {
1775 return getSema().ActOnOpenMPAlignedClause(VarList, Alignment, StartLoc,
1776 LParenLoc, ColonLoc, EndLoc);
1777 }
1778
1779 /// Build a new OpenMP 'copyin' clause.
1780 ///
1781 /// By default, performs semantic analysis to build the new OpenMP clause.
1782 /// Subclasses may override this routine to provide different behavior.
1783 OMPClause *RebuildOMPCopyinClause(ArrayRef<Expr *> VarList,
1784 SourceLocation StartLoc,
1785 SourceLocation LParenLoc,
1786 SourceLocation EndLoc) {
1787 return getSema().ActOnOpenMPCopyinClause(VarList, StartLoc, LParenLoc,
1788 EndLoc);
1789 }
1790
1791 /// Build a new OpenMP 'copyprivate' clause.
1792 ///
1793 /// By default, performs semantic analysis to build the new OpenMP clause.
1794 /// Subclasses may override this routine to provide different behavior.
1795 OMPClause *RebuildOMPCopyprivateClause(ArrayRef<Expr *> VarList,
1796 SourceLocation StartLoc,
1797 SourceLocation LParenLoc,
1798 SourceLocation EndLoc) {
1799 return getSema().ActOnOpenMPCopyprivateClause(VarList, StartLoc, LParenLoc,
1800 EndLoc);
1801 }
1802
1803 /// Build a new OpenMP 'flush' pseudo clause.
1804 ///
1805 /// By default, performs semantic analysis to build the new OpenMP clause.
1806 /// Subclasses may override this routine to provide different behavior.
1807 OMPClause *RebuildOMPFlushClause(ArrayRef<Expr *> VarList,
1808 SourceLocation StartLoc,
1809 SourceLocation LParenLoc,
1810 SourceLocation EndLoc) {
1811 return getSema().ActOnOpenMPFlushClause(VarList, StartLoc, LParenLoc,
1812 EndLoc);
1813 }
1814
1815 /// Build a new OpenMP 'depend' pseudo clause.
1816 ///
1817 /// By default, performs semantic analysis to build the new OpenMP clause.
1818 /// Subclasses may override this routine to provide different behavior.
1819 OMPClause *
1820 RebuildOMPDependClause(OpenMPDependClauseKind DepKind, SourceLocation DepLoc,
1821 SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1822 SourceLocation StartLoc, SourceLocation LParenLoc,
1823 SourceLocation EndLoc) {
1824 return getSema().ActOnOpenMPDependClause(DepKind, DepLoc, ColonLoc, VarList,
1825 StartLoc, LParenLoc, EndLoc);
1826 }
1827
1828 /// Build a new OpenMP 'device' clause.
1829 ///
1830 /// By default, performs semantic analysis to build the new statement.
1831 /// Subclasses may override this routine to provide different behavior.
1832 OMPClause *RebuildOMPDeviceClause(Expr *Device, SourceLocation StartLoc,
1833 SourceLocation LParenLoc,
1834 SourceLocation EndLoc) {
1835 return getSema().ActOnOpenMPDeviceClause(Device, StartLoc, LParenLoc,
1836 EndLoc);
1837 }
1838
1839 /// Build a new OpenMP 'map' clause.
1840 ///
1841 /// By default, performs semantic analysis to build the new OpenMP clause.
1842 /// Subclasses may override this routine to provide different behavior.
1843 OMPClause *RebuildOMPMapClause(
1844 ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1845 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1846 CXXScopeSpec MapperIdScopeSpec, DeclarationNameInfo MapperId,
1847 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1848 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1849 const OMPVarListLocTy &Locs, ArrayRef<Expr *> UnresolvedMappers) {
1850 return getSema().ActOnOpenMPMapClause(MapTypeModifiers, MapTypeModifiersLoc,
1851 MapperIdScopeSpec, MapperId, MapType,
1852 IsMapTypeImplicit, MapLoc, ColonLoc,
1853 VarList, Locs, UnresolvedMappers);
1854 }
1855
1856 /// Build a new OpenMP 'allocate' clause.
1857 ///
1858 /// By default, performs semantic analysis to build the new OpenMP clause.
1859 /// Subclasses may override this routine to provide different behavior.
1860 OMPClause *RebuildOMPAllocateClause(Expr *Allocate, ArrayRef<Expr *> VarList,
1861 SourceLocation StartLoc,
1862 SourceLocation LParenLoc,
1863 SourceLocation ColonLoc,
1864 SourceLocation EndLoc) {
1865 return getSema().ActOnOpenMPAllocateClause(Allocate, VarList, StartLoc,
1866 LParenLoc, ColonLoc, EndLoc);
1867 }
1868
1869 /// Build a new OpenMP 'num_teams' clause.
1870 ///
1871 /// By default, performs semantic analysis to build the new statement.
1872 /// Subclasses may override this routine to provide different behavior.
1873 OMPClause *RebuildOMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc,
1874 SourceLocation LParenLoc,
1875 SourceLocation EndLoc) {
1876 return getSema().ActOnOpenMPNumTeamsClause(NumTeams, StartLoc, LParenLoc,
1877 EndLoc);
1878 }
1879
1880 /// Build a new OpenMP 'thread_limit' clause.
1881 ///
1882 /// By default, performs semantic analysis to build the new statement.
1883 /// Subclasses may override this routine to provide different behavior.
1884 OMPClause *RebuildOMPThreadLimitClause(Expr *ThreadLimit,
1885 SourceLocation StartLoc,
1886 SourceLocation LParenLoc,
1887 SourceLocation EndLoc) {
1888 return getSema().ActOnOpenMPThreadLimitClause(ThreadLimit, StartLoc,
1889 LParenLoc, EndLoc);
1890 }
1891
1892 /// Build a new OpenMP 'priority' clause.
1893 ///
1894 /// By default, performs semantic analysis to build the new statement.
1895 /// Subclasses may override this routine to provide different behavior.
1896 OMPClause *RebuildOMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1897 SourceLocation LParenLoc,
1898 SourceLocation EndLoc) {
1899 return getSema().ActOnOpenMPPriorityClause(Priority, StartLoc, LParenLoc,
1900 EndLoc);
1901 }
1902
1903 /// Build a new OpenMP 'grainsize' clause.
1904 ///
1905 /// By default, performs semantic analysis to build the new statement.
1906 /// Subclasses may override this routine to provide different behavior.
1907 OMPClause *RebuildOMPGrainsizeClause(Expr *Grainsize, SourceLocation StartLoc,
1908 SourceLocation LParenLoc,
1909 SourceLocation EndLoc) {
1910 return getSema().ActOnOpenMPGrainsizeClause(Grainsize, StartLoc, LParenLoc,
1911 EndLoc);
1912 }
1913
1914 /// Build a new OpenMP 'num_tasks' clause.
1915 ///
1916 /// By default, performs semantic analysis to build the new statement.
1917 /// Subclasses may override this routine to provide different behavior.
1918 OMPClause *RebuildOMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc,
1919 SourceLocation LParenLoc,
1920 SourceLocation EndLoc) {
1921 return getSema().ActOnOpenMPNumTasksClause(NumTasks, StartLoc, LParenLoc,
1922 EndLoc);
1923 }
1924
1925 /// Build a new OpenMP 'hint' clause.
1926 ///
1927 /// By default, performs semantic analysis to build the new statement.
1928 /// Subclasses may override this routine to provide different behavior.
1929 OMPClause *RebuildOMPHintClause(Expr *Hint, SourceLocation StartLoc,
1930 SourceLocation LParenLoc,
1931 SourceLocation EndLoc) {
1932 return getSema().ActOnOpenMPHintClause(Hint, StartLoc, LParenLoc, EndLoc);
1933 }
1934
1935 /// Build a new OpenMP 'dist_schedule' clause.
1936 ///
1937 /// By default, performs semantic analysis to build the new OpenMP clause.
1938 /// Subclasses may override this routine to provide different behavior.
1939 OMPClause *
1940 RebuildOMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind,
1941 Expr *ChunkSize, SourceLocation StartLoc,
1942 SourceLocation LParenLoc, SourceLocation KindLoc,
1943 SourceLocation CommaLoc, SourceLocation EndLoc) {
1944 return getSema().ActOnOpenMPDistScheduleClause(
1945 Kind, ChunkSize, StartLoc, LParenLoc, KindLoc, CommaLoc, EndLoc);
1946 }
1947
1948 /// Build a new OpenMP 'to' clause.
1949 ///
1950 /// By default, performs semantic analysis to build the new statement.
1951 /// Subclasses may override this routine to provide different behavior.
1952 OMPClause *RebuildOMPToClause(ArrayRef<Expr *> VarList,
1953 CXXScopeSpec &MapperIdScopeSpec,
1954 DeclarationNameInfo &MapperId,
1955 const OMPVarListLocTy &Locs,
1956 ArrayRef<Expr *> UnresolvedMappers) {
1957 return getSema().ActOnOpenMPToClause(VarList, MapperIdScopeSpec, MapperId,
1958 Locs, UnresolvedMappers);
1959 }
1960
1961 /// Build a new OpenMP 'from' clause.
1962 ///
1963 /// By default, performs semantic analysis to build the new statement.
1964 /// Subclasses may override this routine to provide different behavior.
1965 OMPClause *RebuildOMPFromClause(ArrayRef<Expr *> VarList,
1966 CXXScopeSpec &MapperIdScopeSpec,
1967 DeclarationNameInfo &MapperId,
1968 const OMPVarListLocTy &Locs,
1969 ArrayRef<Expr *> UnresolvedMappers) {
1970 return getSema().ActOnOpenMPFromClause(VarList, MapperIdScopeSpec, MapperId,
1971 Locs, UnresolvedMappers);
1972 }
1973
1974 /// Build a new OpenMP 'use_device_ptr' clause.
1975 ///
1976 /// By default, performs semantic analysis to build the new OpenMP clause.
1977 /// Subclasses may override this routine to provide different behavior.
1978 OMPClause *RebuildOMPUseDevicePtrClause(ArrayRef<Expr *> VarList,
1979 const OMPVarListLocTy &Locs) {
1980 return getSema().ActOnOpenMPUseDevicePtrClause(VarList, Locs);
1981 }
1982
1983 /// Build a new OpenMP 'is_device_ptr' clause.
1984 ///
1985 /// By default, performs semantic analysis to build the new OpenMP clause.
1986 /// Subclasses may override this routine to provide different behavior.
1987 OMPClause *RebuildOMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1988 const OMPVarListLocTy &Locs) {
1989 return getSema().ActOnOpenMPIsDevicePtrClause(VarList, Locs);
1990 }
1991
1992 /// Build a new OpenMP 'defaultmap' clause.
1993 ///
1994 /// By default, performs semantic analysis to build the new OpenMP clause.
1995 /// Subclasses may override this routine to provide different behavior.
1996 OMPClause *RebuildOMPDefaultmapClause(OpenMPDefaultmapClauseModifier M,
1997 OpenMPDefaultmapClauseKind Kind,
1998 SourceLocation StartLoc,
1999 SourceLocation LParenLoc,
2000 SourceLocation MLoc,
2001 SourceLocation KindLoc,
2002 SourceLocation EndLoc) {
2003 return getSema().ActOnOpenMPDefaultmapClause(M, Kind, StartLoc, LParenLoc,
2004 MLoc, KindLoc, EndLoc);
2005 }
2006
2007 /// Build a new OpenMP 'nontemporal' clause.
2008 ///
2009 /// By default, performs semantic analysis to build the new OpenMP clause.
2010 /// Subclasses may override this routine to provide different behavior.
2011 OMPClause *RebuildOMPNontemporalClause(ArrayRef<Expr *> VarList,
2012 SourceLocation StartLoc,
2013 SourceLocation LParenLoc,
2014 SourceLocation EndLoc) {
2015 return getSema().ActOnOpenMPNontemporalClause(VarList, StartLoc, LParenLoc,
2016 EndLoc);
2017 }
2018
2019 /// Rebuild the operand to an Objective-C \@synchronized statement.
2020 ///
2021 /// By default, performs semantic analysis to build the new statement.
2022 /// Subclasses may override this routine to provide different behavior.
2023 ExprResult RebuildObjCAtSynchronizedOperand(SourceLocation atLoc,
2024 Expr *object) {
2025 return getSema().ActOnObjCAtSynchronizedOperand(atLoc, object);
2026 }
2027
2028 /// Build a new Objective-C \@synchronized statement.
2029 ///
2030 /// By default, performs semantic analysis to build the new statement.
2031 /// Subclasses may override this routine to provide different behavior.
2032 StmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc,
2033 Expr *Object, Stmt *Body) {
2034 return getSema().ActOnObjCAtSynchronizedStmt(AtLoc, Object, Body);
2035 }
2036
2037 /// Build a new Objective-C \@autoreleasepool statement.
2038 ///
2039 /// By default, performs semantic analysis to build the new statement.
2040 /// Subclasses may override this routine to provide different behavior.
2041 StmtResult RebuildObjCAutoreleasePoolStmt(SourceLocation AtLoc,
2042 Stmt *Body) {
2043 return getSema().ActOnObjCAutoreleasePoolStmt(AtLoc, Body);
2044 }
2045
2046 /// Build a new Objective-C fast enumeration statement.
2047 ///
2048 /// By default, performs semantic analysis to build the new statement.
2049 /// Subclasses may override this routine to provide different behavior.
2050 StmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc,
2051 Stmt *Element,
2052 Expr *Collection,
2053 SourceLocation RParenLoc,
2054 Stmt *Body) {
2055 StmtResult ForEachStmt = getSema().ActOnObjCForCollectionStmt(ForLoc,
2056 Element,
2057 Collection,
2058 RParenLoc);
2059 if (ForEachStmt.isInvalid())
2060 return StmtError();
2061
2062 return getSema().FinishObjCForCollectionStmt(ForEachStmt.get(), Body);
2063 }
2064
2065 /// Build a new C++ exception declaration.
2066 ///
2067 /// By default, performs semantic analysis to build the new decaration.
2068 /// Subclasses may override this routine to provide different behavior.
2069 VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl,
2070 TypeSourceInfo *Declarator,
2071 SourceLocation StartLoc,
2072 SourceLocation IdLoc,
2073 IdentifierInfo *Id) {
2074 VarDecl *Var = getSema().BuildExceptionDeclaration(nullptr, Declarator,
2075 StartLoc, IdLoc, Id);
2076 if (Var)
2077 getSema().CurContext->addDecl(Var);
2078 return Var;
2079 }
2080
2081 /// Build a new C++ catch statement.
2082 ///
2083 /// By default, performs semantic analysis to build the new statement.
2084 /// Subclasses may override this routine to provide different behavior.
2085 StmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc,
2086 VarDecl *ExceptionDecl,
2087 Stmt *Handler) {
2088 return Owned(new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl,
2089 Handler));
2090 }
2091
2092 /// Build a new C++ try statement.
2093 ///
2094 /// By default, performs semantic analysis to build the new statement.
2095 /// Subclasses may override this routine to provide different behavior.
2096 StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, Stmt *TryBlock,
2097 ArrayRef<Stmt *> Handlers) {
2098 return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, Handlers);
2099 }
2100
2101 /// Build a new C++0x range-based for statement.
2102 ///
2103 /// By default, performs semantic analysis to build the new statement.
2104 /// Subclasses may override this routine to provide different behavior.
2105 StmtResult RebuildCXXForRangeStmt(SourceLocation ForLoc,
2106 SourceLocation CoawaitLoc, Stmt *Init,
2107 SourceLocation ColonLoc, Stmt *Range,
2108 Stmt *Begin, Stmt *End, Expr *Cond,
2109 Expr *Inc, Stmt *LoopVar,
2110 SourceLocation RParenLoc) {
2111 // If we've just learned that the range is actually an Objective-C
2112 // collection, treat this as an Objective-C fast enumeration loop.
2113 if (DeclStmt *RangeStmt = dyn_cast<DeclStmt>(Range)) {
2114 if (RangeStmt->isSingleDecl()) {
2115 if (VarDecl *RangeVar = dyn_cast<VarDecl>(RangeStmt->getSingleDecl())) {
2116 if (RangeVar->isInvalidDecl())
2117 return StmtError();
2118
2119 Expr *RangeExpr = RangeVar->getInit();
2120 if (!RangeExpr->isTypeDependent() &&
2121 RangeExpr->getType()->isObjCObjectPointerType()) {
2122 // FIXME: Support init-statements in Objective-C++20 ranged for
2123 // statement.
2124 if (Init) {
2125 return SemaRef.Diag(Init->getBeginLoc(),
2126 diag::err_objc_for_range_init_stmt)
2127 << Init->getSourceRange();
2128 }
2129 return getSema().ActOnObjCForCollectionStmt(ForLoc, LoopVar,
2130 RangeExpr, RParenLoc);
2131 }
2132 }
2133 }
2134 }
2135
2136 return getSema().BuildCXXForRangeStmt(ForLoc, CoawaitLoc, Init, ColonLoc,
2137 Range, Begin, End, Cond, Inc, LoopVar,
2138 RParenLoc, Sema::BFRK_Rebuild);
2139 }
2140
2141 /// Build a new C++0x range-based for statement.
2142 ///
2143 /// By default, performs semantic analysis to build the new statement.
2144 /// Subclasses may override this routine to provide different behavior.
2145 StmtResult RebuildMSDependentExistsStmt(SourceLocation KeywordLoc,
2146 bool IsIfExists,
2147 NestedNameSpecifierLoc QualifierLoc,
2148 DeclarationNameInfo NameInfo,
2149 Stmt *Nested) {
2150 return getSema().BuildMSDependentExistsStmt(KeywordLoc, IsIfExists,
2151 QualifierLoc, NameInfo, Nested);
2152 }
2153
2154 /// Attach body to a C++0x range-based for statement.
2155 ///
2156 /// By default, performs semantic analysis to finish the new statement.
2157 /// Subclasses may override this routine to provide different behavior.
2158 StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body) {
2159 return getSema().FinishCXXForRangeStmt(ForRange, Body);
2160 }
2161
2162 StmtResult RebuildSEHTryStmt(bool IsCXXTry, SourceLocation TryLoc,
2163 Stmt *TryBlock, Stmt *Handler) {
2164 return getSema().ActOnSEHTryBlock(IsCXXTry, TryLoc, TryBlock, Handler);
2165 }
2166
2167 StmtResult RebuildSEHExceptStmt(SourceLocation Loc, Expr *FilterExpr,
2168 Stmt *Block) {
2169 return getSema().ActOnSEHExceptBlock(Loc, FilterExpr, Block);
2170 }
2171
2172 StmtResult RebuildSEHFinallyStmt(SourceLocation Loc, Stmt *Block) {
2173 return SEHFinallyStmt::Create(getSema().getASTContext(), Loc, Block);
2174 }
2175
2176 /// Build a new predefined expression.
2177 ///
2178 /// By default, performs semantic analysis to build the new expression.
2179 /// Subclasses may override this routine to provide different behavior.
2180 ExprResult RebuildPredefinedExpr(SourceLocation Loc,
2181 PredefinedExpr::IdentKind IK) {
2182 return getSema().BuildPredefinedExpr(Loc, IK);
2183 }
2184
2185 /// Build a new expression that references a declaration.
2186 ///
2187 /// By default, performs semantic analysis to build the new expression.
2188 /// Subclasses may override this routine to provide different behavior.
2189 ExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS,
2190 LookupResult &R,
2191 bool RequiresADL) {
2192 return getSema().BuildDeclarationNameExpr(SS, R, RequiresADL);
2193 }
2194
2195
2196 /// Build a new expression that references a declaration.
2197 ///
2198 /// By default, performs semantic analysis to build the new expression.
2199 /// Subclasses may override this routine to provide different behavior.
2200 ExprResult RebuildDeclRefExpr(NestedNameSpecifierLoc QualifierLoc,
2201 ValueDecl *VD,
2202 const DeclarationNameInfo &NameInfo,
2203 NamedDecl *Found,
2204 TemplateArgumentListInfo *TemplateArgs) {
2205 CXXScopeSpec SS;
2206 SS.Adopt(QualifierLoc);
2207 return getSema().BuildDeclarationNameExpr(SS, NameInfo, VD, Found,
2208 TemplateArgs);
2209 }
2210
2211 /// Build a new expression in parentheses.
2212 ///
2213 /// By default, performs semantic analysis to build the new expression.
2214 /// Subclasses may override this routine to provide different behavior.
2215 ExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen,
2216 SourceLocation RParen) {
2217 return getSema().ActOnParenExpr(LParen, RParen, SubExpr);
2218 }
2219
2220 /// Build a new pseudo-destructor expression.
2221 ///
2222 /// By default, performs semantic analysis to build the new expression.
2223 /// Subclasses may override this routine to provide different behavior.
2224 ExprResult RebuildCXXPseudoDestructorExpr(Expr *Base,
2225 SourceLocation OperatorLoc,
2226 bool isArrow,
2227 CXXScopeSpec &SS,
2228 TypeSourceInfo *ScopeType,
2229 SourceLocation CCLoc,
2230 SourceLocation TildeLoc,
2231 PseudoDestructorTypeStorage Destroyed);
2232
2233 /// Build a new unary operator expression.
2234 ///
2235 /// By default, performs semantic analysis to build the new expression.
2236 /// Subclasses may override this routine to provide different behavior.
2237 ExprResult RebuildUnaryOperator(SourceLocation OpLoc,
2238 UnaryOperatorKind Opc,
2239 Expr *SubExpr) {
2240 return getSema().BuildUnaryOp(/*Scope=*/nullptr, OpLoc, Opc, SubExpr);
2241 }
2242
2243 /// Build a new builtin offsetof expression.
2244 ///
2245 /// By default, performs semantic analysis to build the new expression.
2246 /// Subclasses may override this routine to provide different behavior.
2247 ExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc,
2248 TypeSourceInfo *Type,
2249 ArrayRef<Sema::OffsetOfComponent> Components,
2250 SourceLocation RParenLoc) {
2251 return getSema().BuildBuiltinOffsetOf(OperatorLoc, Type, Components,
2252 RParenLoc);
2253 }
2254
2255 /// Build a new sizeof, alignof or vec_step expression with a
2256 /// type argument.
2257 ///
2258 /// By default, performs semantic analysis to build the new expression.
2259 /// Subclasses may override this routine to provide different behavior.
2260 ExprResult RebuildUnaryExprOrTypeTrait(TypeSourceInfo *TInfo,
2261 SourceLocation OpLoc,
2262 UnaryExprOrTypeTrait ExprKind,
2263 SourceRange R) {
2264 return getSema().CreateUnaryExprOrTypeTraitExpr(TInfo, OpLoc, ExprKind, R);
2265 }
2266
2267 /// Build a new sizeof, alignof or vec step expression with an
2268 /// expression argument.
2269 ///
2270 /// By default, performs semantic analysis to build the new expression.
2271 /// Subclasses may override this routine to provide different behavior.
2272 ExprResult RebuildUnaryExprOrTypeTrait(Expr *SubExpr, SourceLocation OpLoc,
2273 UnaryExprOrTypeTrait ExprKind,
2274 SourceRange R) {
2275 ExprResult Result
2276 = getSema().CreateUnaryExprOrTypeTraitExpr(SubExpr, OpLoc, ExprKind);
2277 if (Result.isInvalid())
2278 return ExprError();
2279
2280 return Result;
2281 }
2282
2283 /// Build a new array subscript expression.
2284 ///
2285 /// By default, performs semantic analysis to build the new expression.
2286 /// Subclasses may override this routine to provide different behavior.
2287 ExprResult RebuildArraySubscriptExpr(Expr *LHS,
2288 SourceLocation LBracketLoc,
2289 Expr *RHS,
2290 SourceLocation RBracketLoc) {
2291 return getSema().ActOnArraySubscriptExpr(/*Scope=*/nullptr, LHS,
2292 LBracketLoc, RHS,
2293 RBracketLoc);
2294 }
2295
2296 /// Build a new array section expression.
2297 ///
2298 /// By default, performs semantic analysis to build the new expression.
2299 /// Subclasses may override this routine to provide different behavior.
2300 ExprResult RebuildOMPArraySectionExpr(Expr *Base, SourceLocation LBracketLoc,
2301 Expr *LowerBound,
2302 SourceLocation ColonLoc, Expr *Length,
2303 SourceLocation RBracketLoc) {
2304 return getSema().ActOnOMPArraySectionExpr(Base, LBracketLoc, LowerBound,
2305 ColonLoc, Length, RBracketLoc);
2306 }
2307
2308 /// Build a new call expression.
2309 ///
2310 /// By default, performs semantic analysis to build the new expression.
2311 /// Subclasses may override this routine to provide different behavior.
2312 ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
2313 MultiExprArg Args,
2314 SourceLocation RParenLoc,
2315 Expr *ExecConfig = nullptr) {
2316 return getSema().BuildCallExpr(/*Scope=*/nullptr, Callee, LParenLoc, Args,
2317 RParenLoc, ExecConfig);
2318 }
2319
2320 /// Build a new member access expression.
2321 ///
2322 /// By default, performs semantic analysis to build the new expression.
2323 /// Subclasses may override this routine to provide different behavior.
2324 ExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc,
2325 bool isArrow,
2326 NestedNameSpecifierLoc QualifierLoc,
2327 SourceLocation TemplateKWLoc,
2328 const DeclarationNameInfo &MemberNameInfo,
2329 ValueDecl *Member,
2330 NamedDecl *FoundDecl,
2331 const TemplateArgumentListInfo *ExplicitTemplateArgs,
2332 NamedDecl *FirstQualifierInScope) {
2333 ExprResult BaseResult = getSema().PerformMemberExprBaseConversion(Base,
2334 isArrow);
2335 if (!Member->getDeclName()) {
2336 // We have a reference to an unnamed field. This is always the
2337 // base of an anonymous struct/union member access, i.e. the
2338 // field is always of record type.
2339 assert(Member->getType()->isRecordType() &&
2340 "unnamed member not of record type?");
2341
2342 BaseResult =
2343 getSema().PerformObjectMemberConversion(BaseResult.get(),
2344 QualifierLoc.getNestedNameSpecifier(),
2345 FoundDecl, Member);
2346 if (BaseResult.isInvalid())
2347 return ExprError();
2348 Base = BaseResult.get();
2349
2350 CXXScopeSpec EmptySS;
2351 return getSema().BuildFieldReferenceExpr(
2352 Base, isArrow, OpLoc, EmptySS, cast<FieldDecl>(Member),
2353 DeclAccessPair::make(FoundDecl, FoundDecl->getAccess()), MemberNameInfo);
2354 }
2355
2356 CXXScopeSpec SS;
2357 SS.Adopt(QualifierLoc);
2358
2359 Base = BaseResult.get();
2360 QualType BaseType = Base->getType();
2361
2362 if (isArrow && !BaseType->isPointerType())
2363 return ExprError();
2364
2365 // FIXME: this involves duplicating earlier analysis in a lot of
2366 // cases; we should avoid this when possible.
2367 LookupResult R(getSema(), MemberNameInfo, Sema::LookupMemberName);
2368 R.addDecl(FoundDecl);
2369 R.resolveKind();
2370
2371 return getSema().BuildMemberReferenceExpr(Base, BaseType, OpLoc, isArrow,
2372 SS, TemplateKWLoc,
2373 FirstQualifierInScope,
2374 R, ExplicitTemplateArgs,
2375 /*S*/nullptr);
2376 }
2377
2378 /// Build a new binary operator expression.
2379 ///
2380 /// By default, performs semantic analysis to build the new expression.
2381 /// Subclasses may override this routine to provide different behavior.
2382 ExprResult RebuildBinaryOperator(SourceLocation OpLoc,
2383 BinaryOperatorKind Opc,
2384 Expr *LHS, Expr *RHS) {
2385 return getSema().BuildBinOp(/*Scope=*/nullptr, OpLoc, Opc, LHS, RHS);
2386 }
2387
2388 /// Build a new rewritten operator expression.
2389 ///
2390 /// By default, performs semantic analysis to build the new expression.
2391 /// Subclasses may override this routine to provide different behavior.
2392 ExprResult RebuildCXXRewrittenBinaryOperator(
2393 SourceLocation OpLoc, BinaryOperatorKind Opcode,
2394 const UnresolvedSetImpl &UnqualLookups, Expr *LHS, Expr *RHS) {
2395 return getSema().CreateOverloadedBinOp(OpLoc, Opcode, UnqualLookups, LHS,
2396 RHS, /*RequiresADL*/false);
2397 }
2398
2399 /// Build a new conditional operator expression.
2400 ///
2401 /// By default, performs semantic analysis to build the new expression.
2402 /// Subclasses may override this routine to provide different behavior.
2403 ExprResult RebuildConditionalOperator(Expr *Cond,
2404 SourceLocation QuestionLoc,
2405 Expr *LHS,
2406 SourceLocation ColonLoc,
2407 Expr *RHS) {
2408 return getSema().ActOnConditionalOp(QuestionLoc, ColonLoc, Cond,
2409 LHS, RHS);
2410 }
2411
2412 /// Build a new C-style cast expression.
2413 ///
2414 /// By default, performs semantic analysis to build the new expression.
2415 /// Subclasses may override this routine to provide different behavior.
2416 ExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc,
2417 TypeSourceInfo *TInfo,
2418 SourceLocation RParenLoc,
2419 Expr *SubExpr) {
2420 return getSema().BuildCStyleCastExpr(LParenLoc, TInfo, RParenLoc,
2421 SubExpr);
2422 }
2423
2424 /// Build a new compound literal expression.
2425 ///
2426 /// By default, performs semantic analysis to build the new expression.
2427 /// Subclasses may override this routine to provide different behavior.
2428 ExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc,
2429 TypeSourceInfo *TInfo,
2430 SourceLocation RParenLoc,
2431 Expr *Init) {
2432 return getSema().BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc,
2433 Init);
2434 }
2435
2436 /// Build a new extended vector element access expression.
2437 ///
2438 /// By default, performs semantic analysis to build the new expression.
2439 /// Subclasses may override this routine to provide different behavior.
2440 ExprResult RebuildExtVectorElementExpr(Expr *Base,
2441 SourceLocation OpLoc,
2442 SourceLocation AccessorLoc,
2443 IdentifierInfo &Accessor) {
2444
2445 CXXScopeSpec SS;
2446 DeclarationNameInfo NameInfo(&Accessor, AccessorLoc);
2447 return getSema().BuildMemberReferenceExpr(Base, Base->getType(),
2448 OpLoc, /*IsArrow*/ false,
2449 SS, SourceLocation(),
2450 /*FirstQualifierInScope*/ nullptr,
2451 NameInfo,
2452 /* TemplateArgs */ nullptr,
2453 /*S*/ nullptr);
2454 }
2455
2456 /// Build a new initializer list expression.
2457 ///
2458 /// By default, performs semantic analysis to build the new expression.
2459 /// Subclasses may override this routine to provide different behavior.
2460 ExprResult RebuildInitList(SourceLocation LBraceLoc,
2461 MultiExprArg Inits,
2462 SourceLocation RBraceLoc) {
2463 return SemaRef.BuildInitList(LBraceLoc, Inits, RBraceLoc);
2464 }
2465
2466 /// Build a new designated initializer expression.
2467 ///
2468 /// By default, performs semantic analysis to build the new expression.
2469 /// Subclasses may override this routine to provide different behavior.
2470 ExprResult RebuildDesignatedInitExpr(Designation &Desig,
2471 MultiExprArg ArrayExprs,
2472 SourceLocation EqualOrColonLoc,
2473 bool GNUSyntax,
2474 Expr *Init) {
2475 ExprResult Result
2476 = SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
2477 Init);
2478 if (Result.isInvalid())
2479 return ExprError();
2480
2481 return Result;
2482 }
2483
2484 /// Build a new value-initialized expression.
2485 ///
2486 /// By default, builds the implicit value initialization without performing
2487 /// any semantic analysis. Subclasses may override this routine to provide
2488 /// different behavior.
2489 ExprResult RebuildImplicitValueInitExpr(QualType T) {
2490 return new (SemaRef.Context) ImplicitValueInitExpr(T);
2491 }
2492
2493 /// Build a new \c va_arg expression.
2494 ///
2495 /// By default, performs semantic analysis to build the new expression.
2496 /// Subclasses may override this routine to provide different behavior.
2497 ExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc,
2498 Expr *SubExpr, TypeSourceInfo *TInfo,
2499 SourceLocation RParenLoc) {
2500 return getSema().BuildVAArgExpr(BuiltinLoc,
2501 SubExpr, TInfo,
2502 RParenLoc);
2503 }
2504
2505 /// Build a new expression list in parentheses.
2506 ///
2507 /// By default, performs semantic analysis to build the new expression.
2508 /// Subclasses may override this routine to provide different behavior.
2509 ExprResult RebuildParenListExpr(SourceLocation LParenLoc,
2510 MultiExprArg SubExprs,
2511 SourceLocation RParenLoc) {
2512 return getSema().ActOnParenListExpr(LParenLoc, RParenLoc, SubExprs);
2513 }
2514
2515 /// Build a new address-of-label expression.
2516 ///
2517 /// By default, performs semantic analysis, using the name of the label
2518 /// rather than attempting to map the label statement itself.
2519 /// Subclasses may override this routine to provide different behavior.
2520 ExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc,
2521 SourceLocation LabelLoc, LabelDecl *Label) {
2522 return getSema().ActOnAddrLabel(AmpAmpLoc, LabelLoc, Label);
2523 }
2524
2525 /// Build a new GNU statement expression.
2526 ///
2527 /// By default, performs semantic analysis to build the new expression.
2528 /// Subclasses may override this routine to provide different behavior.
2529 ExprResult RebuildStmtExpr(SourceLocation LParenLoc,
2530 Stmt *SubStmt,
2531 SourceLocation RParenLoc) {
2532 return getSema().ActOnStmtExpr(LParenLoc, SubStmt, RParenLoc);
2533 }
2534
2535 /// Build a new __builtin_choose_expr expression.
2536 ///
2537 /// By default, performs semantic analysis to build the new expression.
2538 /// Subclasses may override this routine to provide different behavior.
2539 ExprResult RebuildChooseExpr(SourceLocation BuiltinLoc,
2540 Expr *Cond, Expr *LHS, Expr *RHS,
2541 SourceLocation RParenLoc) {
2542 return SemaRef.ActOnChooseExpr(BuiltinLoc,
2543 Cond, LHS, RHS,
2544 RParenLoc);
2545 }
2546
2547 /// Build a new generic selection expression.
2548 ///
2549 /// By default, performs semantic analysis to build the new expression.
2550 /// Subclasses may override this routine to provide different behavior.
2551 ExprResult RebuildGenericSelectionExpr(SourceLocation KeyLoc,
2552 SourceLocation DefaultLoc,
2553 SourceLocation RParenLoc,
2554 Expr *ControllingExpr,
2555 ArrayRef<TypeSourceInfo *> Types,
2556 ArrayRef<Expr *> Exprs) {
2557 return getSema().CreateGenericSelectionExpr(KeyLoc, DefaultLoc, RParenLoc,
2558 ControllingExpr, Types, Exprs);
2559 }
2560
2561 /// Build a new overloaded operator call expression.
2562 ///
2563 /// By default, performs semantic analysis to build the new expression.
2564 /// The semantic analysis provides the behavior of template instantiation,
2565 /// copying with transformations that turn what looks like an overloaded
2566 /// operator call into a use of a builtin operator, performing
2567 /// argument-dependent lookup, etc. Subclasses may override this routine to
2568 /// provide different behavior.
2569 ExprResult RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
2570 SourceLocation OpLoc,
2571 Expr *Callee,
2572 Expr *First,
2573 Expr *Second);
2574
2575 /// Build a new C++ "named" cast expression, such as static_cast or
2576 /// reinterpret_cast.
2577 ///
2578 /// By default, this routine dispatches to one of the more-specific routines
2579 /// for a particular named case, e.g., RebuildCXXStaticCastExpr().
2580 /// Subclasses may override this routine to provide different behavior.
2581 ExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc,
2582 Stmt::StmtClass Class,
2583 SourceLocation LAngleLoc,
2584 TypeSourceInfo *TInfo,
2585 SourceLocation RAngleLoc,
2586 SourceLocation LParenLoc,
2587 Expr *SubExpr,
2588 SourceLocation RParenLoc) {
2589 switch (Class) {
2590 case Stmt::CXXStaticCastExprClass:
2591 return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, TInfo,
2592 RAngleLoc, LParenLoc,
2593 SubExpr, RParenLoc);
2594
2595 case Stmt::CXXDynamicCastExprClass:
2596 return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, TInfo,
2597 RAngleLoc, LParenLoc,
2598 SubExpr, RParenLoc);
2599
2600 case Stmt::CXXReinterpretCastExprClass:
2601 return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, TInfo,
2602 RAngleLoc, LParenLoc,
2603 SubExpr,
2604 RParenLoc);
2605
2606 case Stmt::CXXConstCastExprClass:
2607 return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, TInfo,
2608 RAngleLoc, LParenLoc,
2609 SubExpr, RParenLoc);
2610
2611 default:
2612 llvm_unreachable("Invalid C++ named cast");
2613 }
2614 }
2615
2616 /// Build a new C++ static_cast expression.
2617 ///
2618 /// By default, performs semantic analysis to build the new expression.
2619 /// Subclasses may override this routine to provide different behavior.
2620 ExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc,
2621 SourceLocation LAngleLoc,
2622 TypeSourceInfo *TInfo,
2623 SourceLocation RAngleLoc,
2624 SourceLocation LParenLoc,
2625 Expr *SubExpr,
2626 SourceLocation RParenLoc) {
2627 return getSema().BuildCXXNamedCast(OpLoc, tok::kw_static_cast,
2628 TInfo, SubExpr,
2629 SourceRange(LAngleLoc, RAngleLoc),
2630 SourceRange(LParenLoc, RParenLoc));
2631 }
2632
2633 /// Build a new C++ dynamic_cast expression.
2634 ///
2635 /// By default, performs semantic analysis to build the new expression.
2636 /// Subclasses may override this routine to provide different behavior.
2637 ExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc,
2638 SourceLocation LAngleLoc,
2639 TypeSourceInfo *TInfo,
2640 SourceLocation RAngleLoc,
2641 SourceLocation LParenLoc,
2642 Expr *SubExpr,
2643 SourceLocation RParenLoc) {
2644 return getSema().BuildCXXNamedCast(OpLoc, tok::kw_dynamic_cast,
2645 TInfo, SubExpr,
2646 SourceRange(LAngleLoc, RAngleLoc),
2647 SourceRange(LParenLoc, RParenLoc));
2648 }
2649
2650 /// Build a new C++ reinterpret_cast expression.
2651 ///
2652 /// By default, performs semantic analysis to build the new expression.
2653 /// Subclasses may override this routine to provide different behavior.
2654 ExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc,
2655 SourceLocation LAngleLoc,
2656 TypeSourceInfo *TInfo,
2657 SourceLocation RAngleLoc,
2658 SourceLocation LParenLoc,
2659 Expr *SubExpr,
2660 SourceLocation RParenLoc) {
2661 return getSema().BuildCXXNamedCast(OpLoc, tok::kw_reinterpret_cast,
2662 TInfo, SubExpr,
2663 SourceRange(LAngleLoc, RAngleLoc),
2664 SourceRange(LParenLoc, RParenLoc));
2665 }
2666
2667 /// Build a new C++ const_cast expression.
2668 ///
2669 /// By default, performs semantic analysis to build the new expression.
2670 /// Subclasses may override this routine to provide different behavior.
2671 ExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc,
2672 SourceLocation LAngleLoc,
2673 TypeSourceInfo *TInfo,
2674 SourceLocation RAngleLoc,
2675 SourceLocation LParenLoc,
2676 Expr *SubExpr,
2677 SourceLocation RParenLoc) {
2678 return getSema().BuildCXXNamedCast(OpLoc, tok::kw_const_cast,
2679 TInfo, SubExpr,
2680 SourceRange(LAngleLoc, RAngleLoc),
2681 SourceRange(LParenLoc, RParenLoc));
2682 }
2683
2684 /// Build a new C++ functional-style cast expression.
2685 ///
2686 /// By default, performs semantic analysis to build the new expression.
2687 /// Subclasses may override this routine to provide different behavior.
2688 ExprResult RebuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo,
2689 SourceLocation LParenLoc,
2690 Expr *Sub,
2691 SourceLocation RParenLoc,
2692 bool ListInitialization) {
2693 return getSema().BuildCXXTypeConstructExpr(TInfo, LParenLoc,
2694 MultiExprArg(&Sub, 1), RParenLoc,
2695 ListInitialization);
2696 }
2697
2698 /// Build a new C++ __builtin_bit_cast expression.
2699 ///
2700 /// By default, performs semantic analysis to build the new expression.
2701 /// Subclasses may override this routine to provide different behavior.
2702 ExprResult RebuildBuiltinBitCastExpr(SourceLocation KWLoc,
2703 TypeSourceInfo *TSI, Expr *Sub,
2704 SourceLocation RParenLoc) {
2705 return getSema().BuildBuiltinBitCastExpr(KWLoc, TSI, Sub, RParenLoc);
2706 }
2707
2708 /// Build a new C++ typeid(type) expression.
2709 ///
2710 /// By default, performs semantic analysis to build the new expression.
2711 /// Subclasses may override this routine to provide different behavior.
2712 ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
2713 SourceLocation TypeidLoc,
2714 TypeSourceInfo *Operand,
2715 SourceLocation RParenLoc) {
2716 return getSema().BuildCXXTypeId(TypeInfoType, TypeidLoc, Operand,
2717 RParenLoc);
2718 }
2719
2720
2721 /// Build a new C++ typeid(expr) expression.
2722 ///
2723 /// By default, performs semantic analysis to build the new expression.
2724 /// Subclasses may override this routine to provide different behavior.
2725 ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
2726 SourceLocation TypeidLoc,
2727 Expr *Operand,
2728 SourceLocation RParenLoc) {
2729 return getSema().BuildCXXTypeId(TypeInfoType, TypeidLoc, Operand,
2730 RParenLoc);
2731 }
2732
2733 /// Build a new C++ __uuidof(type) expression.
2734 ///
2735 /// By default, performs semantic analysis to build the new expression.
2736 /// Subclasses may override this routine to provide different behavior.
2737 ExprResult RebuildCXXUuidofExpr(QualType TypeInfoType,
2738 SourceLocation TypeidLoc,
2739 TypeSourceInfo *Operand,
2740 SourceLocation RParenLoc) {
2741 return getSema().BuildCXXUuidof(TypeInfoType, TypeidLoc, Operand,
2742 RParenLoc);
2743 }
2744
2745 /// Build a new C++ __uuidof(expr) expression.
2746 ///
2747 /// By default, performs semantic analysis to build the new expression.
2748 /// Subclasses may override this routine to provide different behavior.
2749 ExprResult RebuildCXXUuidofExpr(QualType TypeInfoType,
2750 SourceLocation TypeidLoc,
2751 Expr *Operand,
2752 SourceLocation RParenLoc) {
2753 return getSema().BuildCXXUuidof(TypeInfoType, TypeidLoc, Operand,
2754 RParenLoc);
2755 }
2756
2757 /// Build a new C++ "this" expression.
2758 ///
2759 /// By default, builds a new "this" expression without performing any
2760 /// semantic analysis. Subclasses may override this routine to provide
2761 /// different behavior.
2762 ExprResult RebuildCXXThisExpr(SourceLocation ThisLoc,
2763 QualType ThisType,
2764 bool isImplicit) {
2765 return getSema().BuildCXXThisExpr(ThisLoc, ThisType, isImplicit);
2766 }
2767
2768 /// Build a new C++ throw expression.
2769 ///
2770 /// By default, performs semantic analysis to build the new expression.
2771 /// Subclasses may override this routine to provide different behavior.
2772 ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub,
2773 bool IsThrownVariableInScope) {
2774 return getSema().BuildCXXThrow(ThrowLoc, Sub, IsThrownVariableInScope);
2775 }
2776
2777 /// Build a new C++ default-argument expression.
2778 ///
2779 /// By default, builds a new default-argument expression, which does not
2780 /// require any semantic analysis. Subclasses may override this routine to
2781 /// provide different behavior.
2782 ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, ParmVarDecl *Param) {
2783 return CXXDefaultArgExpr::Create(getSema().Context, Loc, Param,
2784 getSema().CurContext);
2785 }
2786
2787 /// Build a new C++11 default-initialization expression.
2788 ///
2789 /// By default, builds a new default field initialization expression, which
2790 /// does not require any semantic analysis. Subclasses may override this
2791 /// routine to provide different behavior.
2792 ExprResult RebuildCXXDefaultInitExpr(SourceLocation Loc,
2793 FieldDecl *Field) {
2794 return CXXDefaultInitExpr::Create(getSema().Context, Loc, Field,
2795 getSema().CurContext);
2796 }
2797
2798 /// Build a new C++ zero-initialization expression.
2799 ///
2800 /// By default, performs semantic analysis to build the new expression.
2801 /// Subclasses may override this routine to provide different behavior.
2802 ExprResult RebuildCXXScalarValueInitExpr(TypeSourceInfo *TSInfo,
2803 SourceLocation LParenLoc,
2804 SourceLocation RParenLoc) {
2805 return getSema().BuildCXXTypeConstructExpr(
2806 TSInfo, LParenLoc, None, RParenLoc, /*ListInitialization=*/false);
2807 }
2808
2809 /// Build a new C++ "new" expression.
2810 ///
2811 /// By default, performs semantic analysis to build the new expression.
2812 /// Subclasses may override this routine to provide different behavior.
2813 ExprResult RebuildCXXNewExpr(SourceLocation StartLoc,
2814 bool UseGlobal,
2815 SourceLocation PlacementLParen,
2816 MultiExprArg PlacementArgs,
2817 SourceLocation PlacementRParen,
2818 SourceRange TypeIdParens,
2819 QualType AllocatedType,
2820 TypeSourceInfo *AllocatedTypeInfo,
2821 Optional<Expr *> ArraySize,
2822 SourceRange DirectInitRange,
2823 Expr *Initializer) {
2824 return getSema().BuildCXXNew(StartLoc, UseGlobal,
2825 PlacementLParen,
2826 PlacementArgs,
2827 PlacementRParen,
2828 TypeIdParens,
2829 AllocatedType,
2830 AllocatedTypeInfo,
2831 ArraySize,
2832 DirectInitRange,
2833 Initializer);
2834 }
2835
2836 /// Build a new C++ "delete" expression.
2837 ///
2838 /// By default, performs semantic analysis to build the new expression.
2839 /// Subclasses may override this routine to provide different behavior.
2840 ExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc,
2841 bool IsGlobalDelete,
2842 bool IsArrayForm,
2843 Expr *Operand) {
2844 return getSema().ActOnCXXDelete(StartLoc, IsGlobalDelete, IsArrayForm,
2845 Operand);
2846 }
2847
2848 /// Build a new type trait expression.
2849 ///
2850 /// By default, performs semantic analysis to build the new expression.
2851 /// Subclasses may override this routine to provide different behavior.
2852 ExprResult RebuildTypeTrait(TypeTrait Trait,
2853 SourceLocation StartLoc,
2854 ArrayRef<TypeSourceInfo *> Args,
2855 SourceLocation RParenLoc) {
2856 return getSema().BuildTypeTrait(Trait, StartLoc, Args, RParenLoc);
2857 }
2858
2859 /// Build a new array type trait expression.
2860 ///
2861 /// By default, performs semantic analysis to build the new expression.
2862 /// Subclasses may override this routine to provide different behavior.
2863 ExprResult RebuildArrayTypeTrait(ArrayTypeTrait Trait,
2864 SourceLocation StartLoc,
2865 TypeSourceInfo *TSInfo,
2866 Expr *DimExpr,
2867 SourceLocation RParenLoc) {
2868 return getSema().BuildArrayTypeTrait(Trait, StartLoc, TSInfo, DimExpr, RParenLoc);
2869 }
2870
2871 /// Build a new expression trait expression.
2872 ///
2873 /// By default, performs semantic analysis to build the new expression.
2874 /// Subclasses may override this routine to provide different behavior.
2875 ExprResult RebuildExpressionTrait(ExpressionTrait Trait,
2876 SourceLocation StartLoc,
2877 Expr *Queried,
2878 SourceLocation RParenLoc) {
2879 return getSema().BuildExpressionTrait(Trait, StartLoc, Queried, RParenLoc);
2880 }
2881
2882 /// Build a new (previously unresolved) declaration reference
2883 /// expression.
2884 ///
2885 /// By default, performs semantic analysis to build the new expression.
2886 /// Subclasses may override this routine to provide different behavior.
2887 ExprResult RebuildDependentScopeDeclRefExpr(
2888 NestedNameSpecifierLoc QualifierLoc,
2889 SourceLocation TemplateKWLoc,
2890 const DeclarationNameInfo &NameInfo,
2891 const TemplateArgumentListInfo *TemplateArgs,
2892 bool IsAddressOfOperand,
2893 TypeSourceInfo **RecoveryTSI) {
2894 CXXScopeSpec SS;
2895 SS.Adopt(QualifierLoc);
2896
2897 if (TemplateArgs || TemplateKWLoc.isValid())
2898 return getSema().BuildQualifiedTemplateIdExpr(SS, TemplateKWLoc, NameInfo,
2899 TemplateArgs);
2900
2901 return getSema().BuildQualifiedDeclarationNameExpr(
2902 SS, NameInfo, IsAddressOfOperand, /*S*/nullptr, RecoveryTSI);
2903 }
2904
2905 /// Build a new template-id expression.
2906 ///
2907 /// By default, performs semantic analysis to build the new expression.
2908 /// Subclasses may override this routine to provide different behavior.
2909 ExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS,
2910 SourceLocation TemplateKWLoc,
2911 LookupResult &R,
2912 bool RequiresADL,
2913 const TemplateArgumentListInfo *TemplateArgs) {
2914 return getSema().BuildTemplateIdExpr(SS, TemplateKWLoc, R, RequiresADL,
2915 TemplateArgs);
2916 }
2917
2918 /// Build a new object-construction expression.
2919 ///
2920 /// By default, performs semantic analysis to build the new expression.
2921 /// Subclasses may override this routine to provide different behavior.
2922 ExprResult RebuildCXXConstructExpr(QualType T,
2923 SourceLocation Loc,
2924 CXXConstructorDecl *Constructor,
2925 bool IsElidable,
2926 MultiExprArg Args,
2927 bool HadMultipleCandidates,
2928 bool ListInitialization,
2929 bool StdInitListInitialization,
2930 bool RequiresZeroInit,
2931 CXXConstructExpr::ConstructionKind ConstructKind,
2932 SourceRange ParenRange) {
2933 SmallVector<Expr*, 8> ConvertedArgs;
2934 if (getSema().CompleteConstructorCall(Constructor, Args, Loc,
2935 ConvertedArgs))
2936 return ExprError();
2937
2938 return getSema().BuildCXXConstructExpr(Loc, T, Constructor,
2939 IsElidable,
2940 ConvertedArgs,
2941 HadMultipleCandidates,
2942 ListInitialization,
2943 StdInitListInitialization,
2944 RequiresZeroInit, ConstructKind,
2945 ParenRange);
2946 }
2947
2948 /// Build a new implicit construction via inherited constructor
2949 /// expression.
2950 ExprResult RebuildCXXInheritedCtorInitExpr(QualType T, SourceLocation Loc,
2951 CXXConstructorDecl *Constructor,
2952 bool ConstructsVBase,
2953 bool InheritedFromVBase) {
2954 return new (getSema().Context) CXXInheritedCtorInitExpr(
2955 Loc, T, Constructor, ConstructsVBase, InheritedFromVBase);
2956 }
2957
2958 /// Build a new object-construction expression.
2959 ///
2960 /// By default, performs semantic analysis to build the new expression.
2961 /// Subclasses may override this routine to provide different behavior.
2962 ExprResult RebuildCXXTemporaryObjectExpr(TypeSourceInfo *TSInfo,
2963 SourceLocation LParenOrBraceLoc,
2964 MultiExprArg Args,
2965 SourceLocation RParenOrBraceLoc,
2966 bool ListInitialization) {
2967 return getSema().BuildCXXTypeConstructExpr(
2968 TSInfo, LParenOrBraceLoc, Args, RParenOrBraceLoc, ListInitialization);
2969 }
2970
2971 /// Build a new object-construction expression.
2972 ///
2973 /// By default, performs semantic analysis to build the new expression.
2974 /// Subclasses may override this routine to provide different behavior.
2975 ExprResult RebuildCXXUnresolvedConstructExpr(TypeSourceInfo *TSInfo,
2976 SourceLocation LParenLoc,
2977 MultiExprArg Args,
2978 SourceLocation RParenLoc,
2979 bool ListInitialization) {
2980 return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, Args,
2981 RParenLoc, ListInitialization);
2982 }
2983
2984 /// Build a new member reference expression.
2985 ///
2986 /// By default, performs semantic analysis to build the new expression.
2987 /// Subclasses may override this routine to provide different behavior.
2988 ExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE,
2989 QualType BaseType,
2990 bool IsArrow,
2991 SourceLocation OperatorLoc,
2992 NestedNameSpecifierLoc QualifierLoc,
2993 SourceLocation TemplateKWLoc,
2994 NamedDecl *FirstQualifierInScope,
2995 const DeclarationNameInfo &MemberNameInfo,
2996 const TemplateArgumentListInfo *TemplateArgs) {
2997 CXXScopeSpec SS;
2998 SS.Adopt(QualifierLoc);
2999
3000 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3001 OperatorLoc, IsArrow,
3002 SS, TemplateKWLoc,
3003 FirstQualifierInScope,
3004 MemberNameInfo,
3005 TemplateArgs, /*S*/nullptr);
3006 }
3007
3008 /// Build a new member reference expression.
3009 ///
3010 /// By default, performs semantic analysis to build the new expression.
3011 /// Subclasses may override this routine to provide different behavior.
3012 ExprResult RebuildUnresolvedMemberExpr(Expr *BaseE, QualType BaseType,
3013 SourceLocation OperatorLoc,
3014 bool IsArrow,
3015 NestedNameSpecifierLoc QualifierLoc,
3016 SourceLocation TemplateKWLoc,
3017 NamedDecl *FirstQualifierInScope,
3018 LookupResult &R,
3019 const TemplateArgumentListInfo *TemplateArgs) {
3020 CXXScopeSpec SS;
3021 SS.Adopt(QualifierLoc);
3022
3023 return SemaRef.BuildMemberReferenceExpr(BaseE, BaseType,
3024 OperatorLoc, IsArrow,
3025 SS, TemplateKWLoc,
3026 FirstQualifierInScope,
3027 R, TemplateArgs, /*S*/nullptr);
3028 }
3029
3030 /// Build a new noexcept expression.
3031 ///
3032 /// By default, performs semantic analysis to build the new expression.
3033 /// Subclasses may override this routine to provide different behavior.
3034 ExprResult RebuildCXXNoexceptExpr(SourceRange Range, Expr *Arg) {
3035 return SemaRef.BuildCXXNoexceptExpr(Range.getBegin(), Arg, Range.getEnd());
3036 }
3037
3038 /// Build a new expression to compute the length of a parameter pack.
3039 ExprResult RebuildSizeOfPackExpr(SourceLocation OperatorLoc,
3040 NamedDecl *Pack,
3041 SourceLocation PackLoc,
3042 SourceLocation RParenLoc,
3043 Optional<unsigned> Length,
3044 ArrayRef<TemplateArgument> PartialArgs) {
3045 return SizeOfPackExpr::Create(SemaRef.Context, OperatorLoc, Pack, PackLoc,
3046 RParenLoc, Length, PartialArgs);
3047 }
3048
3049 /// Build a new expression representing a call to a source location
3050 /// builtin.
3051 ///
3052 /// By default, performs semantic analysis to build the new expression.
3053 /// Subclasses may override this routine to provide different behavior.
3054 ExprResult RebuildSourceLocExpr(SourceLocExpr::IdentKind Kind,
3055 SourceLocation BuiltinLoc,
3056 SourceLocation RPLoc,
3057 DeclContext *ParentContext) {
3058 return getSema().BuildSourceLocExpr(Kind, BuiltinLoc, RPLoc, ParentContext);
3059 }
3060
3061 /// Build a new Objective-C boxed expression.
3062 ///
3063 /// By default, performs semantic analysis to build the new expression.
3064 /// Subclasses may override this routine to provide different behavior.
3065 ExprResult RebuildConceptSpecializationExpr(NestedNameSpecifierLoc NNS,
3066 SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo,
3067 NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
3068 TemplateArgumentListInfo *TALI) {
3069 CXXScopeSpec SS;
3070 SS.Adopt(NNS);
3071 ExprResult Result = getSema().CheckConceptTemplateId(SS, TemplateKWLoc,
3072 ConceptNameInfo,
3073 FoundDecl,
3074 NamedConcept, TALI);
3075 if (Result.isInvalid())
3076 return ExprError();
3077 return Result;
3078 }
3079
3080 /// \brief Build a new requires expression.
3081 ///
3082 /// By default, performs semantic analysis to build the new expression.
3083 /// Subclasses may override this routine to provide different behavior.
3084 ExprResult RebuildRequiresExpr(SourceLocation RequiresKWLoc,
3085 RequiresExprBodyDecl *Body,
3086 ArrayRef<ParmVarDecl *> LocalParameters,
3087 ArrayRef<concepts::Requirement *> Requirements,
3088 SourceLocation ClosingBraceLoc) {
3089 return RequiresExpr::Create(SemaRef.Context, RequiresKWLoc, Body,
3090 LocalParameters, Requirements, ClosingBraceLoc);
3091 }
3092
3093 concepts::TypeRequirement *
3094 RebuildTypeRequirement(
3095 concepts::Requirement::SubstitutionDiagnostic *SubstDiag) {
3096 return SemaRef.BuildTypeRequirement(SubstDiag);
3097 }
3098
3099 concepts::TypeRequirement *RebuildTypeRequirement(TypeSourceInfo *T) {
3100 return SemaRef.BuildTypeRequirement(T);
3101 }
3102
3103 concepts::ExprRequirement *
3104 RebuildExprRequirement(
3105 concepts::Requirement::SubstitutionDiagnostic *SubstDiag, bool IsSimple,
3106 SourceLocation NoexceptLoc,
3107 concepts::ExprRequirement::ReturnTypeRequirement Ret) {
3108 return SemaRef.BuildExprRequirement(SubstDiag, IsSimple, NoexceptLoc,
3109 std::move(Ret));
3110 }
3111
3112 concepts::ExprRequirement *
3113 RebuildExprRequirement(Expr *E, bool IsSimple, SourceLocation NoexceptLoc,
3114 concepts::ExprRequirement::ReturnTypeRequirement Ret) {
3115 return SemaRef.BuildExprRequirement(E, IsSimple, NoexceptLoc,
3116 std::move(Ret));
3117 }
3118
3119 concepts::NestedRequirement *
3120 RebuildNestedRequirement(
3121 concepts::Requirement::SubstitutionDiagnostic *SubstDiag) {
3122 return SemaRef.BuildNestedRequirement(SubstDiag);
3123 }
3124
3125 concepts::NestedRequirement *RebuildNestedRequirement(Expr *Constraint) {
3126 return SemaRef.BuildNestedRequirement(Constraint);
3127 }
3128
3129 /// \brief Build a new Objective-C boxed expression.
3130 ///
3131 /// By default, performs semantic analysis to build the new expression.
3132 /// Subclasses may override this routine to provide different behavior.
3133 ExprResult RebuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
3134 return getSema().BuildObjCBoxedExpr(SR, ValueExpr);
3135 }
3136
3137 /// Build a new Objective-C array literal.
3138 ///
3139 /// By default, performs semantic analysis to build the new expression.
3140 /// Subclasses may override this routine to provide different behavior.
3141 ExprResult RebuildObjCArrayLiteral(SourceRange Range,
3142 Expr **Elements, unsigned NumElements) {
3143 return getSema().BuildObjCArrayLiteral(Range,
3144 MultiExprArg(Elements, NumElements));
3145 }
3146
3147 ExprResult RebuildObjCSubscriptRefExpr(SourceLocation RB,
3148 Expr *Base, Expr *Key,
3149 ObjCMethodDecl *getterMethod,
3150 ObjCMethodDecl *setterMethod) {
3151 return getSema().BuildObjCSubscriptExpression(RB, Base, Key,
3152 getterMethod, setterMethod);
3153 }
3154
3155 /// Build a new Objective-C dictionary literal.
3156 ///
3157 /// By default, performs semantic analysis to build the new expression.
3158 /// Subclasses may override this routine to provide different behavior.
3159 ExprResult RebuildObjCDictionaryLiteral(SourceRange Range,
3160 MutableArrayRef<ObjCDictionaryElement> Elements) {
3161 return getSema().BuildObjCDictionaryLiteral(Range, Elements);
3162 }
3163
3164 /// Build a new Objective-C \@encode expression.
3165 ///
3166 /// By default, performs semantic analysis to build the new expression.
3167 /// Subclasses may override this routine to provide different behavior.
3168 ExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc,
3169 TypeSourceInfo *EncodeTypeInfo,
3170 SourceLocation RParenLoc) {
3171 return SemaRef.BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo, RParenLoc);
3172 }
3173
3174 /// Build a new Objective-C class message.
3175 ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo,
3176 Selector Sel,
3177 ArrayRef<SourceLocation> SelectorLocs,
3178 ObjCMethodDecl *Method,
3179 SourceLocation LBracLoc,
3180 MultiExprArg Args,
3181 SourceLocation RBracLoc) {
3182 return SemaRef.BuildClassMessage(ReceiverTypeInfo,
3183 ReceiverTypeInfo->getType(),
3184 /*SuperLoc=*/SourceLocation(),
3185 Sel, Method, LBracLoc, SelectorLocs,
3186 RBracLoc, Args);
3187 }
3188
3189 /// Build a new Objective-C instance message.
3190 ExprResult RebuildObjCMessageExpr(Expr *Receiver,
3191 Selector Sel,
3192 ArrayRef<SourceLocation> SelectorLocs,
3193 ObjCMethodDecl *Method,
3194 SourceLocation LBracLoc,
3195 MultiExprArg Args,
3196 SourceLocation RBracLoc) {
3197 return SemaRef.BuildInstanceMessage(Receiver,
3198 Receiver->getType(),
3199 /*SuperLoc=*/SourceLocation(),
3200 Sel, Method, LBracLoc, SelectorLocs,
3201 RBracLoc, Args);
3202 }
3203
3204 /// Build a new Objective-C instance/class message to 'super'.
3205 ExprResult RebuildObjCMessageExpr(SourceLocation SuperLoc,
3206 Selector Sel,
3207 ArrayRef<SourceLocation> SelectorLocs,
3208 QualType SuperType,
3209 ObjCMethodDecl *Method,
3210 SourceLocation LBracLoc,
3211 MultiExprArg Args,
3212 SourceLocation RBracLoc) {
3213 return Method->isInstanceMethod() ? SemaRef.BuildInstanceMessage(nullptr,
3214 SuperType,
3215 SuperLoc,
3216 Sel, Method, LBracLoc, SelectorLocs,
3217 RBracLoc, Args)
3218 : SemaRef.BuildClassMessage(nullptr,
3219 SuperType,
3220 SuperLoc,
3221 Sel, Method, LBracLoc, SelectorLocs,
3222 RBracLoc, Args);
3223
3224
3225 }
3226
3227 /// Build a new Objective-C ivar reference expression.
3228 ///
3229 /// By default, performs semantic analysis to build the new expression.
3230 /// Subclasses may override this routine to provide different behavior.
3231 ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar,
3232 SourceLocation IvarLoc,
3233 bool IsArrow, bool IsFreeIvar) {
3234 CXXScopeSpec SS;
3235 DeclarationNameInfo NameInfo(Ivar->getDeclName(), IvarLoc);
3236 ExprResult Result = getSema().BuildMemberReferenceExpr(
3237 BaseArg, BaseArg->getType(),
3238 /*FIXME:*/ IvarLoc, IsArrow, SS, SourceLocation(),
3239 /*FirstQualifierInScope=*/nullptr, NameInfo,
3240 /*TemplateArgs=*/nullptr,
3241 /*S=*/nullptr);
3242 if (IsFreeIvar && Result.isUsable())
3243 cast<ObjCIvarRefExpr>(Result.get())->setIsFreeIvar(IsFreeIvar);
3244 return Result;
3245 }
3246
3247 /// Build a new Objective-C property reference expression.
3248 ///
3249 /// By default, performs semantic analysis to build the new expression.
3250 /// Subclasses may override this routine to provide different behavior.
3251 ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg,
3252 ObjCPropertyDecl *Property,
3253 SourceLocation PropertyLoc) {
3254 CXXScopeSpec SS;
3255 DeclarationNameInfo NameInfo(Property->getDeclName(), PropertyLoc);
3256 return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(),
3257 /*FIXME:*/PropertyLoc,
3258 /*IsArrow=*/false,
3259 SS, SourceLocation(),
3260 /*FirstQualifierInScope=*/nullptr,
3261 NameInfo,
3262 /*TemplateArgs=*/nullptr,
3263 /*S=*/nullptr);
3264 }
3265
3266 /// Build a new Objective-C property reference expression.
3267 ///
3268 /// By default, performs semantic analysis to build the new expression.
3269 /// Subclasses may override this routine to provide different behavior.
3270 ExprResult RebuildObjCPropertyRefExpr(Expr *Base, QualType T,
3271 ObjCMethodDecl *Getter,
3272 ObjCMethodDecl *Setter,
3273 SourceLocation PropertyLoc) {
3274 // Since these expressions can only be value-dependent, we do not
3275 // need to perform semantic analysis again.
3276 return Owned(
3277 new (getSema().Context) ObjCPropertyRefExpr(Getter, Setter, T,
3278 VK_LValue, OK_ObjCProperty,
3279 PropertyLoc, Base));
3280 }
3281
3282 /// Build a new Objective-C "isa" expression.
3283 ///
3284 /// By default, performs semantic analysis to build the new expression.
3285 /// Subclasses may override this routine to provide different behavior.
3286 ExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc,
3287 SourceLocation OpLoc, bool IsArrow) {
3288 CXXScopeSpec SS;
3289 DeclarationNameInfo NameInfo(&getSema().Context.Idents.get("isa"), IsaLoc);
3290 return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(),
3291 OpLoc, IsArrow,
3292 SS, SourceLocation(),
3293 /*FirstQualifierInScope=*/nullptr,
3294 NameInfo,
3295 /*TemplateArgs=*/nullptr,
3296 /*S=*/nullptr);
3297 }
3298
3299 /// Build a new shuffle vector expression.
3300 ///
3301 /// By default, performs semantic analysis to build the new expression.
3302 /// Subclasses may override this routine to provide different behavior.
3303 ExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc,
3304 MultiExprArg SubExprs,
3305 SourceLocation RParenLoc) {
3306 // Find the declaration for __builtin_shufflevector
3307 const IdentifierInfo &Name
3308 = SemaRef.Context.Idents.get("__builtin_shufflevector");
3309 TranslationUnitDecl *TUDecl = SemaRef.Context.getTranslationUnitDecl();
3310 DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name));
3311 assert(!Lookup.empty() && "No __builtin_shufflevector?");
3312
3313 // Build a reference to the __builtin_shufflevector builtin
3314 FunctionDecl *Builtin = cast<FunctionDecl>(Lookup.front());
3315 Expr *Callee = new (SemaRef.Context)
3316 DeclRefExpr(SemaRef.Context, Builtin, false,
3317 SemaRef.Context.BuiltinFnTy, VK_RValue, BuiltinLoc);
3318 QualType CalleePtrTy = SemaRef.Context.getPointerType(Builtin->getType());
3319 Callee = SemaRef.ImpCastExprToType(Callee, CalleePtrTy,
3320 CK_BuiltinFnToFnPtr).get();
3321
3322 // Build the CallExpr
3323 ExprResult TheCall = CallExpr::Create(
3324 SemaRef.Context, Callee, SubExprs, Builtin->getCallResultType(),
3325 Expr::getValueKindForType(Builtin->getReturnType()), RParenLoc);
3326
3327 // Type-check the __builtin_shufflevector expression.
3328 return SemaRef.SemaBuiltinShuffleVector(cast<CallExpr>(TheCall.get()));
3329 }
3330
3331 /// Build a new convert vector expression.
3332 ExprResult RebuildConvertVectorExpr(SourceLocation BuiltinLoc,
3333 Expr *SrcExpr, TypeSourceInfo *DstTInfo,
3334 SourceLocation RParenLoc) {
3335 return SemaRef.SemaConvertVectorExpr(SrcExpr, DstTInfo,
3336 BuiltinLoc, RParenLoc);
3337 }
3338
3339 /// Build a new template argument pack expansion.
3340 ///
3341 /// By default, performs semantic analysis to build a new pack expansion
3342 /// for a template argument. Subclasses may override this routine to provide
3343 /// different behavior.
3344 TemplateArgumentLoc RebuildPackExpansion(TemplateArgumentLoc Pattern,
3345 SourceLocation EllipsisLoc,
3346 Optional<unsigned> NumExpansions) {
3347 switch (Pattern.getArgument().getKind()) {
3348 case TemplateArgument::Expression: {
3349 ExprResult Result
3350 = getSema().CheckPackExpansion(Pattern.getSourceExpression(),
3351 EllipsisLoc, NumExpansions);
3352 if (Result.isInvalid())
3353 return TemplateArgumentLoc();
3354
3355 return TemplateArgumentLoc(Result.get(), Result.get());
3356 }
3357
3358 case TemplateArgument::Template:
3359 return TemplateArgumentLoc(TemplateArgument(
3360 Pattern.getArgument().getAsTemplate(),
3361 NumExpansions),
3362 Pattern.getTemplateQualifierLoc(),
3363 Pattern.getTemplateNameLoc(),
3364 EllipsisLoc);
3365
3366 case TemplateArgument::Null:
3367 case TemplateArgument::Integral:
3368 case TemplateArgument::Declaration:
3369 case TemplateArgument::Pack:
3370 case TemplateArgument::TemplateExpansion:
3371 case TemplateArgument::NullPtr:
3372 llvm_unreachable("Pack expansion pattern has no parameter packs");
3373
3374 case TemplateArgument::Type:
3375 if (TypeSourceInfo *Expansion
3376 = getSema().CheckPackExpansion(Pattern.getTypeSourceInfo(),
3377 EllipsisLoc,
3378 NumExpansions))
3379 return TemplateArgumentLoc(TemplateArgument(Expansion->getType()),
3380 Expansion);
3381 break;
3382 }
3383
3384 return TemplateArgumentLoc();
3385 }
3386
3387 /// Build a new expression pack expansion.
3388 ///
3389 /// By default, performs semantic analysis to build a new pack expansion
3390 /// for an expression. Subclasses may override this routine to provide
3391 /// different behavior.
3392 ExprResult RebuildPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
3393 Optional<unsigned> NumExpansions) {
3394 return getSema().CheckPackExpansion(Pattern, EllipsisLoc, NumExpansions);
3395 }
3396
3397 /// Build a new C++1z fold-expression.
3398 ///
3399 /// By default, performs semantic analysis in order to build a new fold
3400 /// expression.
3401 ExprResult RebuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS,
3402 BinaryOperatorKind Operator,
3403 SourceLocation EllipsisLoc, Expr *RHS,
3404 SourceLocation RParenLoc,
3405 Optional<unsigned> NumExpansions) {
3406 return getSema().BuildCXXFoldExpr(LParenLoc, LHS, Operator, EllipsisLoc,
3407 RHS, RParenLoc, NumExpansions);
3408 }
3409
3410 /// Build an empty C++1z fold-expression with the given operator.
3411 ///
3412 /// By default, produces the fallback value for the fold-expression, or
3413 /// produce an error if there is no fallback value.
3414 ExprResult RebuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc,
3415 BinaryOperatorKind Operator) {
3416 return getSema().BuildEmptyCXXFoldExpr(EllipsisLoc, Operator);
3417 }
3418
3419 /// Build a new atomic operation expression.
3420 ///
3421 /// By default, performs semantic analysis to build the new expression.
3422 /// Subclasses may override this routine to provide different behavior.
3423 ExprResult RebuildAtomicExpr(SourceLocation BuiltinLoc, MultiExprArg SubExprs,
3424 AtomicExpr::AtomicOp Op,
3425 SourceLocation RParenLoc) {
3426 // Use this for all of the locations, since we don't know the difference
3427 // between the call and the expr at this point.
3428 SourceRange Range{BuiltinLoc, RParenLoc};
3429 return getSema().BuildAtomicExpr(Range, Range, RParenLoc, SubExprs, Op,
3430 Sema::AtomicArgumentOrder::AST);
3431 }
3432
3433 private:
3434 TypeLoc TransformTypeInObjectScope(TypeLoc TL,
3435 QualType ObjectType,
3436 NamedDecl *FirstQualifierInScope,
3437 CXXScopeSpec &SS);
3438
3439 TypeSourceInfo *TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
3440 QualType ObjectType,
3441 NamedDecl *FirstQualifierInScope,
3442 CXXScopeSpec &SS);
3443
3444 TypeSourceInfo *TransformTSIInObjectScope(TypeLoc TL, QualType ObjectType,
3445 NamedDecl *FirstQualifierInScope,
3446 CXXScopeSpec &SS);
3447
3448 QualType TransformDependentNameType(TypeLocBuilder &TLB,
3449 DependentNameTypeLoc TL,
3450 bool DeducibleTSTContext);
3451 };
3452
3453 template <typename Derived>
3454 StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S, StmtDiscardKind SDK) {
3455 if (!S)
3456 return S;
3457
3458 switch (S->getStmtClass()) {
3459 case Stmt::NoStmtClass: break;
3460
3461 // Transform individual statement nodes
3462 // Pass SDK into statements that can produce a value
3463 #define STMT(Node, Parent) \
3464 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
3465 #define VALUESTMT(Node, Parent) \
3466 case Stmt::Node##Class: \
3467 return getDerived().Transform##Node(cast<Node>(S), SDK);
3468 #define ABSTRACT_STMT(Node)
3469 #define EXPR(Node, Parent)
3470 #include "clang/AST/StmtNodes.inc"
3471
3472 // Transform expressions by calling TransformExpr.
3473 #define STMT(Node, Parent)
3474 #define ABSTRACT_STMT(Stmt)
3475 #define EXPR(Node, Parent) case Stmt::Node##Class:
3476 #include "clang/AST/StmtNodes.inc"
3477 {
3478 ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
3479
3480 if (SDK == SDK_StmtExprResult)
3481 E = getSema().ActOnStmtExprResult(E);
3482 return getSema().ActOnExprStmt(E, SDK == SDK_Discarded);
3483 }
3484 }
3485
3486 return S;
3487 }
3488
3489 template<typename Derived>
3490 OMPClause *TreeTransform<Derived>::TransformOMPClause(OMPClause *S) {
3491 if (!S)
3492 return S;
3493
3494 switch (S->getClauseKind()) {
3495 default: break;
3496 // Transform individual clause nodes
3497 #define OPENMP_CLAUSE(Name, Class) \
3498 case OMPC_ ## Name : \
3499 return getDerived().Transform ## Class(cast<Class>(S));
3500 #include "clang/Basic/OpenMPKinds.def"
3501 }
3502
3503 return S;
3504 }
3505
3506
3507 template<typename Derived>
3508 ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) {
3509 if (!E)
3510 return E;
3511
3512 switch (E->getStmtClass()) {
3513 case Stmt::NoStmtClass: break;
3514 #define STMT(Node, Parent) case Stmt::Node##Class: break;
3515 #define ABSTRACT_STMT(Stmt)
3516 #define EXPR(Node, Parent) \
3517 case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
3518 #include "clang/AST/StmtNodes.inc"
3519 }
3520
3521 return E;
3522 }
3523
3524 template<typename Derived>
3525 ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
3526 bool NotCopyInit) {
3527 // Initializers are instantiated like expressions, except that various outer
3528 // layers are stripped.
3529 if (!Init)
3530 return Init;
3531
3532 if (auto *FE = dyn_cast<FullExpr>(Init))
3533 Init = FE->getSubExpr();
3534
3535 if (auto *AIL = dyn_cast<ArrayInitLoopExpr>(Init))
3536 Init = AIL->getCommonExpr();
3537
3538 if (MaterializeTemporaryExpr *MTE = dyn_cast<MaterializeTemporaryExpr>(Init))
3539 Init = MTE->getSubExpr();
3540
3541 while (CXXBindTemporaryExpr *Binder = dyn_cast<CXXBindTemporaryExpr>(Init))
3542 Init = Binder->getSubExpr();
3543
3544 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Init))
3545 Init = ICE->getSubExprAsWritten();
3546
3547 if (CXXStdInitializerListExpr *ILE =
3548 dyn_cast<CXXStdInitializerListExpr>(Init))
3549 return TransformInitializer(ILE->getSubExpr(), NotCopyInit);
3550
3551 // If this is copy-initialization, we only need to reconstruct
3552 // InitListExprs. Other forms of copy-initialization will be a no-op if
3553 // the initializer is already the right type.
3554 CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init);
3555 if (!NotCopyInit && !(Construct && Construct->isListInitialization()))
3556 return getDerived().TransformExpr(Init);
3557
3558 // Revert value-initialization back to empty parens.
3559 if (CXXScalarValueInitExpr *VIE = dyn_cast<CXXScalarValueInitExpr>(Init)) {
3560 SourceRange Parens = VIE->getSourceRange();
3561 return getDerived().RebuildParenListExpr(Parens.getBegin(), None,
3562 Parens.getEnd());
3563 }
3564
3565 // FIXME: We shouldn't build ImplicitValueInitExprs for direct-initialization.
3566 if (isa<ImplicitValueInitExpr>(Init))
3567 return getDerived().RebuildParenListExpr(SourceLocation(), None,
3568 SourceLocation());
3569
3570 // Revert initialization by constructor back to a parenthesized or braced list
3571 // of expressions. Any other form of initializer can just be reused directly.
3572 if (!Construct || isa<CXXTemporaryObjectExpr>(Construct))
3573 return getDerived().TransformExpr(Init);
3574
3575 // If the initialization implicitly converted an initializer list to a
3576 // std::initializer_list object, unwrap the std::initializer_list too.
3577 if (Construct && Construct->isStdInitListInitialization())
3578 return TransformInitializer(Construct->getArg(0), NotCopyInit);
3579
3580 // Enter a list-init context if this was list initialization.
3581 EnterExpressionEvaluationContext Context(
3582 getSema(), EnterExpressionEvaluationContext::InitList,
3583 Construct->isListInitialization());
3584
3585 SmallVector<Expr*, 8> NewArgs;
3586 bool ArgChanged = false;
3587 if (getDerived().TransformExprs(Construct->getArgs(), Construct->getNumArgs(),
3588 /*IsCall*/true, NewArgs, &ArgChanged))
3589 return ExprError();
3590
3591 // If this was list initialization, revert to syntactic list form.
3592 if (Construct->isListInitialization())
3593 return getDerived().RebuildInitList(Construct->getBeginLoc(), NewArgs,
3594 Construct->getEndLoc());
3595
3596 // Build a ParenListExpr to represent anything else.
3597 SourceRange Parens = Construct->getParenOrBraceRange();
3598 if (Parens.isInvalid()) {
3599 // This was a variable declaration's initialization for which no initializer
3600 // was specified.
3601 assert(NewArgs.empty() &&
3602 "no parens or braces but have direct init with arguments?");
3603 return ExprEmpty();
3604 }
3605 return getDerived().RebuildParenListExpr(Parens.getBegin(), NewArgs,
3606 Parens.getEnd());
3607 }
3608
3609 template<typename Derived>
3610 bool TreeTransform<Derived>::TransformExprs(Expr *const *Inputs,
3611 unsigned NumInputs,
3612 bool IsCall,
3613 SmallVectorImpl<Expr *> &Outputs,
3614 bool *ArgChanged) {
3615 for (unsigned I = 0; I != NumInputs; ++I) {
3616 // If requested, drop call arguments that need to be dropped.
3617 if (IsCall && getDerived().DropCallArgument(Inputs[I])) {
3618 if (ArgChanged)
3619 *ArgChanged = true;
3620
3621 break;
3622 }
3623
3624 if (PackExpansionExpr *Expansion = dyn_cast<PackExpansionExpr>(Inputs[I])) {
3625 Expr *Pattern = Expansion->getPattern();
3626
3627 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
3628 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
3629 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
3630
3631 // Determine whether the set of unexpanded parameter packs can and should
3632 // be expanded.
3633 bool Expand = true;
3634 bool RetainExpansion = false;
3635 Optional<unsigned> OrigNumExpansions = Expansion->getNumExpansions();
3636 Optional<unsigned> NumExpansions = OrigNumExpansions;
3637 if (getDerived().TryExpandParameterPacks(Expansion->getEllipsisLoc(),
3638 Pattern->getSourceRange(),
3639 Unexpanded,
3640 Expand, RetainExpansion,
3641 NumExpansions))
3642 return true;
3643
3644 if (!Expand) {
3645 // The transform has determined that we should perform a simple
3646 // transformation on the pack expansion, producing another pack
3647 // expansion.
3648 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
3649 ExprResult OutPattern = getDerived().TransformExpr(Pattern);
3650 if (OutPattern.isInvalid())
3651 return true;
3652
3653 ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.get(),
3654 Expansion->getEllipsisLoc(),
3655 NumExpansions);
3656 if (Out.isInvalid())
3657 return true;
3658
3659 if (ArgChanged)
3660 *ArgChanged = true;
3661 Outputs.push_back(Out.get());
3662 continue;
3663 }
3664
3665 // Record right away that the argument was changed. This needs
3666 // to happen even if the array expands to nothing.
3667 if (ArgChanged) *ArgChanged = true;
3668
3669 // The transform has determined that we should perform an elementwise
3670 // expansion of the pattern. Do so.
3671 for (unsigned I = 0; I != *NumExpansions; ++I) {
3672 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
3673 ExprResult Out = getDerived().TransformExpr(Pattern);
3674 if (Out.isInvalid())
3675 return true;
3676
3677 if (Out.get()->containsUnexpandedParameterPack()) {
3678 Out = getDerived().RebuildPackExpansion(
3679 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
3680 if (Out.isInvalid())
3681 return true;
3682 }
3683
3684 Outputs.push_back(Out.get());
3685 }
3686
3687 // If we're supposed to retain a pack expansion, do so by temporarily
3688 // forgetting the partially-substituted parameter pack.
3689 if (RetainExpansion) {
3690 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
3691
3692 ExprResult Out = getDerived().TransformExpr(Pattern);
3693 if (Out.isInvalid())
3694 return true;
3695
3696 Out = getDerived().RebuildPackExpansion(
3697 Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
3698 if (Out.isInvalid())
3699 return true;
3700
3701 Outputs.push_back(Out.get());
3702 }
3703
3704 continue;
3705 }
3706
3707 ExprResult Result =
3708 IsCall ? getDerived().TransformInitializer(Inputs[I], /*DirectInit*/false)
3709 : getDerived().TransformExpr(Inputs[I]);
3710 if (Result.isInvalid())
3711 return true;
3712
3713 if (Result.get() != Inputs[I] && ArgChanged)
3714 *ArgChanged = true;
3715
3716 Outputs.push_back(Result.get());
3717 }
3718
3719 return false;
3720 }
3721
3722 template <typename Derived>
3723 Sema::ConditionResult TreeTransform<Derived>::TransformCondition(
3724 SourceLocation Loc, VarDecl *Var, Expr *Expr, Sema::ConditionKind Kind) {
3725 if (Var) {
3726 VarDecl *ConditionVar = cast_or_null<VarDecl>(
3727 getDerived().TransformDefinition(Var->getLocation(), Var));
3728
3729 if (!ConditionVar)
3730 return Sema::ConditionError();
3731
3732 return getSema().ActOnConditionVariable(ConditionVar, Loc, Kind);
3733 }
3734
3735 if (Expr) {
3736 ExprResult CondExpr = getDerived().TransformExpr(Expr);
3737
3738 if (CondExpr.isInvalid())
3739 return Sema::ConditionError();
3740
3741 return getSema().ActOnCondition(nullptr, Loc, CondExpr.get(), Kind);
3742 }
3743
3744 return Sema::ConditionResult();
3745 }
3746
3747 template<typename Derived>
3748 NestedNameSpecifierLoc
3749 TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
3750 NestedNameSpecifierLoc NNS,
3751 QualType ObjectType,
3752 NamedDecl *FirstQualifierInScope) {
3753 SmallVector<NestedNameSpecifierLoc, 4> Qualifiers;
3754 for (NestedNameSpecifierLoc Qualifier = NNS; Qualifier;
3755 Qualifier = Qualifier.getPrefix())
3756 Qualifiers.push_back(Qualifier);
3757
3758 CXXScopeSpec SS;
3759 while (!Qualifiers.empty()) {
3760 NestedNameSpecifierLoc Q = Qualifiers.pop_back_val();
3761 NestedNameSpecifier *QNNS = Q.getNestedNameSpecifier();
3762
3763 switch (QNNS->getKind()) {
3764 case NestedNameSpecifier::Identifier: {
3765 Sema::NestedNameSpecInfo IdInfo(QNNS->getAsIdentifier(),
3766 Q.getLocalBeginLoc(), Q.getLocalEndLoc(), ObjectType);
3767 if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/nullptr, IdInfo, false,
3768 SS, FirstQualifierInScope, false))
3769 return NestedNameSpecifierLoc();
3770 }
3771 break;
3772
3773 case NestedNameSpecifier::Namespace: {
3774 NamespaceDecl *NS
3775 = cast_or_null<NamespaceDecl>(
3776 getDerived().TransformDecl(
3777 Q.getLocalBeginLoc(),
3778 QNNS->getAsNamespace()));
3779 SS.Extend(SemaRef.Context, NS, Q.getLocalBeginLoc(), Q.getLocalEndLoc());
3780 break;
3781 }
3782
3783 case NestedNameSpecifier::NamespaceAlias: {
3784 NamespaceAliasDecl *Alias
3785 = cast_or_null<NamespaceAliasDecl>(
3786 getDerived().TransformDecl(Q.getLocalBeginLoc(),
3787 QNNS->getAsNamespaceAlias()));
3788 SS.Extend(SemaRef.Context, Alias, Q.getLocalBeginLoc(),
3789 Q.getLocalEndLoc());
3790 break;
3791 }
3792
3793 case NestedNameSpecifier::Global:
3794 // There is no meaningful transformation that one could perform on the
3795 // global scope.
3796 SS.MakeGlobal(SemaRef.Context, Q.getBeginLoc());
3797 break;
3798
3799 case NestedNameSpecifier::Super: {
3800 CXXRecordDecl *RD =
3801 cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
3802 SourceLocation(), QNNS->getAsRecordDecl()));
3803 SS.MakeSuper(SemaRef.Context, RD, Q.getBeginLoc(), Q.getEndLoc());
3804 break;
3805 }
3806
3807 case NestedNameSpecifier::TypeSpecWithTemplate:
3808 case NestedNameSpecifier::TypeSpec: {
3809 TypeLoc TL = TransformTypeInObjectScope(Q.getTypeLoc(), ObjectType,
3810 FirstQualifierInScope, SS);
3811
3812 if (!TL)
3813 return NestedNameSpecifierLoc();
3814
3815 if (TL.getType()->isDependentType() || TL.getType()->isRecordType() ||
3816 (SemaRef.getLangOpts().CPlusPlus11 &&
3817 TL.getType()->isEnumeralType())) {
3818 assert(!TL.getType().hasLocalQualifiers() &&
3819 "Can't get cv-qualifiers here");
3820 if (TL.getType()->isEnumeralType())
3821 SemaRef.Diag(TL.getBeginLoc(),
3822 diag::warn_cxx98_compat_enum_nested_name_spec);
3823 SS.Extend(SemaRef.Context, /*FIXME:*/SourceLocation(), TL,
3824 Q.getLocalEndLoc());
3825 break;
3826 }
3827 // If the nested-name-specifier is an invalid type def, don't emit an
3828 // error because a previous error should have already been emitted.
3829 TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>();
3830 if (!TTL || !TTL.getTypedefNameDecl()->isInvalidDecl()) {
3831 SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag)
3832 << TL.getType() << SS.getRange();
3833 }
3834 return NestedNameSpecifierLoc();
3835 }
3836 }
3837
3838 // The qualifier-in-scope and object type only apply to the leftmost entity.
3839 FirstQualifierInScope = nullptr;
3840 ObjectType = QualType();
3841 }
3842
3843 // Don't rebuild the nested-name-specifier if we don't have to.
3844 if (SS.getScopeRep() == NNS.getNestedNameSpecifier() &&
3845 !getDerived().AlwaysRebuild())
3846 return NNS;
3847
3848 // If we can re-use the source-location data from the original
3849 // nested-name-specifier, do so.
3850 if (SS.location_size() == NNS.getDataLength() &&
3851 memcmp(SS.location_data(), NNS.getOpaqueData(), SS.location_size()) == 0)
3852 return NestedNameSpecifierLoc(SS.getScopeRep(), NNS.getOpaqueData());
3853
3854 // Allocate new nested-name-specifier location information.
3855 return SS.getWithLocInContext(SemaRef.Context);
3856 }
3857
3858 template<typename Derived>
3859 DeclarationNameInfo
3860 TreeTransform<Derived>
3861 ::TransformDeclarationNameInfo(const DeclarationNameInfo &NameInfo) {
3862 DeclarationName Name = NameInfo.getName();
3863 if (!Name)
3864 return DeclarationNameInfo();
3865
3866 switch (Name.getNameKind()) {
3867 case DeclarationName::Identifier:
3868 case DeclarationName::ObjCZeroArgSelector:
3869 case DeclarationName::ObjCOneArgSelector:
3870 case DeclarationName::ObjCMultiArgSelector:
3871 case DeclarationName::CXXOperatorName:
3872 case DeclarationName::CXXLiteralOperatorName:
3873 case DeclarationName::CXXUsingDirective:
3874 return NameInfo;
3875
3876 case DeclarationName::CXXDeductionGuideName: {
3877 TemplateDecl *OldTemplate = Name.getCXXDeductionGuideTemplate();
3878 TemplateDecl *NewTemplate = cast_or_null<TemplateDecl>(
3879 getDerived().TransformDecl(NameInfo.getLoc(), OldTemplate));
3880 if (!NewTemplate)
3881 return DeclarationNameInfo();
3882
3883 DeclarationNameInfo NewNameInfo(NameInfo);
3884 NewNameInfo.setName(
3885 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(NewTemplate));
3886 return NewNameInfo;
3887 }
3888
3889 case DeclarationName::CXXConstructorName:
3890 case DeclarationName::CXXDestructorName:
3891 case DeclarationName::CXXConversionFunctionName: {
3892 TypeSourceInfo *NewTInfo;
3893 CanQualType NewCanTy;
3894 if (TypeSourceInfo *OldTInfo = NameInfo.getNamedTypeInfo()) {
3895 NewTInfo = getDerived().TransformType(OldTInfo);
3896 if (!NewTInfo)
3897 return DeclarationNameInfo();
3898 NewCanTy = SemaRef.Context.getCanonicalType(NewTInfo->getType());
3899 }
3900 else {
3901 NewTInfo = nullptr;
3902 TemporaryBase Rebase(*this, NameInfo.getLoc(), Name);
3903 QualType NewT = getDerived().TransformType(Name.getCXXNameType());
3904 if (NewT.isNull())
3905 return DeclarationNameInfo();
3906 NewCanTy = SemaRef.Context.getCanonicalType(NewT);
3907 }
3908
3909 DeclarationName NewName
3910 = SemaRef.Context.DeclarationNames.getCXXSpecialName(Name.getNameKind(),
3911 NewCanTy);
3912 DeclarationNameInfo NewNameInfo(NameInfo);
3913 NewNameInfo.setName(NewName);
3914 NewNameInfo.setNamedTypeInfo(NewTInfo);
3915 return NewNameInfo;
3916 }
3917 }
3918
3919 llvm_unreachable("Unknown name kind.");
3920 }
3921
3922 template<typename Derived>
3923 TemplateName
3924 TreeTransform<Derived>::TransformTemplateName(CXXScopeSpec &SS,
3925 TemplateName Name,
3926 SourceLocation NameLoc,
3927 QualType ObjectType,
3928 NamedDecl *FirstQualifierInScope,
3929 bool AllowInjectedClassName) {
3930 if (QualifiedTemplateName *QTN = Name.getAsQualifiedTemplateName()) {
3931 TemplateDecl *Template = QTN->getTemplateDecl();
3932 assert(Template && "qualified template name must refer to a template");
3933
3934 TemplateDecl *TransTemplate
3935 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
3936 Template));
3937 if (!TransTemplate)
3938 return TemplateName();
3939
3940 if (!getDerived().AlwaysRebuild() &&
3941 SS.getScopeRep() == QTN->getQualifier() &&
3942 TransTemplate == Template)
3943 return Name;
3944
3945 return getDerived().RebuildTemplateName(SS, QTN->hasTemplateKeyword(),
3946 TransTemplate);
3947 }
3948
3949 if (DependentTemplateName *DTN = Name.getAsDependentTemplateName()) {
3950 if (SS.getScopeRep()) {
3951 // These apply to the scope specifier, not the template.
3952 ObjectType = QualType();
3953 FirstQualifierInScope = nullptr;
3954 }
3955
3956 if (!getDerived().AlwaysRebuild() &&
3957 SS.getScopeRep() == DTN->getQualifier() &&
3958 ObjectType.isNull())
3959 return Name;
3960
3961 // FIXME: Preserve the location of the "template" keyword.
3962 SourceLocation TemplateKWLoc = NameLoc;
3963
3964 if (DTN->isIdentifier()) {
3965 return getDerived().RebuildTemplateName(SS,
3966 TemplateKWLoc,
3967 *DTN->getIdentifier(),
3968 NameLoc,
3969 ObjectType,
3970 FirstQualifierInScope,
3971 AllowInjectedClassName);
3972 }
3973
3974 return getDerived().RebuildTemplateName(SS, TemplateKWLoc,
3975 DTN->getOperator(), NameLoc,
3976 ObjectType, AllowInjectedClassName);
3977 }
3978
3979 if (TemplateDecl *Template = Name.getAsTemplateDecl()) {
3980 TemplateDecl *TransTemplate
3981 = cast_or_null<TemplateDecl>(getDerived().TransformDecl(NameLoc,
3982 Template));
3983 if (!TransTemplate)
3984 return TemplateName();
3985
3986 if (!getDerived().AlwaysRebuild() &&
3987 TransTemplate == Template)
3988 return Name;
3989
3990 return TemplateName(TransTemplate);
3991 }
3992
3993 if (SubstTemplateTemplateParmPackStorage *SubstPack
3994 = Name.getAsSubstTemplateTemplateParmPack()) {
3995 TemplateTemplateParmDecl *TransParam
3996 = cast_or_null<TemplateTemplateParmDecl>(
3997 getDerived().TransformDecl(NameLoc, SubstPack->getParameterPack()));
3998 if (!TransParam)
3999 return TemplateName();
4000
4001 if (!getDerived().AlwaysRebuild() &&
4002 TransParam == SubstPack->getParameterPack())
4003 return Name;
4004
4005 return getDerived().RebuildTemplateName(TransParam,
4006 SubstPack->getArgumentPack());
4007 }
4008
4009 // These should be getting filtered out before they reach the AST.
4010 llvm_unreachable("overloaded function decl survived to here");
4011 }
4012
4013 template<typename Derived>
4014 void TreeTransform<Derived>::InventTemplateArgumentLoc(
4015 const TemplateArgument &Arg,
4016 TemplateArgumentLoc &Output) {
4017 SourceLocation Loc = getDerived().getBaseLocation();
4018 switch (Arg.getKind()) {
4019 case TemplateArgument::Null:
4020 llvm_unreachable("null template argument in TreeTransform");
4021 break;
4022
4023 case TemplateArgument::Type:
4024 Output = TemplateArgumentLoc(Arg,
4025 SemaRef.Context.getTrivialTypeSourceInfo(Arg.getAsType(), Loc));
4026
4027 break;
4028
4029 case TemplateArgument::Template:
4030 case TemplateArgument::TemplateExpansion: {
4031 NestedNameSpecifierLocBuilder Builder;
4032 TemplateName Template = Arg.getAsTemplateOrTemplatePattern();
4033 if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
4034 Builder.MakeTrivial(SemaRef.Context, DTN->getQualifier(), Loc);
4035 else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
4036 Builder.MakeTrivial(SemaRef.Context, QTN->getQualifier(), Loc);
4037
4038 if (Arg.getKind() == TemplateArgument::Template)
4039 Output = TemplateArgumentLoc(Arg,
4040 Builder.getWithLocInContext(SemaRef.Context),
4041 Loc);
4042 else
4043 Output = TemplateArgumentLoc(Arg,
4044 Builder.getWithLocInContext(SemaRef.Context),
4045 Loc, Loc);
4046
4047 break;
4048 }
4049
4050 case TemplateArgument::Expression:
4051 Output = TemplateArgumentLoc(Arg, Arg.getAsExpr());
4052 break;
4053
4054 case TemplateArgument::Declaration:
4055 case TemplateArgument::Integral:
4056 case TemplateArgument::Pack:
4057 case TemplateArgument::NullPtr:
4058 Output = TemplateArgumentLoc(Arg, TemplateArgumentLocInfo());
4059 break;
4060 }
4061 }
4062
4063 template<typename Derived>
4064 bool TreeTransform<Derived>::TransformTemplateArgument(
4065 const TemplateArgumentLoc &Input,
4066 TemplateArgumentLoc &Output, bool Uneval) {
4067 const TemplateArgument &Arg = Input.getArgument();
4068 switch (Arg.getKind()) {
4069 case TemplateArgument::Null:
4070 case TemplateArgument::Integral:
4071 case TemplateArgument::Pack:
4072 case TemplateArgument::Declaration:
4073 case TemplateArgument::NullPtr:
4074 llvm_unreachable("Unexpected TemplateArgument");
4075
4076 case TemplateArgument::Type: {
4077 TypeSourceInfo *DI = Input.getTypeSourceInfo();
4078 if (!DI)
4079 DI = InventTypeSourceInfo(Input.getArgument().getAsType());
4080
4081 DI = getDerived().TransformType(DI);
4082 if (!DI) return true;
4083
4084 Output = TemplateArgumentLoc(TemplateArgument(DI->getType()), DI);
4085 return false;
4086 }
4087
4088 case TemplateArgument::Template: {
4089 NestedNameSpecifierLoc QualifierLoc = Input.getTemplateQualifierLoc();
4090 if (QualifierLoc) {
4091 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
4092 if (!QualifierLoc)
4093 return true;
4094 }
4095
4096 CXXScopeSpec SS;
4097 SS.Adopt(QualifierLoc);
4098 TemplateName Template
4099 = getDerived().TransformTemplateName(SS, Arg.getAsTemplate(),
4100 Input.getTemplateNameLoc());
4101 if (Template.isNull())
4102 return true;
4103
4104 Output = TemplateArgumentLoc(TemplateArgument(Template), QualifierLoc,
4105 Input.getTemplateNameLoc());
4106 return false;
4107 }
4108
4109 case TemplateArgument::TemplateExpansion:
4110 llvm_unreachable("Caller should expand pack expansions");
4111
4112 case TemplateArgument::Expression: {
4113 // Template argument expressions are constant expressions.
4114 EnterExpressionEvaluationContext Unevaluated(
4115 getSema(),
4116 Uneval ? Sema::ExpressionEvaluationContext::Unevaluated
4117 : Sema::ExpressionEvaluationContext::ConstantEvaluated,
4118 /*LambdaContextDecl=*/nullptr, /*ExprContext=*/
4119 Sema::ExpressionEvaluationContextRecord::EK_TemplateArgument);
4120
4121 Expr *InputExpr = Input.getSourceExpression();
4122 if (!InputExpr) InputExpr = Input.getArgument().getAsExpr();
4123
4124 ExprResult E = getDerived().TransformExpr(InputExpr);
4125 E = SemaRef.ActOnConstantExpression(E);
4126 if (E.isInvalid()) return true;
4127 Output = TemplateArgumentLoc(TemplateArgument(E.get()), E.get());
4128 return false;
4129 }
4130 }
4131
4132 // Work around bogus GCC warning
4133 return true;
4134 }
4135
4136 /// Iterator adaptor that invents template argument location information
4137 /// for each of the template arguments in its underlying iterator.
4138 template<typename Derived, typename InputIterator>
4139 class TemplateArgumentLocInventIterator {
4140 TreeTransform<Derived> &Self;
4141 InputIterator Iter;
4142
4143 public:
4144 typedef TemplateArgumentLoc value_type;
4145 typedef TemplateArgumentLoc reference;
4146 typedef typename std::iterator_traits<InputIterator>::difference_type
4147 difference_type;
4148 typedef std::input_iterator_tag iterator_category;
4149
4150 class pointer {
4151 TemplateArgumentLoc Arg;
4152
4153 public:
4154 explicit pointer(TemplateArgumentLoc Arg) : Arg(Arg) { }
4155
4156 const TemplateArgumentLoc *operator->() const { return &Arg; }
4157 };
4158
4159 TemplateArgumentLocInventIterator() { }
4160
4161 explicit TemplateArgumentLocInventIterator(TreeTransform<Derived> &Self,
4162 InputIterator Iter)
4163 : Self(Self), Iter(Iter) { }
4164
4165 TemplateArgumentLocInventIterator &operator++() {
4166 ++Iter;
4167 return *this;
4168 }
4169
4170 TemplateArgumentLocInventIterator operator++(int) {
4171 TemplateArgumentLocInventIterator Old(*this);
4172 ++(*this);
4173 return Old;
4174 }
4175
4176 reference operator*() const {
4177 TemplateArgumentLoc Result;
4178 Self.InventTemplateArgumentLoc(*Iter, Result);
4179 return Result;
4180 }
4181
4182 pointer operator->() const { return pointer(**this); }
4183
4184 friend bool operator==(const TemplateArgumentLocInventIterator &X,
4185 const TemplateArgumentLocInventIterator &Y) {
4186 return X.Iter == Y.Iter;
4187 }
4188
4189 friend bool operator!=(const TemplateArgumentLocInventIterator &X,
4190 const TemplateArgumentLocInventIterator &Y) {
4191 return X.Iter != Y.Iter;
4192 }
4193 };
4194
4195 template<typename Derived>
4196 template<typename InputIterator>
4197 bool TreeTransform<Derived>::TransformTemplateArguments(
4198 InputIterator First, InputIterator Last, TemplateArgumentListInfo &Outputs,
4199 bool Uneval) {
4200 for (; First != Last; ++First) {
4201 TemplateArgumentLoc Out;
4202 TemplateArgumentLoc In = *First;
4203
4204 if (In.getArgument().getKind() == TemplateArgument::Pack) {
4205 // Unpack argument packs, which we translate them into separate
4206 // arguments.
4207 // FIXME: We could do much better if we could guarantee that the
4208 // TemplateArgumentLocInfo for the pack expansion would be usable for
4209 // all of the template arguments in the argument pack.
4210 typedef TemplateArgumentLocInventIterator<Derived,
4211 TemplateArgument::pack_iterator>
4212 PackLocIterator;
4213 if (TransformTemplateArguments(PackLocIterator(*this,
4214 In.getArgument().pack_begin()),
4215 PackLocIterator(*this,
4216 In.getArgument().pack_end()),
4217 Outputs, Uneval))
4218 return true;
4219
4220 continue;
4221 }
4222
4223 if (In.getArgument().isPackExpansion()) {
4224 // We have a pack expansion, for which we will be substituting into
4225 // the pattern.
4226 SourceLocation Ellipsis;
4227 Optional<unsigned> OrigNumExpansions;
4228 TemplateArgumentLoc Pattern
4229 = getSema().getTemplateArgumentPackExpansionPattern(
4230 In, Ellipsis, OrigNumExpansions);
4231
4232 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
4233 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
4234 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
4235
4236 // Determine whether the set of unexpanded parameter packs can and should
4237 // be expanded.
4238 bool Expand = true;
4239 bool RetainExpansion = false;
4240 Optional<unsigned> NumExpansions = OrigNumExpansions;
4241 if (getDerived().TryExpandParameterPacks(Ellipsis,
4242 Pattern.getSourceRange(),
4243 Unexpanded,
4244 Expand,
4245 RetainExpansion,
4246 NumExpansions))
4247 return true;
4248
4249 if (!Expand) {
4250 // The transform has determined that we should perform a simple
4251 // transformation on the pack expansion, producing another pack
4252 // expansion.
4253 TemplateArgumentLoc OutPattern;
4254 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
4255 if (getDerived().TransformTemplateArgument(Pattern, OutPattern, Uneval))
4256 return true;
4257
4258 Out = getDerived().RebuildPackExpansion(OutPattern, Ellipsis,
4259 NumExpansions);
4260 if (Out.getArgument().isNull())
4261 return true;
4262
4263 Outputs.addArgument(Out);
4264 continue;
4265 }
4266
4267 // The transform has determined that we should perform an elementwise
4268 // expansion of the pattern. Do so.
4269 for (unsigned I = 0; I != *NumExpansions; ++I) {
4270 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
4271
4272 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4273 return true;
4274
4275 if (Out.getArgument().containsUnexpandedParameterPack()) {
4276 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4277 OrigNumExpansions);
4278 if (Out.getArgument().isNull())
4279 return true;
4280 }
4281
4282 Outputs.addArgument(Out);
4283 }
4284
4285 // If we're supposed to retain a pack expansion, do so by temporarily
4286 // forgetting the partially-substituted parameter pack.
4287 if (RetainExpansion) {
4288 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
4289
4290 if (getDerived().TransformTemplateArgument(Pattern, Out, Uneval))
4291 return true;
4292
4293 Out = getDerived().RebuildPackExpansion(Out, Ellipsis,
4294 OrigNumExpansions);
4295 if (Out.getArgument().isNull())
4296 return true;
4297
4298 Outputs.addArgument(Out);
4299 }
4300
4301 continue;
4302 }
4303
4304 // The simple case:
4305 if (getDerived().TransformTemplateArgument(In, Out, Uneval))
4306 return true;
4307
4308 Outputs.addArgument(Out);
4309 }
4310
4311 return false;
4312
4313 }
4314
4315 //===----------------------------------------------------------------------===//
4316 // Type transformation
4317 //===----------------------------------------------------------------------===//
4318
4319 template<typename Derived>
4320 QualType TreeTransform<Derived>::TransformType(QualType T) {
4321 if (getDerived().AlreadyTransformed(T))
4322 return T;
4323
4324 // Temporary workaround. All of these transformations should
4325 // eventually turn into transformations on TypeLocs.
4326 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(T,
4327 getDerived().getBaseLocation());
4328
4329 TypeSourceInfo *NewDI = getDerived().TransformType(DI);
4330
4331 if (!NewDI)
4332 return QualType();
4333
4334 return NewDI->getType();
4335 }
4336
4337 template<typename Derived>
4338 TypeSourceInfo *TreeTransform<Derived>::TransformType(TypeSourceInfo *DI) {
4339 // Refine the base location to the type's location.
4340 TemporaryBase Rebase(*this, DI->getTypeLoc().getBeginLoc(),
4341 getDerived().getBaseEntity());
4342 if (getDerived().AlreadyTransformed(DI->getType()))
4343 return DI;
4344
4345 TypeLocBuilder TLB;
4346
4347 TypeLoc TL = DI->getTypeLoc();
4348 TLB.reserve(TL.getFullDataSize());
4349
4350 QualType Result = getDerived().TransformType(TLB, TL);
4351 if (Result.isNull())
4352 return nullptr;
4353
4354 return TLB.getTypeSourceInfo(SemaRef.Context, Result);
4355 }
4356
4357 template<typename Derived>
4358 QualType
4359 TreeTransform<Derived>::TransformType(TypeLocBuilder &TLB, TypeLoc T) {
4360 switch (T.getTypeLocClass()) {
4361 #define ABSTRACT_TYPELOC(CLASS, PARENT)
4362 #define TYPELOC(CLASS, PARENT) \
4363 case TypeLoc::CLASS: \
4364 return getDerived().Transform##CLASS##Type(TLB, \
4365 T.castAs<CLASS##TypeLoc>());
4366 #include "clang/AST/TypeLocNodes.def"
4367 }
4368
4369 llvm_unreachable("unhandled type loc!");
4370 }
4371
4372 template<typename Derived>
4373 QualType TreeTransform<Derived>::TransformTypeWithDeducedTST(QualType T) {
4374 if (!isa<DependentNameType>(T))
4375 return TransformType(T);
4376
4377 if (getDerived().AlreadyTransformed(T))
4378 return T;
4379 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(T,
4380 getDerived().getBaseLocation());
4381 TypeSourceInfo *NewDI = getDerived().TransformTypeWithDeducedTST(DI);
4382 return NewDI ? NewDI->getType() : QualType();
4383 }
4384
4385 template<typename Derived>
4386 TypeSourceInfo *
4387 TreeTransform<Derived>::TransformTypeWithDeducedTST(TypeSourceInfo *DI) {
4388 if (!isa<DependentNameType>(DI->getType()))
4389 return TransformType(DI);
4390
4391 // Refine the base location to the type's location.
4392 TemporaryBase Rebase(*this, DI->getTypeLoc().getBeginLoc(),
4393 getDerived().getBaseEntity());
4394 if (getDerived().AlreadyTransformed(DI->getType()))
4395 return DI;
4396
4397 TypeLocBuilder TLB;
4398
4399 TypeLoc TL = DI->getTypeLoc();
4400 TLB.reserve(TL.getFullDataSize());
4401
4402 auto QTL = TL.getAs<QualifiedTypeLoc>();
4403 if (QTL)
4404 TL = QTL.getUnqualifiedLoc();
4405
4406 auto DNTL = TL.castAs<DependentNameTypeLoc>();
4407
4408 QualType Result = getDerived().TransformDependentNameType(
4409 TLB, DNTL, /*DeducedTSTContext*/true);
4410 if (Result.isNull())
4411 return nullptr;
4412
4413 if (QTL) {
4414 Result = getDerived().RebuildQualifiedType(Result, QTL);
4415 if (Result.isNull())
4416 return nullptr;
4417 TLB.TypeWasModifiedSafely(Result);
4418 }
4419
4420 return TLB.getTypeSourceInfo(SemaRef.Context, Result);
4421 }
4422
4423 template<typename Derived>
4424 QualType
4425 TreeTransform<Derived>::TransformQualifiedType(TypeLocBuilder &TLB,
4426 QualifiedTypeLoc T) {
4427 QualType Result = getDerived().TransformType(TLB, T.getUnqualifiedLoc());
4428 if (Result.isNull())
4429 return QualType();
4430
4431 Result = getDerived().RebuildQualifiedType(Result, T);
4432
4433 if (Result.isNull())
4434 return QualType();
4435
4436 // RebuildQualifiedType might have updated the type, but not in a way
4437 // that invalidates the TypeLoc. (There's no location information for
4438 // qualifiers.)
4439 TLB.TypeWasModifiedSafely(Result);
4440
4441 return Result;
4442 }
4443
4444 template <typename Derived>
4445 QualType TreeTransform<Derived>::RebuildQualifiedType(QualType T,
4446 QualifiedTypeLoc TL) {
4447
4448 SourceLocation Loc = TL.getBeginLoc();
4449 Qualifiers Quals = TL.getType().getLocalQualifiers();
4450
4451 if (((T.getAddressSpace() != LangAS::Default &&
4452 Quals.getAddressSpace() != LangAS::Default)) &&
4453 T.getAddressSpace() != Quals.getAddressSpace()) {
4454 SemaRef.Diag(Loc, diag::err_address_space_mismatch_templ_inst)
4455 << TL.getType() << T;
4456 return QualType();
4457 }
4458
4459 // C++ [dcl.fct]p7:
4460 // [When] adding cv-qualifications on top of the function type [...] the
4461 // cv-qualifiers are ignored.
4462 if (T->isFunctionType()) {
4463 T = SemaRef.getASTContext().getAddrSpaceQualType(T,
4464 Quals.getAddressSpace());
4465 return T;
4466 }
4467
4468 // C++ [dcl.ref]p1:
4469 // when the cv-qualifiers are introduced through the use of a typedef-name
4470 // or decltype-specifier [...] the cv-qualifiers are ignored.
4471 // Note that [dcl.ref]p1 lists all cases in which cv-qualifiers can be
4472 // applied to a reference type.
4473 if (T->isReferenceType()) {
4474 // The only qualifier that applies to a reference type is restrict.
4475 if (!Quals.hasRestrict())
4476 return T;
4477 Quals = Qualifiers::fromCVRMask(Qualifiers::Restrict);
4478 }
4479
4480 // Suppress Objective-C lifetime qualifiers if they don't make sense for the
4481 // resulting type.
4482 if (Quals.hasObjCLifetime()) {
4483 if (!T->isObjCLifetimeType() && !T->isDependentType())
4484 Quals.removeObjCLifetime();
4485 else if (T.getObjCLifetime()) {
4486 // Objective-C ARC:
4487 // A lifetime qualifier applied to a substituted template parameter
4488 // overrides the lifetime qualifier from the template argument.
4489 const AutoType *AutoTy;
4490 if (const SubstTemplateTypeParmType *SubstTypeParam
4491 = dyn_cast<SubstTemplateTypeParmType>(T)) {
4492 QualType Replacement = SubstTypeParam->getReplacementType();
4493 Qualifiers Qs = Replacement.getQualifiers();
4494 Qs.removeObjCLifetime();
4495 Replacement = SemaRef.Context.getQualifiedType(
4496 Replacement.getUnqualifiedType(), Qs);
4497 T = SemaRef.Context.getSubstTemplateTypeParmType(
4498 SubstTypeParam->getReplacedParameter(), Replacement);
4499 } else if ((AutoTy = dyn_cast<AutoType>(T)) && AutoTy->isDeduced()) {
4500 // 'auto' types behave the same way as template parameters.
4501 QualType Deduced = AutoTy->getDeducedType();
4502 Qualifiers Qs = Deduced.getQualifiers();
4503 Qs.removeObjCLifetime();
4504 Deduced =
4505 SemaRef.Context.getQualifiedType(Deduced.getUnqualifiedType(), Qs);
4506 T = SemaRef.Context.getAutoType(Deduced, AutoTy->getKeyword(),
4507 AutoTy->isDependentType(),
4508 /*isPack=*/false,
4509 AutoTy->getTypeConstraintConcept(),
4510 AutoTy->getTypeConstraintArguments());
4511 } else {
4512 // Otherwise, complain about the addition of a qualifier to an
4513 // already-qualified type.
4514 // FIXME: Why is this check not in Sema::BuildQualifiedType?
4515 SemaRef.Diag(Loc, diag::err_attr_objc_ownership_redundant) << T;
4516 Quals.removeObjCLifetime();
4517 }
4518 }
4519 }
4520
4521 return SemaRef.BuildQualifiedType(T, Loc, Quals);
4522 }
4523
4524 template<typename Derived>
4525 TypeLoc
4526 TreeTransform<Derived>::TransformTypeInObjectScope(TypeLoc TL,
4527 QualType ObjectType,
4528 NamedDecl *UnqualLookup,
4529 CXXScopeSpec &SS) {
4530 if (getDerived().AlreadyTransformed(TL.getType()))
4531 return TL;
4532
4533 TypeSourceInfo *TSI =
4534 TransformTSIInObjectScope(TL, ObjectType, UnqualLookup, SS);
4535 if (TSI)
4536 return TSI->getTypeLoc();
4537 return TypeLoc();
4538 }
4539
4540 template<typename Derived>
4541 TypeSourceInfo *
4542 TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
4543 QualType ObjectType,
4544 NamedDecl *UnqualLookup,
4545 CXXScopeSpec &SS) {
4546 if (getDerived().AlreadyTransformed(TSInfo->getType()))
4547 return TSInfo;
4548
4549 return TransformTSIInObjectScope(TSInfo->getTypeLoc(), ObjectType,
4550 UnqualLookup, SS);
4551 }
4552
4553 template <typename Derived>
4554 TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
4555 TypeLoc TL, QualType ObjectType, NamedDecl *UnqualLookup,
4556 CXXScopeSpec &SS) {
4557 QualType T = TL.getType();
4558 assert(!getDerived().AlreadyTransformed(T));
4559
4560 TypeLocBuilder TLB;
4561 QualType Result;
4562
4563 if (isa<TemplateSpecializationType>(T)) {
4564 TemplateSpecializationTypeLoc SpecTL =
4565 TL.castAs<TemplateSpecializationTypeLoc>();
4566
4567 TemplateName Template = getDerived().TransformTemplateName(
4568 SS, SpecTL.getTypePtr()->getTemplateName(), SpecTL.getTemplateNameLoc(),
4569 ObjectType, UnqualLookup, /*AllowInjectedClassName*/true);
4570 if (Template.isNull())
4571 return nullptr;
4572
4573 Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
4574 Template);
4575 } else if (isa<DependentTemplateSpecializationType>(T)) {
4576 DependentTemplateSpecializationTypeLoc SpecTL =
4577 TL.castAs<DependentTemplateSpecializationTypeLoc>();
4578
4579 TemplateName Template
4580 = getDerived().RebuildTemplateName(SS,
4581 SpecTL.getTemplateKeywordLoc(),
4582 *SpecTL.getTypePtr()->getIdentifier(),
4583 SpecTL.getTemplateNameLoc(),
4584 ObjectType, UnqualLookup,
4585 /*AllowInjectedClassName*/true);
4586 if (Template.isNull())
4587 return nullptr;
4588
4589 Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
4590 SpecTL,
4591 Template,
4592 SS);
4593 } else {
4594 // Nothing special needs to be done for these.
4595 Result = getDerived().TransformType(TLB, TL);
4596 }
4597
4598 if (Result.isNull())
4599 return nullptr;
4600
4601 return TLB.getTypeSourceInfo(SemaRef.Context, Result);
4602 }
4603
4604 template <class TyLoc> static inline
4605 QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T) {
4606 TyLoc NewT = TLB.push<TyLoc>(T.getType());
4607 NewT.setNameLoc(T.getNameLoc());
4608 return T.getType();
4609 }
4610
4611 template<typename Derived>
4612 QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
4613 BuiltinTypeLoc T) {
4614 BuiltinTypeLoc NewT = TLB.push<BuiltinTypeLoc>(T.getType());
4615 NewT.setBuiltinLoc(T.getBuiltinLoc());
4616 if (T.needsExtraLocalData())
4617 NewT.getWrittenBuiltinSpecs() = T.getWrittenBuiltinSpecs();
4618 return T.getType();
4619 }
4620
4621 template<typename Derived>
4622 QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
4623 ComplexTypeLoc T) {
4624 // FIXME: recurse?
4625 return TransformTypeSpecType(TLB, T);
4626 }
4627
4628 template <typename Derived>
4629 QualType TreeTransform<Derived>::TransformAdjustedType(TypeLocBuilder &TLB,
4630 AdjustedTypeLoc TL) {
4631 // Adjustments applied during transformation are handled elsewhere.
4632 return getDerived().TransformType(TLB, TL.getOriginalLoc());
4633 }
4634
4635 template<typename Derived>
4636 QualType TreeTransform<Derived>::TransformDecayedType(TypeLocBuilder &TLB,
4637 DecayedTypeLoc TL) {
4638 QualType OriginalType = getDerived().TransformType(TLB, TL.getOriginalLoc());
4639 if (OriginalType.isNull())
4640 return QualType();
4641
4642 QualType Result = TL.getType();
4643 if (getDerived().AlwaysRebuild() ||
4644 OriginalType != TL.getOriginalLoc().getType())
4645 Result = SemaRef.Context.getDecayedType(OriginalType);
4646 TLB.push<DecayedTypeLoc>(Result);
4647 // Nothing to set for DecayedTypeLoc.
4648 return Result;
4649 }
4650
4651 template<typename Derived>
4652 QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB,
4653 PointerTypeLoc TL) {
4654 QualType PointeeType
4655 = getDerived().TransformType(TLB, TL.getPointeeLoc());
4656 if (PointeeType.isNull())
4657 return QualType();
4658
4659 QualType Result = TL.getType();
4660 if (PointeeType->getAs<ObjCObjectType>()) {
4661 // A dependent pointer type 'T *' has is being transformed such
4662 // that an Objective-C class type is being replaced for 'T'. The
4663 // resulting pointer type is an ObjCObjectPointerType, not a
4664 // PointerType.
4665 Result = SemaRef.Context.getObjCObjectPointerType(PointeeType);
4666
4667 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(Result);
4668 NewT.setStarLoc(TL.getStarLoc());
4669 return Result;
4670 }
4671
4672 if (getDerived().AlwaysRebuild() ||
4673 PointeeType != TL.getPointeeLoc().getType()) {
4674 Result = getDerived().RebuildPointerType(PointeeType, TL.getSigilLoc());
4675 if (Result.isNull())
4676 return QualType();
4677 }
4678
4679 // Objective-C ARC can add lifetime qualifiers to the type that we're
4680 // pointing to.
4681 TLB.TypeWasModifiedSafely(Result->getPointeeType());
4682
4683 PointerTypeLoc NewT = TLB.push<PointerTypeLoc>(Result);
4684 NewT.setSigilLoc(TL.getSigilLoc());
4685 return Result;
4686 }
4687
4688 template<typename Derived>
4689 QualType
4690 TreeTransform<Derived>::TransformBlockPointerType(TypeLocBuilder &TLB,
4691 BlockPointerTypeLoc TL) {
4692 QualType PointeeType
4693 = getDerived().TransformType(TLB, TL.getPointeeLoc());
4694 if (PointeeType.isNull())
4695 return QualType();
4696
4697 QualType Result = TL.getType();
4698 if (getDerived().AlwaysRebuild() ||
4699 PointeeType != TL.getPointeeLoc().getType()) {
4700 Result = getDerived().RebuildBlockPointerType(PointeeType,
4701 TL.getSigilLoc());
4702 if (Result.isNull())
4703 return QualType();
4704 }
4705
4706 BlockPointerTypeLoc NewT = TLB.push<BlockPointerTypeLoc>(Result);
4707 NewT.setSigilLoc(TL.getSigilLoc());
4708 return Result;
4709 }
4710
4711 /// Transforms a reference type. Note that somewhat paradoxically we
4712 /// don't care whether the type itself is an l-value type or an r-value
4713 /// type; we only care if the type was *written* as an l-value type
4714 /// or an r-value type.
4715 template<typename Derived>
4716 QualType
4717 TreeTransform<Derived>::TransformReferenceType(TypeLocBuilder &TLB,
4718 ReferenceTypeLoc TL) {
4719 const ReferenceType *T = TL.getTypePtr();
4720
4721 // Note that this works with the pointee-as-written.
4722 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
4723 if (PointeeType.isNull())
4724 return QualType();
4725
4726 QualType Result = TL.getType();
4727 if (getDerived().AlwaysRebuild() ||
4728 PointeeType != T->getPointeeTypeAsWritten()) {
4729 Result = getDerived().RebuildReferenceType(PointeeType,
4730 T->isSpelledAsLValue(),
4731 TL.getSigilLoc());
4732 if (Result.isNull())
4733 return QualType();
4734 }
4735
4736 // Objective-C ARC can add lifetime qualifiers to the type that we're
4737 // referring to.
4738 TLB.TypeWasModifiedSafely(
4739 Result->castAs<ReferenceType>()->getPointeeTypeAsWritten());
4740
4741 // r-value references can be rebuilt as l-value references.
4742 ReferenceTypeLoc NewTL;
4743 if (isa<LValueReferenceType>(Result))
4744 NewTL = TLB.push<LValueReferenceTypeLoc>(Result);
4745 else
4746 NewTL = TLB.push<RValueReferenceTypeLoc>(Result);
4747 NewTL.setSigilLoc(TL.getSigilLoc());
4748
4749 return Result;
4750 }
4751
4752 template<typename Derived>
4753 QualType
4754 TreeTransform<Derived>::TransformLValueReferenceType(TypeLocBuilder &TLB,
4755 LValueReferenceTypeLoc TL) {
4756 return TransformReferenceType(TLB, TL);
4757 }
4758
4759 template<typename Derived>
4760 QualType
4761 TreeTransform<Derived>::TransformRValueReferenceType(TypeLocBuilder &TLB,
4762 RValueReferenceTypeLoc TL) {
4763 return TransformReferenceType(TLB, TL);
4764 }
4765
4766 template<typename Derived>
4767 QualType
4768 TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
4769 MemberPointerTypeLoc TL) {
4770 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
4771 if (PointeeType.isNull())
4772 return QualType();
4773
4774 TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
4775 TypeSourceInfo *NewClsTInfo = nullptr;
4776 if (OldClsTInfo) {
4777 NewClsTInfo = getDerived().TransformType(OldClsTInfo);
4778 if (!NewClsTInfo)
4779 return QualType();
4780 }
4781
4782 const MemberPointerType *T = TL.getTypePtr();
4783 QualType OldClsType = QualType(T->getClass(), 0);
4784 QualType NewClsType;
4785 if (NewClsTInfo)
4786 NewClsType = NewClsTInfo->getType();
4787 else {
4788 NewClsType = getDerived().TransformType(OldClsType);
4789 if (NewClsType.isNull())
4790 return QualType();
4791 }
4792
4793 QualType Result = TL.getType();
4794 if (getDerived().AlwaysRebuild() ||
4795 PointeeType != T->getPointeeType() ||
4796 NewClsType != OldClsType) {
4797 Result = getDerived().RebuildMemberPointerType(PointeeType, NewClsType,
4798 TL.getStarLoc());
4799 if (Result.isNull())
4800 return QualType();
4801 }
4802
4803 // If we had to adjust the pointee type when building a member pointer, make
4804 // sure to push TypeLoc info for it.
4805 const MemberPointerType *MPT = Result->getAs<MemberPointerType>();
4806 if (MPT && PointeeType != MPT->getPointeeType()) {
4807 assert(isa<AdjustedType>(MPT->getPointeeType()));
4808 TLB.push<AdjustedTypeLoc>(MPT->getPointeeType());
4809 }
4810
4811 MemberPointerTypeLoc NewTL = TLB.push<MemberPointerTypeLoc>(Result);
4812 NewTL.setSigilLoc(TL.getSigilLoc());
4813 NewTL.setClassTInfo(NewClsTInfo);
4814
4815 return Result;
4816 }
4817
4818 template<typename Derived>
4819 QualType
4820 TreeTransform<Derived>::TransformConstantArrayType(TypeLocBuilder &TLB,
4821 ConstantArrayTypeLoc TL) {
4822 const ConstantArrayType *T = TL.getTypePtr();
4823 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
4824 if (ElementType.isNull())
4825 return QualType();
4826
4827 // Prefer the expression from the TypeLoc; the other may have been uniqued.
4828 Expr *OldSize = TL.getSizeExpr();
4829 if (!OldSize)
4830 OldSize = const_cast<Expr*>(T->getSizeExpr());
4831 Expr *NewSize = nullptr;
4832 if (OldSize) {
4833 EnterExpressionEvaluationContext Unevaluated(
4834 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
4835 NewSize = getDerived().TransformExpr(OldSize).template getAs<Expr>();
4836 NewSize = SemaRef.ActOnConstantExpression(NewSize).get();
4837 }
4838
4839 QualType Result = TL.getType();
4840 if (getDerived().AlwaysRebuild() ||
4841 ElementType != T->getElementType() ||
4842 (T->getSizeExpr() && NewSize != OldSize)) {
4843 Result = getDerived().RebuildConstantArrayType(ElementType,
4844 T->getSizeModifier(),
4845 T->getSize(), NewSize,
4846 T->getIndexTypeCVRQualifiers(),
4847 TL.getBracketsRange());
4848 if (Result.isNull())
4849 return QualType();
4850 }
4851
4852 // We might have either a ConstantArrayType or a VariableArrayType now:
4853 // a ConstantArrayType is allowed to have an element type which is a
4854 // VariableArrayType if the type is dependent. Fortunately, all array
4855 // types have the same location layout.
4856 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
4857 NewTL.setLBracketLoc(TL.getLBracketLoc());
4858 NewTL.setRBracketLoc(TL.getRBracketLoc());
4859 NewTL.setSizeExpr(NewSize);
4860
4861 return Result;
4862 }
4863
4864 template<typename Derived>
4865 QualType TreeTransform<Derived>::TransformIncompleteArrayType(
4866 TypeLocBuilder &TLB,
4867 IncompleteArrayTypeLoc TL) {
4868 const IncompleteArrayType *T = TL.getTypePtr();
4869 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
4870 if (ElementType.isNull())
4871 return QualType();
4872
4873 QualType Result = TL.getType();
4874 if (getDerived().AlwaysRebuild() ||
4875 ElementType != T->getElementType()) {
4876 Result = getDerived().RebuildIncompleteArrayType(ElementType,
4877 T->getSizeModifier(),
4878 T->getIndexTypeCVRQualifiers(),
4879 TL.getBracketsRange());
4880 if (Result.isNull())
4881 return QualType();
4882 }
4883
4884 IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(Result);
4885 NewTL.setLBracketLoc(TL.getLBracketLoc());
4886 NewTL.setRBracketLoc(TL.getRBracketLoc());
4887 NewTL.setSizeExpr(nullptr);
4888
4889 return Result;
4890 }
4891
4892 template<typename Derived>
4893 QualType
4894 TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB,
4895 VariableArrayTypeLoc TL) {
4896 const VariableArrayType *T = TL.getTypePtr();
4897 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
4898 if (ElementType.isNull())
4899 return QualType();
4900
4901 ExprResult SizeResult;
4902 {
4903 EnterExpressionEvaluationContext Context(
4904 SemaRef, Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
4905 SizeResult = getDerived().TransformExpr(T->getSizeExpr());
4906 }
4907 if (SizeResult.isInvalid())
4908 return QualType();
4909 SizeResult =
4910 SemaRef.ActOnFinishFullExpr(SizeResult.get(), /*DiscardedValue*/ false);
4911 if (SizeResult.isInvalid())
4912 return QualType();
4913
4914 Expr *Size = SizeResult.get();
4915
4916 QualType Result = TL.getType();
4917 if (getDerived().AlwaysRebuild() ||
4918 ElementType != T->getElementType() ||
4919 Size != T->getSizeExpr()) {
4920 Result = getDerived().RebuildVariableArrayType(ElementType,
4921 T->getSizeModifier(),
4922 Size,
4923 T->getIndexTypeCVRQualifiers(),
4924 TL.getBracketsRange());
4925 if (Result.isNull())
4926 return QualType();
4927 }
4928
4929 // We might have constant size array now, but fortunately it has the same
4930 // location layout.
4931 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
4932 NewTL.setLBracketLoc(TL.getLBracketLoc());
4933 NewTL.setRBracketLoc(TL.getRBracketLoc());
4934 NewTL.setSizeExpr(Size);
4935
4936 return Result;
4937 }
4938
4939 template<typename Derived>
4940 QualType
4941 TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB,
4942 DependentSizedArrayTypeLoc TL) {
4943 const DependentSizedArrayType *T = TL.getTypePtr();
4944 QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
4945 if (ElementType.isNull())
4946 return QualType();
4947
4948 // Array bounds are constant expressions.
4949 EnterExpressionEvaluationContext Unevaluated(
4950 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
4951
4952 // Prefer the expression from the TypeLoc; the other may have been uniqued.
4953 Expr *origSize = TL.getSizeExpr();
4954 if (!origSize) origSize = T->getSizeExpr();
4955
4956 ExprResult sizeResult
4957 = getDerived().TransformExpr(origSize);
4958 sizeResult = SemaRef.ActOnConstantExpression(sizeResult);
4959 if (sizeResult.isInvalid())
4960 return QualType();
4961
4962 Expr *size = sizeResult.get();
4963
4964 QualType Result = TL.getType();
4965 if (getDerived().AlwaysRebuild() ||
4966 ElementType != T->getElementType() ||
4967 size != origSize) {
4968 Result = getDerived().RebuildDependentSizedArrayType(ElementType,
4969 T->getSizeModifier(),
4970 size,
4971 T->getIndexTypeCVRQualifiers(),
4972 TL.getBracketsRange());
4973 if (Result.isNull())
4974 return QualType();
4975 }
4976
4977 // We might have any sort of array type now, but fortunately they
4978 // all have the same location layout.
4979 ArrayTypeLoc NewTL = TLB.push<ArrayTypeLoc>(Result);
4980 NewTL.setLBracketLoc(TL.getLBracketLoc());
4981 NewTL.setRBracketLoc(TL.getRBracketLoc());
4982 NewTL.setSizeExpr(size);
4983
4984 return Result;
4985 }
4986
4987 template <typename Derived>
4988 QualType TreeTransform<Derived>::TransformDependentVectorType(
4989 TypeLocBuilder &TLB, DependentVectorTypeLoc TL) {
4990 const DependentVectorType *T = TL.getTypePtr();
4991 QualType ElementType = getDerived().TransformType(T->getElementType());
4992 if (ElementType.isNull())
4993 return QualType();
4994
4995 EnterExpressionEvaluationContext Unevaluated(
4996 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
4997
4998 ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
4999 Size = SemaRef.ActOnConstantExpression(Size);
5000 if (Size.isInvalid())
5001 return QualType();
5002
5003 QualType Result = TL.getType();
5004 if (getDerived().AlwaysRebuild() || ElementType != T->getElementType() ||
5005 Size.get() != T->getSizeExpr()) {
5006 Result = getDerived().RebuildDependentVectorType(
5007 ElementType, Size.get(), T->getAttributeLoc(), T->getVectorKind());
5008 if (Result.isNull())
5009 return QualType();
5010 }
5011
5012 // Result might be dependent or not.
5013 if (isa<DependentVectorType>(Result)) {
5014 DependentVectorTypeLoc NewTL =
5015 TLB.push<DependentVectorTypeLoc>(Result);
5016 NewTL.setNameLoc(TL.getNameLoc());
5017 } else {
5018 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(Result);
5019 NewTL.setNameLoc(TL.getNameLoc());
5020 }
5021
5022 return Result;
5023 }
5024
5025 template<typename Derived>
5026 QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
5027 TypeLocBuilder &TLB,
5028 DependentSizedExtVectorTypeLoc TL) {
5029 const DependentSizedExtVectorType *T = TL.getTypePtr();
5030
5031 // FIXME: ext vector locs should be nested
5032 QualType ElementType = getDerived().TransformType(T->getElementType());
5033 if (ElementType.isNull())
5034 return QualType();
5035
5036 // Vector sizes are constant expressions.
5037 EnterExpressionEvaluationContext Unevaluated(
5038 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
5039
5040 ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
5041 Size = SemaRef.ActOnConstantExpression(Size);
5042 if (Size.isInvalid())
5043 return QualType();
5044
5045 QualType Result = TL.getType();
5046 if (getDerived().AlwaysRebuild() ||
5047 ElementType != T->getElementType() ||
5048 Size.get() != T->getSizeExpr()) {
5049 Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
5050 Size.get(),
5051 T->getAttributeLoc());
5052 if (Result.isNull())
5053 return QualType();
5054 }
5055
5056 // Result might be dependent or not.
5057 if (isa<DependentSizedExtVectorType>(Result)) {
5058 DependentSizedExtVectorTypeLoc NewTL
5059 = TLB.push<DependentSizedExtVectorTypeLoc>(Result);
5060 NewTL.setNameLoc(TL.getNameLoc());
5061 } else {
5062 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(Result);
5063 NewTL.setNameLoc(TL.getNameLoc());
5064 }
5065
5066 return Result;
5067 }
5068
5069 template <typename Derived>
5070 QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
5071 TypeLocBuilder &TLB, DependentAddressSpaceTypeLoc TL) {
5072 const DependentAddressSpaceType *T = TL.getTypePtr();
5073
5074 QualType pointeeType = getDerived().TransformType(T->getPointeeType());
5075
5076 if (pointeeType.isNull())
5077 return QualType();
5078
5079 // Address spaces are constant expressions.
5080 EnterExpressionEvaluationContext Unevaluated(
5081 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
5082
5083 ExprResult AddrSpace = getDerived().TransformExpr(T->getAddrSpaceExpr());
5084 AddrSpace = SemaRef.ActOnConstantExpression(AddrSpace);
5085 if (AddrSpace.isInvalid())
5086 return QualType();
5087
5088 QualType Result = TL.getType();
5089 if (getDerived().AlwaysRebuild() || pointeeType != T->getPointeeType() ||
5090 AddrSpace.get() != T->getAddrSpaceExpr()) {
5091 Result = getDerived().RebuildDependentAddressSpaceType(
5092 pointeeType, AddrSpace.get(), T->getAttributeLoc());
5093 if (Result.isNull())
5094 return QualType();
5095 }
5096
5097 // Result might be dependent or not.
5098 if (isa<DependentAddressSpaceType>(Result)) {
5099 DependentAddressSpaceTypeLoc NewTL =
5100 TLB.push<DependentAddressSpaceTypeLoc>(Result);
5101
5102 NewTL.setAttrOperandParensRange(TL.getAttrOperandParensRange());
5103 NewTL.setAttrExprOperand(TL.getAttrExprOperand());
5104 NewTL.setAttrNameLoc(TL.getAttrNameLoc());
5105
5106 } else {
5107 TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(
5108 Result, getDerived().getBaseLocation());
5109 TransformType(TLB, DI->getTypeLoc());
5110 }
5111
5112 return Result;
5113 }
5114
5115 template <typename Derived>
5116 QualType TreeTransform<Derived>::TransformVectorType(TypeLocBuilder &TLB,
5117 VectorTypeLoc TL) {
5118 const VectorType *T = TL.getTypePtr();
5119 QualType ElementType = getDerived().TransformType(T->getElementType());
5120 if (ElementType.isNull())
5121 return QualType();
5122
5123 QualType Result = TL.getType();
5124 if (getDerived().AlwaysRebuild() ||
5125 ElementType != T->getElementType()) {
5126 Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
5127 T->getVectorKind());
5128 if (Result.isNull())
5129 return QualType();
5130 }
5131
5132 VectorTypeLoc NewTL = TLB.push<VectorTypeLoc>(Result);
5133 NewTL.setNameLoc(TL.getNameLoc());
5134
5135 return Result;
5136 }
5137
5138 template<typename Derived>
5139 QualType TreeTransform<Derived>::TransformExtVectorType(TypeLocBuilder &TLB,
5140 ExtVectorTypeLoc TL) {
5141 const VectorType *T = TL.getTypePtr();
5142 QualType ElementType = getDerived().TransformType(T->getElementType());
5143 if (ElementType.isNull())
5144 return QualType();
5145
5146 QualType Result = TL.getType();
5147 if (getDerived().AlwaysRebuild() ||
5148 ElementType != T->getElementType()) {
5149 Result = getDerived().RebuildExtVectorType(ElementType,
5150 T->getNumElements(),
5151 /*FIXME*/ SourceLocation());
5152 if (Result.isNull())
5153 return QualType();
5154 }
5155
5156 ExtVectorTypeLoc NewTL = TLB.push<ExtVectorTypeLoc>(Result);
5157 NewTL.setNameLoc(TL.getNameLoc());
5158
5159 return Result;
5160 }
5161
5162 template <typename Derived>
5163 ParmVarDecl *TreeTransform<Derived>::TransformFunctionTypeParam(
5164 ParmVarDecl *OldParm, int indexAdjustment, Optional<unsigned> NumExpansions,
5165 bool ExpectParameterPack) {
5166 TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
5167 TypeSourceInfo *NewDI = nullptr;
5168
5169 if (NumExpansions && isa<PackExpansionType>(OldDI->getType())) {
5170 // If we're substituting into a pack expansion type and we know the
5171 // length we want to expand to, just substitute for the pattern.
5172 TypeLoc OldTL = OldDI->getTypeLoc();
5173 PackExpansionTypeLoc OldExpansionTL = OldTL.castAs<PackExpansionTypeLoc>();
5174
5175 TypeLocBuilder TLB;
5176 TypeLoc NewTL = OldDI->getTypeLoc();
5177 TLB.reserve(NewTL.getFullDataSize());
5178
5179 QualType Result = getDerived().TransformType(TLB,
5180 OldExpansionTL.getPatternLoc());
5181 if (Result.isNull())
5182 return nullptr;
5183
5184 Result = RebuildPackExpansionType(Result,
5185 OldExpansionTL.getPatternLoc().getSourceRange(),
5186 OldExpansionTL.getEllipsisLoc(),
5187 NumExpansions);
5188 if (Result.isNull())
5189 return nullptr;
5190
5191 PackExpansionTypeLoc NewExpansionTL
5192 = TLB.push<PackExpansionTypeLoc>(Result);
5193 NewExpansionTL.setEllipsisLoc(OldExpansionTL.getEllipsisLoc());
5194 NewDI = TLB.getTypeSourceInfo(SemaRef.Context, Result);
5195 } else
5196 NewDI = getDerived().TransformType(OldDI);
5197 if (!NewDI)
5198 return nullptr;
5199
5200 if (NewDI == OldDI && indexAdjustment == 0)
5201 return OldParm;
5202
5203 ParmVarDecl *newParm = ParmVarDecl::Create(SemaRef.Context,
5204 OldParm->getDeclContext(),
5205 OldParm->getInnerLocStart(),
5206 OldParm->getLocation(),
5207 OldParm->getIdentifier(),
5208 NewDI->getType(),
5209 NewDI,
5210 OldParm->getStorageClass(),
5211 /* DefArg */ nullptr);
5212 newParm->setScopeInfo(OldParm->getFunctionScopeDepth(),
5213 OldParm->getFunctionScopeIndex() + indexAdjustment);
5214 return newParm;
5215 }
5216
5217 template <typename Derived>
5218 bool TreeTransform<Derived>::TransformFunctionTypeParams(
5219 SourceLocation Loc, ArrayRef<ParmVarDecl *> Params,
5220 const QualType *ParamTypes,
5221 const FunctionProtoType::ExtParameterInfo *ParamInfos,
5222 SmallVectorImpl<QualType> &OutParamTypes,
5223 SmallVectorImpl<ParmVarDecl *> *PVars,
5224 Sema::ExtParameterInfoBuilder &PInfos) {
5225 int indexAdjustment = 0;
5226
5227 unsigned NumParams = Params.size();
5228 for (unsigned i = 0; i != NumParams; ++i) {
5229 if (ParmVarDecl *OldParm = Params[i]) {
5230 assert(OldParm->getFunctionScopeIndex() == i);
5231
5232 Optional<unsigned> NumExpansions;
5233 ParmVarDecl *NewParm = nullptr;
5234 if (OldParm->isParameterPack()) {
5235 // We have a function parameter pack that may need to be expanded.
5236 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
5237
5238 // Find the parameter packs that could be expanded.
5239 TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
5240 PackExpansionTypeLoc ExpansionTL = TL.castAs<PackExpansionTypeLoc>();
5241 TypeLoc Pattern = ExpansionTL.getPatternLoc();
5242 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
5243
5244 // Determine whether we should expand the parameter packs.
5245 bool ShouldExpand = false;
5246 bool RetainExpansion = false;
5247 Optional<unsigned> OrigNumExpansions;
5248 if (Unexpanded.size() > 0) {
5249 OrigNumExpansions = ExpansionTL.getTypePtr()->getNumExpansions();
5250 NumExpansions = OrigNumExpansions;
5251 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
5252 Pattern.getSourceRange(),
5253 Unexpanded,
5254 ShouldExpand,
5255 RetainExpansion,
5256 NumExpansions)) {
5257 return true;
5258 }
5259 } else {
5260 #ifndef NDEBUG
5261 const AutoType *AT =
5262 Pattern.getType().getTypePtr()->getContainedAutoType();
5263 assert((AT && (!AT->isDeduced() || AT->getDeducedType().isNull())) &&
5264 "Could not find parameter packs or undeduced auto type!");
5265 #endif
5266 }
5267
5268 if (ShouldExpand) {
5269 // Expand the function parameter pack into multiple, separate
5270 // parameters.
5271 getDerived().ExpandingFunctionParameterPack(OldParm);
5272 for (unsigned I = 0; I != *NumExpansions; ++I) {
5273 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
5274 ParmVarDecl *NewParm
5275 = getDerived().TransformFunctionTypeParam(OldParm,
5276 indexAdjustment++,
5277 OrigNumExpansions,
5278 /*ExpectParameterPack=*/false);
5279 if (!NewParm)
5280 return true;
5281
5282 if (ParamInfos)
5283 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5284 OutParamTypes.push_back(NewParm->getType());
5285 if (PVars)
5286 PVars->push_back(NewParm);
5287 }
5288
5289 // If we're supposed to retain a pack expansion, do so by temporarily
5290 // forgetting the partially-substituted parameter pack.
5291 if (RetainExpansion) {
5292 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5293 ParmVarDecl *NewParm
5294 = getDerived().TransformFunctionTypeParam(OldParm,
5295 indexAdjustment++,
5296 OrigNumExpansions,
5297 /*ExpectParameterPack=*/false);
5298 if (!NewParm)
5299 return true;
5300
5301 if (ParamInfos)
5302 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5303 OutParamTypes.push_back(NewParm->getType());
5304 if (PVars)
5305 PVars->push_back(NewParm);
5306 }
5307
5308 // The next parameter should have the same adjustment as the
5309 // last thing we pushed, but we post-incremented indexAdjustment
5310 // on every push. Also, if we push nothing, the adjustment should
5311 // go down by one.
5312 indexAdjustment--;
5313
5314 // We're done with the pack expansion.
5315 continue;
5316 }
5317
5318 // We'll substitute the parameter now without expanding the pack
5319 // expansion.
5320 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
5321 NewParm = getDerived().TransformFunctionTypeParam(OldParm,
5322 indexAdjustment,
5323 NumExpansions,
5324 /*ExpectParameterPack=*/true);
5325 assert(NewParm->isParameterPack() &&
5326 "Parameter pack no longer a parameter pack after "
5327 "transformation.");
5328 } else {
5329 NewParm = getDerived().TransformFunctionTypeParam(
5330 OldParm, indexAdjustment, None, /*ExpectParameterPack=*/ false);
5331 }
5332
5333 if (!NewParm)
5334 return true;
5335
5336 if (ParamInfos)
5337 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5338 OutParamTypes.push_back(NewParm->getType());
5339 if (PVars)
5340 PVars->push_back(NewParm);
5341 continue;
5342 }
5343
5344 // Deal with the possibility that we don't have a parameter
5345 // declaration for this parameter.
5346 QualType OldType = ParamTypes[i];
5347 bool IsPackExpansion = false;
5348 Optional<unsigned> NumExpansions;
5349 QualType NewType;
5350 if (const PackExpansionType *Expansion
5351 = dyn_cast<PackExpansionType>(OldType)) {
5352 // We have a function parameter pack that may need to be expanded.
5353 QualType Pattern = Expansion->getPattern();
5354 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
5355 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
5356
5357 // Determine whether we should expand the parameter packs.
5358 bool ShouldExpand = false;
5359 bool RetainExpansion = false;
5360 if (getDerived().TryExpandParameterPacks(Loc, SourceRange(),
5361 Unexpanded,
5362 ShouldExpand,
5363 RetainExpansion,
5364 NumExpansions)) {
5365 return true;
5366 }
5367
5368 if (ShouldExpand) {
5369 // Expand the function parameter pack into multiple, separate
5370 // parameters.
5371 for (unsigned I = 0; I != *NumExpansions; ++I) {
5372 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
5373 QualType NewType = getDerived().TransformType(Pattern);
5374 if (NewType.isNull())
5375 return true;
5376
5377 if (NewType->containsUnexpandedParameterPack()) {
5378 NewType =
5379 getSema().getASTContext().getPackExpansionType(NewType, None);
5380
5381 if (NewType.isNull())
5382 return true;
5383 }
5384
5385 if (ParamInfos)
5386 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5387 OutParamTypes.push_back(NewType);
5388 if (PVars)
5389 PVars->push_back(nullptr);
5390 }
5391
5392 // We're done with the pack expansion.
5393 continue;
5394 }
5395
5396 // If we're supposed to retain a pack expansion, do so by temporarily
5397 // forgetting the partially-substituted parameter pack.
5398 if (RetainExpansion) {
5399 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
5400 QualType NewType = getDerived().TransformType(Pattern);
5401 if (NewType.isNull())
5402 return true;
5403
5404 if (ParamInfos)
5405 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5406 OutParamTypes.push_back(NewType);
5407 if (PVars)
5408 PVars->push_back(nullptr);
5409 }
5410
5411 // We'll substitute the parameter now without expanding the pack
5412 // expansion.
5413 OldType = Expansion->getPattern();
5414 IsPackExpansion = true;
5415 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
5416 NewType = getDerived().TransformType(OldType);
5417 } else {
5418 NewType = getDerived().TransformType(OldType);
5419 }
5420
5421 if (NewType.isNull())
5422 return true;
5423
5424 if (IsPackExpansion)
5425 NewType = getSema().Context.getPackExpansionType(NewType,
5426 NumExpansions);
5427
5428 if (ParamInfos)
5429 PInfos.set(OutParamTypes.size(), ParamInfos[i]);
5430 OutParamTypes.push_back(NewType);
5431 if (PVars)
5432 PVars->push_back(nullptr);
5433 }
5434
5435 #ifndef NDEBUG
5436 if (PVars) {
5437 for (unsigned i = 0, e = PVars->size(); i != e; ++i)
5438 if (ParmVarDecl *parm = (*PVars)[i])
5439 assert(parm->getFunctionScopeIndex() == i);
5440 }
5441 #endif
5442
5443 return false;
5444 }
5445
5446 template<typename Derived>
5447 QualType
5448 TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
5449 FunctionProtoTypeLoc TL) {
5450 SmallVector<QualType, 4> ExceptionStorage;
5451 TreeTransform *This = this; // Work around gcc.gnu.org/PR56135.
5452 return getDerived().TransformFunctionProtoType(
5453 TLB, TL, nullptr, Qualifiers(),
5454 [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool &Changed) {
5455 return This->TransformExceptionSpec(TL.getBeginLoc(), ESI,
5456 ExceptionStorage, Changed);
5457 });
5458 }
5459
5460 template<typename Derived> template<typename Fn>
5461 QualType TreeTransform<Derived>::TransformFunctionProtoType(
5462 TypeLocBuilder &TLB, FunctionProtoTypeLoc TL, CXXRecordDecl *ThisContext,
5463 Qualifiers ThisTypeQuals, Fn TransformExceptionSpec) {
5464
5465 // Transform the parameters and return type.
5466 //
5467 // We are required to instantiate the params and return type in source order.
5468 // When the function has a trailing return type, we instantiate the
5469 // parameters before the return type, since the return type can then refer
5470 // to the parameters themselves (via decltype, sizeof, etc.).
5471 //
5472 SmallVector<QualType, 4> ParamTypes;
5473 SmallVector<ParmVarDecl*, 4> ParamDecls;
5474 Sema::ExtParameterInfoBuilder ExtParamInfos;
5475 const FunctionProtoType *T = TL.getTypePtr();
5476
5477 QualType ResultType;
5478
5479 if (T->hasTrailingReturn()) {
5480 if (getDerived().TransformFunctionTypeParams(
5481 TL.getBeginLoc(), TL.getParams(),
5482 TL.getTypePtr()->param_type_begin(),
5483 T->getExtParameterInfosOrNull(),
5484 ParamTypes, &ParamDecls, ExtParamInfos))
5485 return QualType();
5486
5487 {
5488 // C++11 [expr.prim.general]p3:
5489 // If a declaration declares a member function or member function
5490 // template of a class X, the expression this is a prvalue of type
5491 // "pointer to cv-qualifier-seq X" between the optional cv-qualifer-seq
5492 // and the end of the function-definition, member-declarator, or
5493 // declarator.
5494 Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, ThisTypeQuals);
5495
5496 ResultType = getDerived().TransformType(TLB, TL.getReturnLoc());
5497 if (ResultType.isNull())
5498 return QualType();
5499 }
5500 }
5501 else {
5502 ResultType = getDerived().TransformType(TLB, TL.getReturnLoc());
5503 if (ResultType.isNull())
5504 return QualType();
5505
5506 if (getDerived().TransformFunctionTypeParams(
5507 TL.getBeginLoc(), TL.getParams(),
5508 TL.getTypePtr()->param_type_begin(),
5509 T->getExtParameterInfosOrNull(),
5510 ParamTypes, &ParamDecls, ExtParamInfos))
5511 return QualType();
5512 }
5513
5514 FunctionProtoType::ExtProtoInfo EPI = T->getExtProtoInfo();
5515
5516 bool EPIChanged = false;
5517 if (TransformExceptionSpec(EPI.ExceptionSpec, EPIChanged))
5518 return QualType();
5519
5520 // Handle extended parameter information.
5521 if (auto NewExtParamInfos =
5522 ExtParamInfos.getPointerOrNull(ParamTypes.size())) {
5523 if (!EPI.ExtParameterInfos ||
5524 llvm::makeArrayRef(EPI.ExtParameterInfos, TL.getNumParams())
5525 != llvm::makeArrayRef(NewExtParamInfos, ParamTypes.size())) {
5526 EPIChanged = true;
5527 }
5528 EPI.ExtParameterInfos = NewExtParamInfos;
5529 } else if (EPI.ExtParameterInfos) {
5530 EPIChanged = true;
5531 EPI.ExtParameterInfos = nullptr;
5532 }
5533
5534 QualType Result = TL.getType();
5535 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType() ||
5536 T->getParamTypes() != llvm::makeArrayRef(ParamTypes) || EPIChanged) {
5537 Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI);
5538 if (Result.isNull())
5539 return QualType();
5540 }
5541
5542 FunctionProtoTypeLoc NewTL = TLB.push<FunctionProtoTypeLoc>(Result);
5543 NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
5544 NewTL.setLParenLoc(TL.getLParenLoc());
5545 NewTL.setRParenLoc(TL.getRParenLoc());
5546 NewTL.setExceptionSpecRange(TL.getExceptionSpecRange());
5547 NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
5548 for (unsigned i = 0, e = NewTL.getNumParams(); i != e; ++i)
5549 NewTL.setParam(i, ParamDecls[i]);
5550
5551 return Result;
5552 }
5553
5554 template<typename Derived>
5555 bool TreeTransform<Derived>::TransformExceptionSpec(
5556 SourceLocation Loc, FunctionProtoType::ExceptionSpecInfo &ESI,
5557 SmallVectorImpl<QualType> &Exceptions, bool &Changed) {
5558 assert(ESI.Type != EST_Uninstantiated && ESI.Type != EST_Unevaluated);
5559
5560 // Instantiate a dynamic noexcept expression, if any.
5561 if (isComputedNoexcept(ESI.Type)) {
5562 EnterExpressionEvaluationContext Unevaluated(
5563 getSema(), Sema::ExpressionEvaluationContext::ConstantEvaluated);
5564 ExprResult NoexceptExpr = getDerived().TransformExpr(ESI.NoexceptExpr);
5565 if (NoexceptExpr.isInvalid())
5566 return true;
5567
5568 ExceptionSpecificationType EST = ESI.Type;
5569 NoexceptExpr =
5570 getSema().ActOnNoexceptSpec(Loc, NoexceptExpr.get(), EST);
5571 if (NoexceptExpr.isInvalid())
5572 return true;
5573
5574 if (ESI.NoexceptExpr != NoexceptExpr.get() || EST != ESI.Type)
5575 Changed = true;
5576 ESI.NoexceptExpr = NoexceptExpr.get();
5577 ESI.Type = EST;
5578 }
5579
5580 if (ESI.Type != EST_Dynamic)
5581 return false;
5582
5583 // Instantiate a dynamic exception specification's type.
5584 for (QualType T : ESI.Exceptions) {
5585 if (const PackExpansionType *PackExpansion =
5586 T->getAs<PackExpansionType>()) {
5587 Changed = true;
5588
5589 // We have a pack expansion. Instantiate it.
5590 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
5591 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
5592 Unexpanded);
5593 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
5594
5595 // Determine whether the set of unexpanded parameter packs can and
5596 // should
5597 // be expanded.
5598 bool Expand = false;
5599 bool RetainExpansion = false;
5600 Optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
5601 // FIXME: Track the location of the ellipsis (and track source location
5602 // information for the types in the exception specification in general).
5603 if (getDerived().TryExpandParameterPacks(
5604 Loc, SourceRange(), Unexpanded, Expand,
5605 RetainExpansion, NumExpansions))
5606 return true;
5607
5608 if (!Expand) {
5609 // We can't expand this pack expansion into separate arguments yet;
5610 // just substitute into the pattern and create a new pack expansion
5611 // type.
5612 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
5613 QualType U = getDerived().TransformType(PackExpansion->getPattern());
5614 if (U.isNull())
5615 return true;
5616
5617 U = SemaRef.Context.getPackExpansionType(U, NumExpansions);
5618 Exceptions.push_back(U);
5619 continue;
5620 }
5621
5622 // Substitute into the pack expansion pattern for each slice of the
5623 // pack.
5624 for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
5625 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
5626
5627 QualType U = getDerived().TransformType(PackExpansion->getPattern());
5628 if (U.isNull() || SemaRef.CheckSpecifiedExceptionType(U, Loc))
5629 return true;
5630
5631 Exceptions.push_back(U);
5632 }
5633 } else {
5634 QualType U = getDerived().TransformType(T);
5635 if (U.isNull() || SemaRef.CheckSpecifiedExceptionType(U, Loc))
5636 return true;
5637 if (T != U)
5638 Changed = true;
5639
5640 Exceptions.push_back(U);
5641 }
5642 }
5643
5644 ESI.Exceptions = Exceptions;
5645 if (ESI.Exceptions.empty())
5646 ESI.Type = EST_DynamicNone;
5647 return false;
5648 }
5649
5650 template<typename Derived>
5651 QualType TreeTransform<Derived>::TransformFunctionNoProtoType(
5652 TypeLocBuilder &TLB,
5653 FunctionNoProtoTypeLoc TL) {
5654 const FunctionNoProtoType *T = TL.getTypePtr();
5655 QualType ResultType = getDerived().TransformType(TLB, TL.getReturnLoc());
5656 if (ResultType.isNull())
5657 return QualType();
5658
5659 QualType Result = TL.getType();
5660 if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType())
5661 Result = getDerived().RebuildFunctionNoProtoType(ResultType);
5662
5663 FunctionNoProtoTypeLoc NewTL = TLB.push<FunctionNoProtoTypeLoc>(Result);
5664 NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
5665 NewTL.setLParenLoc(TL.getLParenLoc());
5666 NewTL.setRParenLoc(TL.getRParenLoc());
5667 NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
5668
5669 return Result;
5670 }
5671
5672 template<typename Derived> QualType
5673 TreeTransform<Derived>::TransformUnresolvedUsingType(TypeLocBuilder &TLB,
5674 UnresolvedUsingTypeLoc TL) {
5675 const UnresolvedUsingType *T = TL.getTypePtr();
5676 Decl *D = getDerived().TransformDecl(TL.getNameLoc(), T->getDecl());
5677 if (!D)
5678 return QualType();
5679
5680 QualType Result = TL.getType();
5681 if (getDerived().AlwaysRebuild() || D != T->getDecl()) {
5682 Result = getDerived().RebuildUnresolvedUsingType(TL.getNameLoc(), D);
5683 if (Result.isNull())
5684 return QualType();
5685 }
5686
5687 // We might get an arbitrary type spec type back. We should at
5688 // least always get a type spec type, though.
5689 TypeSpecTypeLoc NewTL = TLB.pushTypeSpec(Result);
5690 NewTL.setNameLoc(TL.getNameLoc());
5691
5692 return Result;
5693 }
5694
5695 template<typename Derived>
5696 QualType TreeTransform<Derived>::TransformTypedefType(TypeLocBuilder &TLB,
5697 TypedefTypeLoc TL) {
5698 const TypedefType *T = TL.getTypePtr();
5699 TypedefNameDecl *Typedef
5700 = cast_or_null<TypedefNameDecl>(getDerived().TransformDecl(TL.getNameLoc(),
5701 T->getDecl()));
5702 if (!Typedef)
5703 return QualType();
5704
5705 QualType Result = TL.getType();
5706 if (getDerived().AlwaysRebuild() ||
5707 Typedef != T->getDecl()) {
5708 Result = getDerived().RebuildTypedefType(Typedef);
5709 if (Result.isNull())
5710 return QualType();
5711 }
5712
5713 TypedefTypeLoc NewTL = TLB.push<TypedefTypeLoc>(Result);
5714 NewTL.setNameLoc(TL.getNameLoc());
5715
5716 return Result;
5717 }
5718
5719 template<typename Derived>
5720 QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB,
5721 TypeOfExprTypeLoc TL) {
5722 // typeof expressions are not potentially evaluated contexts
5723 EnterExpressionEvaluationContext Unevaluated(
5724 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated,
5725 Sema::ReuseLambdaContextDecl);
5726
5727 ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
5728 if (E.isInvalid())
5729 return QualType();
5730
5731 E = SemaRef.HandleExprEvaluationContextForTypeof(E.get());
5732 if (E.isInvalid())
5733 return QualType();
5734
5735 QualType Result = TL.getType();
5736 if (getDerived().AlwaysRebuild() ||
5737 E.get() != TL.getUnderlyingExpr()) {
5738 Result = getDerived().RebuildTypeOfExprType(E.get(), TL.getTypeofLoc());
5739 if (Result.isNull())
5740 return QualType();
5741 }
5742 else E.get();
5743
5744 TypeOfExprTypeLoc NewTL = TLB.push<TypeOfExprTypeLoc>(Result);
5745 NewTL.setTypeofLoc(TL.getTypeofLoc());
5746 NewTL.setLParenLoc(TL.getLParenLoc());
5747 NewTL.setRParenLoc(TL.getRParenLoc());
5748
5749 return Result;
5750 }
5751
5752 template<typename Derived>
5753 QualType TreeTransform<Derived>::TransformTypeOfType(TypeLocBuilder &TLB,
5754 TypeOfTypeLoc TL) {
5755 TypeSourceInfo* Old_Under_TI = TL.getUnderlyingTInfo();
5756 TypeSourceInfo* New_Under_TI = getDerived().TransformType(Old_Under_TI);
5757 if (!New_Under_TI)
5758 return QualType();
5759
5760 QualType Result = TL.getType();
5761 if (getDerived().AlwaysRebuild() || New_Under_TI != Old_Under_TI) {
5762 Result = getDerived().RebuildTypeOfType(New_Under_TI->getType());
5763 if (Result.isNull())
5764 return QualType();
5765 }
5766
5767 TypeOfTypeLoc NewTL = TLB.push<TypeOfTypeLoc>(Result);
5768 NewTL.setTypeofLoc(TL.getTypeofLoc());
5769 NewTL.setLParenLoc(TL.getLParenLoc());
5770 NewTL.setRParenLoc(TL.getRParenLoc());
5771 NewTL.setUnderlyingTInfo(New_Under_TI);
5772
5773 return Result;
5774 }
5775
5776 template<typename Derived>
5777 QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
5778 DecltypeTypeLoc TL) {
5779 const DecltypeType *T = TL.getTypePtr();
5780
5781 // decltype expressions are not potentially evaluated contexts
5782 EnterExpressionEvaluationContext Unevaluated(
5783 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated, nullptr,
5784 Sema::ExpressionEvaluationContextRecord::EK_Decltype);
5785
5786 ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
5787 if (E.isInvalid())
5788 return QualType();
5789
5790 E = getSema().ActOnDecltypeExpression(E.get());
5791 if (E.isInvalid())
5792 return QualType();
5793
5794 QualType Result = TL.getType();
5795 if (getDerived().AlwaysRebuild() ||
5796 E.get() != T->getUnderlyingExpr()) {
5797 Result = getDerived().RebuildDecltypeType(E.get(), TL.getNameLoc());
5798 if (Result.isNull())
5799 return QualType();
5800 }
5801 else E.get();
5802
5803 DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(Result);
5804 NewTL.setNameLoc(TL.getNameLoc());
5805
5806 return Result;
5807 }
5808
5809 template<typename Derived>
5810 QualType TreeTransform<Derived>::TransformUnaryTransformType(
5811 TypeLocBuilder &TLB,
5812 UnaryTransformTypeLoc TL) {
5813 QualType Result = TL.getType();
5814 if (Result->isDependentType()) {
5815 const UnaryTransformType *T = TL.getTypePtr();
5816 QualType NewBase =
5817 getDerived().TransformType(TL.getUnderlyingTInfo())->getType();
5818 Result = getDerived().RebuildUnaryTransformType(NewBase,
5819 T->getUTTKind(),
5820 TL.getKWLoc());
5821 if (Result.isNull())
5822 return QualType();
5823 }
5824
5825 UnaryTransformTypeLoc NewTL = TLB.push<UnaryTransformTypeLoc>(Result);
5826 NewTL.setKWLoc(TL.getKWLoc());
5827 NewTL.setParensRange(TL.getParensRange());
5828 NewTL.setUnderlyingTInfo(TL.getUnderlyingTInfo());
5829 return Result;
5830 }
5831
5832 template<typename Derived>
5833 QualType TreeTransform<Derived>::TransformDeducedTemplateSpecializationType(
5834 TypeLocBuilder &TLB, DeducedTemplateSpecializationTypeLoc TL) {
5835 const DeducedTemplateSpecializationType *T = TL.getTypePtr();
5836
5837 CXXScopeSpec SS;
5838 TemplateName TemplateName = getDerived().TransformTemplateName(
5839 SS, T->getTemplateName(), TL.getTemplateNameLoc());
5840 if (TemplateName.isNull())
5841 return QualType();
5842
5843 QualType OldDeduced = T->getDeducedType();
5844 QualType NewDeduced;
5845 if (!OldDeduced.isNull()) {
5846 NewDeduced = getDerived().TransformType(OldDeduced);
5847 if (NewDeduced.isNull())
5848 return QualType();
5849 }
5850
5851 QualType Result = getDerived().RebuildDeducedTemplateSpecializationType(
5852 TemplateName, NewDeduced);
5853 if (Result.isNull())
5854 return QualType();
5855
5856 DeducedTemplateSpecializationTypeLoc NewTL =
5857 TLB.push<DeducedTemplateSpecializationTypeLoc>(Result);
5858 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
5859
5860 return Result;
5861 }
5862
5863 template<typename Derived>
5864 QualType TreeTransform<Derived>::TransformRecordType(TypeLocBuilder &TLB,
5865 RecordTypeLoc TL) {
5866 const RecordType *T = TL.getTypePtr();
5867 RecordDecl *Record
5868 = cast_or_null<RecordDecl>(getDerived().TransformDecl(TL.getNameLoc(),
5869 T->getDecl()));
5870 if (!Record)
5871 return QualType();
5872
5873 QualType Result = TL.getType();
5874 if (getDerived().AlwaysRebuild() ||
5875 Record != T->getDecl()) {
5876 Result = getDerived().RebuildRecordType(Record);
5877 if (Result.isNull())
5878 return QualType();
5879 }
5880
5881 RecordTypeLoc NewTL = TLB.push<RecordTypeLoc>(Result);
5882 NewTL.setNameLoc(TL.getNameLoc());
5883
5884 return Result;
5885 }
5886
5887 template<typename Derived>
5888 QualType TreeTransform<Derived>::TransformEnumType(TypeLocBuilder &TLB,
5889 EnumTypeLoc TL) {
5890 const EnumType *T = TL.getTypePtr();
5891 EnumDecl *Enum
5892 = cast_or_null<EnumDecl>(getDerived().TransformDecl(TL.getNameLoc(),
5893 T->getDecl()));
5894 if (!Enum)
5895 return QualType();
5896
5897 QualType Result = TL.getType();
5898 if (getDerived().AlwaysRebuild() ||
5899 Enum != T->getDecl()) {
5900 Result = getDerived().RebuildEnumType(Enum);
5901 if (Result.isNull())
5902 return QualType();
5903 }
5904
5905 EnumTypeLoc NewTL = TLB.push<EnumTypeLoc>(Result);
5906 NewTL.setNameLoc(TL.getNameLoc());
5907
5908 return Result;
5909 }
5910
5911 template<typename Derived>
5912 QualType TreeTransform<Derived>::TransformInjectedClassNameType(
5913 TypeLocBuilder &TLB,
5914 InjectedClassNameTypeLoc TL) {
5915 Decl *D = getDerived().TransformDecl(TL.getNameLoc(),
5916 TL.getTypePtr()->getDecl());
5917 if (!D) return QualType();
5918
5919 QualType T = SemaRef.Context.getTypeDeclType(cast<TypeDecl>(D));
5920 TLB.pushTypeSpec(T).setNameLoc(TL.getNameLoc());
5921 return T;
5922 }
5923
5924 template<typename Derived>
5925 QualType TreeTransform<Derived>::TransformTemplateTypeParmType(
5926 TypeLocBuilder &TLB,
5927 TemplateTypeParmTypeLoc TL) {
5928 return TransformTypeSpecType(TLB, TL);
5929 }
5930
5931 template<typename Derived>
5932 QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmType(
5933 TypeLocBuilder &TLB,
5934 SubstTemplateTypeParmTypeLoc TL) {
5935 const SubstTemplateTypeParmType *T = TL.getTypePtr();
5936
5937 // Substitute into the replacement type, which itself might involve something
5938 // that needs to be transformed. This only tends to occur with default
5939 // template arguments of template template parameters.
5940 TemporaryBase Rebase(*this, TL.getNameLoc(), DeclarationName());
5941 QualType Replacement = getDerived().TransformType(T->getReplacementType());
5942 if (Replacement.isNull())
5943 return QualType();
5944
5945 // Always canonicalize the replacement type.
5946 Replacement = SemaRef.Context.getCanonicalType(Replacement);
5947 QualType Result
5948 = SemaRef.Context.getSubstTemplateTypeParmType(T->getReplacedParameter(),
5949 Replacement);
5950
5951 // Propagate type-source information.
5952 SubstTemplateTypeParmTypeLoc NewTL
5953 = TLB.push<SubstTemplateTypeParmTypeLoc>(Result);
5954 NewTL.setNameLoc(TL.getNameLoc());
5955 return Result;
5956
5957 }
5958
5959 template<typename Derived>
5960 QualType TreeTransform<Derived>::TransformSubstTemplateTypeParmPackType(
5961 TypeLocBuilder &TLB,
5962 SubstTemplateTypeParmPackTypeLoc TL) {
5963 return TransformTypeSpecType(TLB, TL);
5964 }
5965
5966 template<typename Derived>
5967 QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
5968 TypeLocBuilder &TLB,
5969 TemplateSpecializationTypeLoc TL) {
5970 const TemplateSpecializationType *T = TL.getTypePtr();
5971
5972 // The nested-name-specifier never matters in a TemplateSpecializationType,
5973 // because we can't have a dependent nested-name-specifier anyway.
5974 CXXScopeSpec SS;
5975 TemplateName Template
5976 = getDerived().TransformTemplateName(SS, T->getTemplateName(),
5977 TL.getTemplateNameLoc());
5978 if (Template.isNull())
5979 return QualType();
5980
5981 return getDerived().TransformTemplateSpecializationType(TLB, TL, Template);
5982 }
5983
5984 template<typename Derived>
5985 QualType TreeTransform<Derived>::TransformAtomicType(TypeLocBuilder &TLB,
5986 AtomicTypeLoc TL) {
5987 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
5988 if (ValueType.isNull())
5989 return QualType();
5990
5991 QualType Result = TL.getType();
5992 if (getDerived().AlwaysRebuild() ||
5993 ValueType != TL.getValueLoc().getType()) {
5994 Result = getDerived().RebuildAtomicType(ValueType, TL.getKWLoc());
5995 if (Result.isNull())
5996 return QualType();
5997 }
5998
5999 AtomicTypeLoc NewTL = TLB.push<AtomicTypeLoc>(Result);
6000 NewTL.setKWLoc(TL.getKWLoc());
6001 NewTL.setLParenLoc(TL.getLParenLoc());
6002 NewTL.setRParenLoc(TL.getRParenLoc());
6003
6004 return Result;
6005 }
6006
6007 template <typename Derived>
6008 QualType TreeTransform<Derived>::TransformPipeType(TypeLocBuilder &TLB,
6009 PipeTypeLoc TL) {
6010 QualType ValueType = getDerived().TransformType(TLB, TL.getValueLoc());
6011 if (ValueType.isNull())
6012 return QualType();
6013
6014 QualType Result = TL.getType();
6015 if (getDerived().AlwaysRebuild() || ValueType != TL.getValueLoc().getType()) {
6016 const PipeType *PT = Result->castAs<PipeType>();
6017 bool isReadPipe = PT->isReadOnly();
6018 Result = getDerived().RebuildPipeType(ValueType, TL.getKWLoc(), isReadPipe);
6019 if (Result.isNull())
6020 return QualType();
6021 }
6022
6023 PipeTypeLoc NewTL = TLB.push<PipeTypeLoc>(Result);
6024 NewTL.setKWLoc(TL.getKWLoc());
6025
6026 return Result;
6027 }
6028
6029 /// Simple iterator that traverses the template arguments in a
6030 /// container that provides a \c getArgLoc() member function.
6031 ///
6032 /// This iterator is intended to be used with the iterator form of
6033 /// \c TreeTransform<Derived>::TransformTemplateArguments().
6034 template<typename ArgLocContainer>
6035 class TemplateArgumentLocContainerIterator {
6036 ArgLocContainer *Container;
6037 unsigned Index;
6038
6039 public:
6040 typedef TemplateArgumentLoc value_type;
6041 typedef TemplateArgumentLoc reference;
6042 typedef int difference_type;
6043 typedef std::input_iterator_tag iterator_category;
6044
6045 class pointer {
6046 TemplateArgumentLoc Arg;
6047
6048 public:
6049 explicit pointer(TemplateArgumentLoc Arg) : Arg(Arg) { }
6050
6051 const TemplateArgumentLoc *operator->() const {
6052 return &Arg;
6053 }
6054 };
6055
6056
6057 TemplateArgumentLocContainerIterator() {}
6058
6059 TemplateArgumentLocContainerIterator(ArgLocContainer &Container,
6060 unsigned Index)
6061 : Container(&Container), Index(Index) { }
6062
6063 TemplateArgumentLocContainerIterator &operator++() {
6064 ++Index;
6065 return *this;
6066 }
6067
6068 TemplateArgumentLocContainerIterator operator++(int) {
6069 TemplateArgumentLocContainerIterator Old(*this);
6070 ++(*this);
6071 return Old;
6072 }
6073
6074 TemplateArgumentLoc operator*() const {
6075 return Container->getArgLoc(Index);
6076 }
6077
6078 pointer operator->() const {
6079 return pointer(Container->getArgLoc(Index));
6080 }
6081
6082 friend bool operator==(const TemplateArgumentLocContainerIterator &X,
6083 const TemplateArgumentLocContainerIterator &Y) {
6084 return X.Container == Y.Container && X.Index == Y.Index;
6085 }
6086
6087 friend bool operator!=(const TemplateArgumentLocContainerIterator &X,
6088 const TemplateArgumentLocContainerIterator &Y) {
6089 return !(X == Y);
6090 }
6091 };
6092
6093 template<typename Derived>
6094 QualType TreeTransform<Derived>::TransformAutoType(TypeLocBuilder &TLB,
6095 AutoTypeLoc TL) {
6096 const AutoType *T = TL.getTypePtr();
6097 QualType OldDeduced = T->getDeducedType();
6098 QualType NewDeduced;
6099 if (!OldDeduced.isNull()) {
6100 NewDeduced = getDerived().TransformType(OldDeduced);
6101 if (NewDeduced.isNull())
6102 return QualType();
6103 }
6104
6105 ConceptDecl *NewCD = nullptr;
6106 TemplateArgumentListInfo NewTemplateArgs;
6107 NestedNameSpecifierLoc NewNestedNameSpec;
6108 if (TL.getTypePtr()->isConstrained()) {
6109 NewCD = cast_or_null<ConceptDecl>(
6110 getDerived().TransformDecl(
6111 TL.getConceptNameLoc(),
6112 TL.getTypePtr()->getTypeConstraintConcept()));
6113
6114 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
6115 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
6116 typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
6117 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
6118 ArgIterator(TL,
6119 TL.getNumArgs()),
6120 NewTemplateArgs))
6121 return QualType();
6122
6123 if (TL.getNestedNameSpecifierLoc()) {
6124 NewNestedNameSpec
6125 = getDerived().TransformNestedNameSpecifierLoc(
6126 TL.getNestedNameSpecifierLoc());
6127 if (!NewNestedNameSpec)
6128 return QualType();
6129 }
6130 }
6131
6132 QualType Result = TL.getType();
6133 if (getDerived().AlwaysRebuild() || NewDeduced != OldDeduced ||
6134 T->isDependentType()) {
6135 llvm::SmallVector<TemplateArgument, 4> NewArgList;
6136 NewArgList.reserve(NewArgList.size());
6137 for (const auto &ArgLoc : NewTemplateArgs.arguments())
6138 NewArgList.push_back(ArgLoc.getArgument());
6139 Result = getDerived().RebuildAutoType(NewDeduced, T->getKeyword(), NewCD,
6140 NewArgList);
6141 if (Result.isNull())
6142 return QualType();
6143 }
6144
6145 AutoTypeLoc NewTL = TLB.push<AutoTypeLoc>(Result);
6146 NewTL.setNameLoc(TL.getNameLoc());
6147 NewTL.setNestedNameSpecifierLoc(NewNestedNameSpec);
6148 NewTL.setTemplateKWLoc(TL.getTemplateKWLoc());
6149 NewTL.setConceptNameLoc(TL.getConceptNameLoc());
6150 NewTL.setFoundDecl(TL.getFoundDecl());
6151 NewTL.setLAngleLoc(TL.getLAngleLoc());
6152 NewTL.setRAngleLoc(TL.getRAngleLoc());
6153 for (unsigned I = 0; I < TL.getNumArgs(); ++I)
6154 NewTL.setArgLocInfo(I, NewTemplateArgs.arguments()[I].getLocInfo());
6155
6156 return Result;
6157 }
6158
6159 template <typename Derived>
6160 QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
6161 TypeLocBuilder &TLB,
6162 TemplateSpecializationTypeLoc TL,
6163 TemplateName Template) {
6164 TemplateArgumentListInfo NewTemplateArgs;
6165 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
6166 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
6167 typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
6168 ArgIterator;
6169 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
6170 ArgIterator(TL, TL.getNumArgs()),
6171 NewTemplateArgs))
6172 return QualType();
6173
6174 // FIXME: maybe don't rebuild if all the template arguments are the same.
6175
6176 QualType Result =
6177 getDerived().RebuildTemplateSpecializationType(Template,
6178 TL.getTemplateNameLoc(),
6179 NewTemplateArgs);
6180
6181 if (!Result.isNull()) {
6182 // Specializations of template template parameters are represented as
6183 // TemplateSpecializationTypes, and substitution of type alias templates
6184 // within a dependent context can transform them into
6185 // DependentTemplateSpecializationTypes.
6186 if (isa<DependentTemplateSpecializationType>(Result)) {
6187 DependentTemplateSpecializationTypeLoc NewTL
6188 = TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
6189 NewTL.setElaboratedKeywordLoc(SourceLocation());
6190 NewTL.setQualifierLoc(NestedNameSpecifierLoc());
6191 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6192 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6193 NewTL.setLAngleLoc(TL.getLAngleLoc());
6194 NewTL.setRAngleLoc(TL.getRAngleLoc());
6195 for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
6196 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
6197 return Result;
6198 }
6199
6200 TemplateSpecializationTypeLoc NewTL
6201 = TLB.push<TemplateSpecializationTypeLoc>(Result);
6202 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6203 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6204 NewTL.setLAngleLoc(TL.getLAngleLoc());
6205 NewTL.setRAngleLoc(TL.getRAngleLoc());
6206 for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
6207 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
6208 }
6209
6210 return Result;
6211 }
6212
6213 template <typename Derived>
6214 QualType TreeTransform<Derived>::TransformDependentTemplateSpecializationType(
6215 TypeLocBuilder &TLB,
6216 DependentTemplateSpecializationTypeLoc TL,
6217 TemplateName Template,
6218 CXXScopeSpec &SS) {
6219 TemplateArgumentListInfo NewTemplateArgs;
6220 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
6221 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
6222 typedef TemplateArgumentLocContainerIterator<
6223 DependentTemplateSpecializationTypeLoc> ArgIterator;
6224 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
6225 ArgIterator(TL, TL.getNumArgs()),
6226 NewTemplateArgs))
6227 return QualType();
6228
6229 // FIXME: maybe don't rebuild if all the template arguments are the same.
6230
6231 if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
6232 QualType Result
6233 = getSema().Context.getDependentTemplateSpecializationType(
6234 TL.getTypePtr()->getKeyword(),
6235 DTN->getQualifier(),
6236 DTN->getIdentifier(),
6237 NewTemplateArgs);
6238
6239 DependentTemplateSpecializationTypeLoc NewTL
6240 = TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
6241 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6242 NewTL.setQualifierLoc(SS.getWithLocInContext(SemaRef.Context));
6243 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6244 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6245 NewTL.setLAngleLoc(TL.getLAngleLoc());
6246 NewTL.setRAngleLoc(TL.getRAngleLoc());
6247 for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
6248 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
6249 return Result;
6250 }
6251
6252 QualType Result
6253 = getDerived().RebuildTemplateSpecializationType(Template,
6254 TL.getTemplateNameLoc(),
6255 NewTemplateArgs);
6256
6257 if (!Result.isNull()) {
6258 /// FIXME: Wrap this in an elaborated-type-specifier?
6259 TemplateSpecializationTypeLoc NewTL
6260 = TLB.push<TemplateSpecializationTypeLoc>(Result);
6261 NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6262 NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6263 NewTL.setLAngleLoc(TL.getLAngleLoc());
6264 NewTL.setRAngleLoc(TL.getRAngleLoc());
6265 for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
6266 NewTL.setArgLocInfo(i, NewTemplateArgs[i].getLocInfo());
6267 }
6268
6269 return Result;
6270 }
6271
6272 template<typename Derived>
6273 QualType
6274 TreeTransform<Derived>::TransformElaboratedType(TypeLocBuilder &TLB,
6275 ElaboratedTypeLoc TL) {
6276 const ElaboratedType *T = TL.getTypePtr();
6277
6278 NestedNameSpecifierLoc QualifierLoc;
6279 // NOTE: the qualifier in an ElaboratedType is optional.
6280 if (TL.getQualifierLoc()) {
6281 QualifierLoc
6282 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
6283 if (!QualifierLoc)
6284 return QualType();
6285 }
6286
6287 QualType NamedT = getDerived().TransformType(TLB, TL.getNamedTypeLoc());
6288 if (NamedT.isNull())
6289 return QualType();
6290
6291 // C++0x [dcl.type.elab]p2:
6292 // If the identifier resolves to a typedef-name or the simple-template-id
6293 // resolves to an alias template specialization, the
6294 // elaborated-type-specifier is ill-formed.
6295 if (T->getKeyword() != ETK_None && T->getKeyword() != ETK_Typename) {
6296 if (const TemplateSpecializationType *TST =
6297 NamedT->getAs<TemplateSpecializationType>()) {
6298 TemplateName Template = TST->getTemplateName();
6299 if (TypeAliasTemplateDecl *TAT = dyn_cast_or_null<TypeAliasTemplateDecl>(
6300 Template.getAsTemplateDecl())) {
6301 SemaRef.Diag(TL.getNamedTypeLoc().getBeginLoc(),
6302 diag::err_tag_reference_non_tag)
6303 << TAT << Sema::NTK_TypeAliasTemplate
6304 << ElaboratedType::getTagTypeKindForKeyword(T->getKeyword());
6305 SemaRef.Diag(TAT->getLocation(), diag::note_declared_at);
6306 }
6307 }
6308 }
6309
6310 QualType Result = TL.getType();
6311 if (getDerived().AlwaysRebuild() ||
6312 QualifierLoc != TL.getQualifierLoc() ||
6313 NamedT != T->getNamedType()) {
6314 Result = getDerived().RebuildElaboratedType(TL.getElaboratedKeywordLoc(),
6315 T->getKeyword(),
6316 QualifierLoc, NamedT);
6317 if (Result.isNull())
6318 return QualType();
6319 }
6320
6321 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(Result);
6322 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6323 NewTL.setQualifierLoc(QualifierLoc);
6324 return Result;
6325 }
6326
6327 template<typename Derived>
6328 QualType TreeTransform<Derived>::TransformAttributedType(
6329 TypeLocBuilder &TLB,
6330 AttributedTypeLoc TL) {
6331 const AttributedType *oldType = TL.getTypePtr();
6332 QualType modifiedType = getDerived().TransformType(TLB, TL.getModifiedLoc());
6333 if (modifiedType.isNull())
6334 return QualType();
6335
6336 // oldAttr can be null if we started with a QualType rather than a TypeLoc.
6337 const Attr *oldAttr = TL.getAttr();
6338 const Attr *newAttr = oldAttr ? getDerived().TransformAttr(oldAttr) : nullptr;
6339 if (oldAttr && !newAttr)
6340 return QualType();
6341
6342 QualType result = TL.getType();
6343
6344 // FIXME: dependent operand expressions?
6345 if (getDerived().AlwaysRebuild() ||
6346 modifiedType != oldType->getModifiedType()) {
6347 // TODO: this is really lame; we should really be rebuilding the
6348 // equivalent type from first principles.
6349 QualType equivalentType
6350 = getDerived().TransformType(oldType->getEquivalentType());
6351 if (equivalentType.isNull())
6352 return QualType();
6353
6354 // Check whether we can add nullability; it is only represented as
6355 // type sugar, and therefore cannot be diagnosed in any other way.
6356 if (auto nullability = oldType->getImmediateNullability()) {
6357 if (!modifiedType->canHaveNullability()) {
6358 SemaRef.Diag(TL.getAttr()->getLocation(),
6359 diag::err_nullability_nonpointer)
6360 << DiagNullabilityKind(*nullability, false) << modifiedType;
6361 return QualType();
6362 }
6363 }
6364
6365 result = SemaRef.Context.getAttributedType(TL.getAttrKind(),
6366 modifiedType,
6367 equivalentType);
6368 }
6369
6370 AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result);
6371 newTL.setAttr(newAttr);
6372 return result;
6373 }
6374
6375 template<typename Derived>
6376 QualType
6377 TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
6378 ParenTypeLoc TL) {
6379 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
6380 if (Inner.isNull())
6381 return QualType();
6382
6383 QualType Result = TL.getType();
6384 if (getDerived().AlwaysRebuild() ||
6385 Inner != TL.getInnerLoc().getType()) {
6386 Result = getDerived().RebuildParenType(Inner);
6387 if (Result.isNull())
6388 return QualType();
6389 }
6390
6391 ParenTypeLoc NewTL = TLB.push<ParenTypeLoc>(Result);
6392 NewTL.setLParenLoc(TL.getLParenLoc());
6393 NewTL.setRParenLoc(TL.getRParenLoc());
6394 return Result;
6395 }
6396
6397 template <typename Derived>
6398 QualType
6399 TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
6400 MacroQualifiedTypeLoc TL) {
6401 QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
6402 if (Inner.isNull())
6403 return QualType();
6404
6405 QualType Result = TL.getType();
6406 if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
6407 Result =
6408 getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
6409 if (Result.isNull())
6410 return QualType();
6411 }
6412
6413 MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(Result);
6414 NewTL.setExpansionLoc(TL.getExpansionLoc());
6415 return Result;
6416 }
6417
6418 template<typename Derived>
6419 QualType TreeTransform<Derived>::TransformDependentNameType(
6420 TypeLocBuilder &TLB, DependentNameTypeLoc TL) {
6421 return TransformDependentNameType(TLB, TL, false);
6422 }
6423
6424 template<typename Derived>
6425 QualType TreeTransform<Derived>::TransformDependentNameType(
6426 TypeLocBuilder &TLB, DependentNameTypeLoc TL, bool DeducedTSTContext) {
6427 const DependentNameType *T = TL.getTypePtr();
6428
6429 NestedNameSpecifierLoc QualifierLoc
6430 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
6431 if (!QualifierLoc)
6432 return QualType();
6433
6434 QualType Result
6435 = getDerived().RebuildDependentNameType(T->getKeyword(),
6436 TL.getElaboratedKeywordLoc(),
6437 QualifierLoc,
6438 T->getIdentifier(),
6439 TL.getNameLoc(),
6440 DeducedTSTContext);
6441 if (Result.isNull())
6442 return QualType();
6443
6444 if (const ElaboratedType* ElabT = Result->getAs<ElaboratedType>()) {
6445 QualType NamedT = ElabT->getNamedType();
6446 TLB.pushTypeSpec(NamedT).setNameLoc(TL.getNameLoc());
6447
6448 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(Result);
6449 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6450 NewTL.setQualifierLoc(QualifierLoc);
6451 } else {
6452 DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(Result);
6453 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6454 NewTL.setQualifierLoc(QualifierLoc);
6455 NewTL.setNameLoc(TL.getNameLoc());
6456 }
6457 return Result;
6458 }
6459
6460 template<typename Derived>
6461 QualType TreeTransform<Derived>::
6462 TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
6463 DependentTemplateSpecializationTypeLoc TL) {
6464 NestedNameSpecifierLoc QualifierLoc;
6465 if (TL.getQualifierLoc()) {
6466 QualifierLoc
6467 = getDerived().TransformNestedNameSpecifierLoc(TL.getQualifierLoc());
6468 if (!QualifierLoc)
6469 return QualType();
6470 }
6471
6472 return getDerived()
6473 .TransformDependentTemplateSpecializationType(TLB, TL, QualifierLoc);
6474 }
6475
6476 template<typename Derived>
6477 QualType TreeTransform<Derived>::
6478 TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
6479 DependentTemplateSpecializationTypeLoc TL,
6480 NestedNameSpecifierLoc QualifierLoc) {
6481 const DependentTemplateSpecializationType *T = TL.getTypePtr();
6482
6483 TemplateArgumentListInfo NewTemplateArgs;
6484 NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
6485 NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
6486
6487 typedef TemplateArgumentLocContainerIterator<
6488 DependentTemplateSpecializationTypeLoc> ArgIterator;
6489 if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
6490 ArgIterator(TL, TL.getNumArgs()),
6491 NewTemplateArgs))
6492 return QualType();
6493
6494 QualType Result = getDerived().RebuildDependentTemplateSpecializationType(
6495 T->getKeyword(), QualifierLoc, TL.getTemplateKeywordLoc(),
6496 T->getIdentifier(), TL.getTemplateNameLoc(), NewTemplateArgs,
6497 /*AllowInjectedClassName*/ false);
6498 if (Result.isNull())
6499 return QualType();
6500
6501 if (const ElaboratedType *ElabT = dyn_cast<ElaboratedType>(Result)) {
6502 QualType NamedT = ElabT->getNamedType();
6503
6504 // Copy information relevant to the template specialization.
6505 TemplateSpecializationTypeLoc NamedTL
6506 = TLB.push<TemplateSpecializationTypeLoc>(NamedT);
6507 NamedTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6508 NamedTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6509 NamedTL.setLAngleLoc(TL.getLAngleLoc());
6510 NamedTL.setRAngleLoc(TL.getRAngleLoc());
6511 for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
6512 NamedTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo());
6513
6514 // Copy information relevant to the elaborated type.
6515 ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(Result);
6516 NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6517 NewTL.setQualifierLoc(QualifierLoc);
6518 } else if (isa<DependentTemplateSpecializationType>(Result)) {
6519 DependentTemplateSpecializationTypeLoc SpecTL
6520 = TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
6521 SpecTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
6522 SpecTL.setQualifierLoc(QualifierLoc);
6523 SpecTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6524 SpecTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6525 SpecTL.setLAngleLoc(TL.getLAngleLoc());
6526 SpecTL.setRAngleLoc(TL.getRAngleLoc());
6527 for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
6528 SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo());
6529 } else {
6530 TemplateSpecializationTypeLoc SpecTL
6531 = TLB.push<TemplateSpecializationTypeLoc>(Result);
6532 SpecTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
6533 SpecTL.setTemplateNameLoc(TL.getTemplateNameLoc());
6534 SpecTL.setLAngleLoc(TL.getLAngleLoc());
6535 SpecTL.setRAngleLoc(TL.getRAngleLoc());
6536 for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
6537 SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo());
6538 }
6539 return Result;
6540 }
6541
6542 template<typename Derived>
6543 QualType TreeTransform<Derived>::TransformPackExpansionType(TypeLocBuilder &TLB,
6544 PackExpansionTypeLoc TL) {
6545 QualType Pattern
6546 = getDerived().TransformType(TLB, TL.getPatternLoc());
6547 if (Pattern.isNull())
6548 return QualType();
6549
6550 QualType Result = TL.getType();
6551 if (getDerived().AlwaysRebuild() ||
6552 Pattern != TL.getPatternLoc().getType()) {
6553 Result = getDerived().RebuildPackExpansionType(Pattern,
6554 TL.getPatternLoc().getSourceRange(),
6555 TL.getEllipsisLoc(),
6556 TL.getTypePtr()->getNumExpansions());
6557 if (Result.isNull())
6558 return QualType();
6559 }
6560
6561 PackExpansionTypeLoc NewT = TLB.push<PackExpansionTypeLoc>(Result);
6562 NewT.setEllipsisLoc(TL.getEllipsisLoc());
6563 return Result;
6564 }
6565
6566 template<typename Derived>
6567 QualType
6568 TreeTransform<Derived>::TransformObjCInterfaceType(TypeLocBuilder &TLB,
6569 ObjCInterfaceTypeLoc TL) {
6570 // ObjCInterfaceType is never dependent.
6571 TLB.pushFullCopy(TL);
6572 return TL.getType();
6573 }
6574
6575 template<typename Derived>
6576 QualType
6577 TreeTransform<Derived>::TransformObjCTypeParamType(TypeLocBuilder &TLB,
6578 ObjCTypeParamTypeLoc TL) {
6579 const ObjCTypeParamType *T = TL.getTypePtr();
6580 ObjCTypeParamDecl *OTP = cast_or_null<ObjCTypeParamDecl>(
6581 getDerived().TransformDecl(T->getDecl()->getLocation(), T->getDecl()));
6582 if (!OTP)
6583 return QualType();
6584
6585 QualType Result = TL.getType();
6586 if (getDerived().AlwaysRebuild() ||
6587 OTP != T->getDecl()) {
6588 Result = getDerived().RebuildObjCTypeParamType(OTP,
6589 TL.getProtocolLAngleLoc(),
6590 llvm::makeArrayRef(TL.getTypePtr()->qual_begin(),
6591 TL.getNumProtocols()),
6592 TL.getProtocolLocs(),
6593 TL.getProtocolRAngleLoc());
6594 if (Result.isNull())
6595 return QualType();
6596 }
6597
6598 ObjCTypeParamTypeLoc NewTL = TLB.push<ObjCTypeParamTypeLoc>(Result);
6599 if (TL.getNumProtocols()) {
6600 NewTL.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
6601 for (unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
6602 NewTL.setProtocolLoc(i, TL.getProtocolLoc(i));
6603 NewTL.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
6604 }
6605 return Result;
6606 }
6607
6608 template<typename Derived>
6609 QualType
6610 TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
6611 ObjCObjectTypeLoc TL) {
6612 // Transform base type.
6613 QualType BaseType = getDerived().TransformType(TLB, TL.getBaseLoc());
6614 if (BaseType.isNull())
6615 return QualType();
6616
6617 bool AnyChanged = BaseType != TL.getBaseLoc().getType();
6618
6619 // Transform type arguments.
6620 SmallVector<TypeSourceInfo *, 4> NewTypeArgInfos;
6621 for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i) {
6622 TypeSourceInfo *TypeArgInfo = TL.getTypeArgTInfo(i);
6623 TypeLoc TypeArgLoc = TypeArgInfo->getTypeLoc();
6624 QualType TypeArg = TypeArgInfo->getType();
6625 if (auto PackExpansionLoc = TypeArgLoc.getAs<PackExpansionTypeLoc>()) {
6626 AnyChanged = true;
6627
6628 // We have a pack expansion. Instantiate it.
6629 const auto *PackExpansion = PackExpansionLoc.getType()
6630 ->castAs<PackExpansionType>();
6631 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
6632 SemaRef.collectUnexpandedParameterPacks(PackExpansion->getPattern(),
6633 Unexpanded);
6634 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
6635
6636 // Determine whether the set of unexpanded parameter packs can
6637 // and should be expanded.
6638 TypeLoc PatternLoc = PackExpansionLoc.getPatternLoc();
6639 bool Expand = false;
6640 bool RetainExpansion = false;
6641 Optional<unsigned> NumExpansions = PackExpansion->getNumExpansions();
6642 if (getDerived().TryExpandParameterPacks(
6643 PackExpansionLoc.getEllipsisLoc(), PatternLoc.getSourceRange(),
6644 Unexpanded, Expand, RetainExpansion, NumExpansions))
6645 return QualType();
6646
6647 if (!Expand) {
6648 // We can't expand this pack expansion into separate arguments yet;
6649 // just substitute into the pattern and create a new pack expansion
6650 // type.
6651 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
6652
6653 TypeLocBuilder TypeArgBuilder;
6654 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
6655 QualType NewPatternType = getDerived().TransformType(TypeArgBuilder,
6656 PatternLoc);
6657 if (NewPatternType.isNull())
6658 return QualType();
6659
6660 QualType NewExpansionType = SemaRef.Context.getPackExpansionType(
6661 NewPatternType, NumExpansions);
6662 auto NewExpansionLoc = TLB.push<PackExpansionTypeLoc>(NewExpansionType);
6663 NewExpansionLoc.setEllipsisLoc(PackExpansionLoc.getEllipsisLoc());
6664 NewTypeArgInfos.push_back(
6665 TypeArgBuilder.getTypeSourceInfo(SemaRef.Context, NewExpansionType));
6666 continue;
6667 }
6668
6669 // Substitute into the pack expansion pattern for each slice of the
6670 // pack.
6671 for (unsigned ArgIdx = 0; ArgIdx != *NumExpansions; ++ArgIdx) {
6672 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), ArgIdx);
6673
6674 TypeLocBuilder TypeArgBuilder;
6675 TypeArgBuilder.reserve(PatternLoc.getFullDataSize());
6676
6677 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder,
6678 PatternLoc);
6679 if (NewTypeArg.isNull())
6680 return QualType();
6681
6682 NewTypeArgInfos.push_back(
6683 TypeArgBuilder.getTypeSourceInfo(SemaRef.Context, NewTypeArg));
6684 }
6685
6686 continue;
6687 }
6688
6689 TypeLocBuilder TypeArgBuilder;
6690 TypeArgBuilder.reserve(TypeArgLoc.getFullDataSize());
6691 QualType NewTypeArg = getDerived().TransformType(TypeArgBuilder, TypeArgLoc);
6692 if (NewTypeArg.isNull())
6693 return QualType();
6694
6695 // If nothing changed, just keep the old TypeSourceInfo.
6696 if (NewTypeArg == TypeArg) {
6697 NewTypeArgInfos.push_back(TypeArgInfo);
6698 continue;
6699 }
6700
6701 NewTypeArgInfos.push_back(
6702 TypeArgBuilder.getTypeSourceInfo(SemaRef.Context, NewTypeArg));
6703 AnyChanged = true;
6704 }
6705
6706 QualType Result = TL.getType();
6707 if (getDerived().AlwaysRebuild() || AnyChanged) {
6708 // Rebuild the type.
6709 Result = getDerived().RebuildObjCObjectType(
6710 BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
6711 TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
6712 llvm::makeArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
6713 TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
6714
6715 if (Result.isNull())
6716 return QualType();
6717 }
6718
6719 ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(Result);
6720 NewT.setHasBaseTypeAsWritten(true);
6721 NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
6722 for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
6723 NewT.setTypeArgTInfo(i, NewTypeArgInfos[i]);
6724 NewT.setTypeArgsRAngleLoc(TL.getTypeArgsRAngleLoc());
6725 NewT.setProtocolLAngleLoc(TL.getProtocolLAngleLoc());
6726 for (unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i)
6727 NewT.setProtocolLoc(i, TL.getProtocolLoc(i));
6728 NewT.setProtocolRAngleLoc(TL.getProtocolRAngleLoc());
6729 return Result;
6730 }
6731
6732 template<typename Derived>
6733 QualType
6734 TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB,
6735 ObjCObjectPointerTypeLoc TL) {
6736 QualType PointeeType = getDerived().TransformType(TLB, TL.getPointeeLoc());
6737 if (PointeeType.isNull())
6738 return QualType();
6739
6740 QualType Result = TL.getType();
6741 if (getDerived().AlwaysRebuild() ||
6742 PointeeType != TL.getPointeeLoc().getType()) {
6743 Result = getDerived().RebuildObjCObjectPointerType(PointeeType,
6744 TL.getStarLoc());
6745 if (Result.isNull())
6746 return QualType();
6747 }
6748
6749 ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(Result);
6750 NewT.setStarLoc(TL.getStarLoc());
6751 return Result;
6752 }
6753
6754 //===----------------------------------------------------------------------===//
6755 // Statement transformation
6756 //===----------------------------------------------------------------------===//
6757 template<typename Derived>
6758 StmtResult
6759 TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
6760 return S;
6761 }
6762
6763 template<typename Derived>
6764 StmtResult
6765 TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S) {
6766 return getDerived().TransformCompoundStmt(S, false);
6767 }
6768
6769 template<typename Derived>
6770 StmtResult
6771 TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
6772 bool IsStmtExpr) {
6773 Sema::CompoundScopeRAII CompoundScope(getSema());
6774
6775 const Stmt *ExprResult = S->getStmtExprResult();
6776 bool SubStmtInvalid = false;
6777 bool SubStmtChanged = false;
6778 SmallVector<Stmt*, 8> Statements;
6779 for (auto *B : S->body()) {
6780 StmtResult Result = getDerived().TransformStmt(
6781 B, IsStmtExpr && B == ExprResult ? SDK_StmtExprResult : SDK_Discarded);
6782
6783 if (Result.isInvalid()) {
6784 // Immediately fail if this was a DeclStmt, since it's very
6785 // likely that this will cause problems for future statements.
6786 if (isa<DeclStmt>(B))
6787 return StmtError();
6788
6789 // Otherwise, just keep processing substatements and fail later.
6790 SubStmtInvalid = true;
6791 continue;
6792 }
6793
6794 SubStmtChanged = SubStmtChanged || Result.get() != B;
6795 Statements.push_back(Result.getAs<Stmt>());
6796 }
6797
6798 if (SubStmtInvalid)
6799 return StmtError();
6800
6801 if (!getDerived().AlwaysRebuild() &&
6802 !SubStmtChanged)
6803 return S;
6804
6805 return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
6806 Statements,
6807 S->getRBracLoc(),
6808 IsStmtExpr);
6809 }
6810
6811 template<typename Derived>
6812 StmtResult
6813 TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
6814 ExprResult LHS, RHS;
6815 {
6816 EnterExpressionEvaluationContext Unevaluated(
6817 SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
6818
6819 // Transform the left-hand case value.
6820 LHS = getDerived().TransformExpr(S->getLHS());
6821 LHS = SemaRef.ActOnCaseExpr(S->getCaseLoc(), LHS);
6822 if (LHS.isInvalid())
6823 return StmtError();
6824
6825 // Transform the right-hand case value (for the GNU case-range extension).
6826 RHS = getDerived().TransformExpr(S->getRHS());
6827 RHS = SemaRef.ActOnCaseExpr(S->getCaseLoc(), RHS);
6828 if (RHS.isInvalid())
6829 return StmtError();
6830 }
6831
6832 // Build the case statement.
6833 // Case statements are always rebuilt so that they will attached to their
6834 // transformed switch statement.
6835 StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
6836 LHS.get(),
6837 S->getEllipsisLoc(),
6838 RHS.get(),
6839 S->getColonLoc());
6840 if (Case.isInvalid())
6841 return StmtError();
6842
6843 // Transform the statement following the case
6844 StmtResult SubStmt =
6845 getDerived().TransformStmt(S->getSubStmt());
6846 if (SubStmt.isInvalid())
6847 return StmtError();
6848
6849 // Attach the body to the case statement
6850 return getDerived().RebuildCaseStmtBody(Case.get(), SubStmt.get());
6851 }
6852
6853 template <typename Derived>
6854 StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
6855 // Transform the statement following the default case
6856 StmtResult SubStmt =
6857 getDerived().TransformStmt(S->getSubStmt());
6858 if (SubStmt.isInvalid())
6859 return StmtError();
6860
6861 // Default statements are always rebuilt
6862 return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
6863 SubStmt.get());
6864 }
6865
6866 template<typename Derived>
6867 StmtResult
6868 TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S, StmtDiscardKind SDK) {
6869 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
6870 if (SubStmt.isInvalid())
6871 return StmtError();
6872
6873 Decl *LD = getDerived().TransformDecl(S->getDecl()->getLocation(),
6874 S->getDecl());
6875 if (!LD)
6876 return StmtError();
6877
6878 // If we're transforming "in-place" (we're not creating new local
6879 // declarations), assume we're replacing the old label statement
6880 // and clear out the reference to it.
6881 if (LD == S->getDecl())
6882 S->getDecl()->setStmt(nullptr);
6883
6884 // FIXME: Pass the real colon location in.
6885 return getDerived().RebuildLabelStmt(S->getIdentLoc(),
6886 cast<LabelDecl>(LD), SourceLocation(),
6887 SubStmt.get());
6888 }
6889
6890 template <typename Derived>
6891 const Attr *TreeTransform<Derived>::TransformAttr(const Attr *R) {
6892 if (!R)
6893 return R;
6894
6895 switch (R->getKind()) {
6896 // Transform attributes with a pragma spelling by calling TransformXXXAttr.
6897 #define ATTR(X)
6898 #define PRAGMA_SPELLING_ATTR(X) \
6899 case attr::X: \
6900 return getDerived().Transform##X##Attr(cast<X##Attr>(R));
6901 #include "clang/Basic/AttrList.inc"
6902 default:
6903 return R;
6904 }
6905 }
6906
6907 template <typename Derived>
6908 StmtResult
6909 TreeTransform<Derived>::TransformAttributedStmt(AttributedStmt *S,
6910 StmtDiscardKind SDK) {
6911 bool AttrsChanged = false;
6912 SmallVector<const Attr *, 1> Attrs;
6913
6914 // Visit attributes and keep track if any are transformed.
6915 for (const auto *I : S->getAttrs()) {
6916 const Attr *R = getDerived().TransformAttr(I);
6917 AttrsChanged |= (I != R);
6918 Attrs.push_back(R);
6919 }
6920
6921 StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt(), SDK);
6922 if (SubStmt.isInvalid())
6923 return StmtError();
6924
6925 if (SubStmt.get() == S->getSubStmt() && !AttrsChanged)
6926 return S;
6927
6928 return getDerived().RebuildAttributedStmt(S->getAttrLoc(), Attrs,
6929 SubStmt.get());
6930 }
6931
6932 template<typename Derived>
6933 StmtResult
6934 TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
6935 // Transform the initialization statement
6936 StmtResult Init = getDerived().TransformStmt(S->getInit());
6937 if (Init.isInvalid())
6938 return StmtError();
6939
6940 // Transform the condition
6941 Sema::ConditionResult Cond = getDerived().TransformCondition(
6942 S->getIfLoc(), S->getConditionVariable(), S->getCond(),
6943 S->isConstexpr() ? Sema::ConditionKind::ConstexprIf
6944 : Sema::ConditionKind::Boolean);
6945 if (Cond.isInvalid())
6946 return StmtError();
6947
6948 // If this is a constexpr if, determine which arm we should instantiate.
6949 llvm::Optional<bool> ConstexprConditionValue;
6950 if (S->isConstexpr())
6951 ConstexprConditionValue = Cond.getKnownValue();
6952
6953 // Transform the "then" branch.
6954 StmtResult Then;
6955 if (!ConstexprConditionValue || *ConstexprConditionValue) {
6956 Then = getDerived().TransformStmt(S->getThen());
6957 if (Then.isInvalid())
6958 return StmtError();
6959 } else {
6960 Then = new (getSema().Context) NullStmt(S->getThen()->getBeginLoc());
6961 }
6962
6963 // Transform the "else" branch.
6964 StmtResult Else;
6965 if (!ConstexprConditionValue || !*ConstexprConditionValue) {
6966 Else = getDerived().TransformStmt(S->getElse());
6967 if (Else.isInvalid())
6968 return StmtError();
6969 }
6970
6971 if (!getDerived().AlwaysRebuild() &&
6972 Init.get() == S->getInit() &&
6973 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
6974 Then.get() == S->getThen() &&
6975 Else.get() == S->getElse())
6976 return S;
6977
6978 return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond,
6979 Init.get(), Then.get(), S->getElseLoc(),
6980 Else.get());
6981 }
6982
6983 template<typename Derived>
6984 StmtResult
6985 TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
6986 // Transform the initialization statement
6987 StmtResult Init = getDerived().TransformStmt(S->getInit());
6988 if (Init.isInvalid())
6989 return StmtError();
6990
6991 // Transform the condition.
6992 Sema::ConditionResult Cond = getDerived().TransformCondition(
6993 S->getSwitchLoc(), S->getConditionVariable(), S->getCond(),
6994 Sema::ConditionKind::Switch);
6995 if (Cond.isInvalid())
6996 return StmtError();
6997
6998 // Rebuild the switch statement.
6999 StmtResult Switch
7000 = getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond);
7001 if (Switch.isInvalid())
7002 return StmtError();
7003
7004 // Transform the body of the switch statement.
7005 StmtResult Body = getDerived().TransformStmt(S->getBody());
7006 if (Body.isInvalid())
7007 return StmtError();
7008
7009 // Complete the switch statement.
7010 return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(), Switch.get(),
7011 Body.get());
7012 }
7013
7014 template<typename Derived>
7015 StmtResult
7016 TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
7017 // Transform the condition
7018 Sema::ConditionResult Cond = getDerived().TransformCondition(
7019 S->getWhileLoc(), S->getConditionVariable(), S->getCond(),
7020 Sema::ConditionKind::Boolean);
7021 if (Cond.isInvalid())
7022 return StmtError();
7023
7024 // Transform the body
7025 StmtResult Body = getDerived().TransformStmt(S->getBody());
7026 if (Body.isInvalid())
7027 return StmtError();
7028
7029 if (!getDerived().AlwaysRebuild() &&
7030 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
7031 Body.get() == S->getBody())
7032 return Owned(S);
7033
7034 return getDerived().RebuildWhileStmt(S->getWhileLoc(), Cond, Body.get());
7035 }
7036
7037 template<typename Derived>
7038 StmtResult
7039 TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
7040 // Transform the body
7041 StmtResult Body = getDerived().TransformStmt(S->getBody());
7042 if (Body.isInvalid())
7043 return StmtError();
7044
7045 // Transform the condition
7046 ExprResult Cond = getDerived().TransformExpr(S->getCond());
7047 if (Cond.isInvalid())
7048 return StmtError();
7049
7050 if (!getDerived().AlwaysRebuild() &&
7051 Cond.get() == S->getCond() &&
7052 Body.get() == S->getBody())
7053 return S;
7054
7055 return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
7056 /*FIXME:*/S->getWhileLoc(), Cond.get(),
7057 S->getRParenLoc());
7058 }
7059
7060 template<typename Derived>
7061 StmtResult
7062 TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
7063 if (getSema().getLangOpts().OpenMP)
7064 getSema().startOpenMPLoop();
7065
7066 // Transform the initialization statement
7067 StmtResult Init = getDerived().TransformStmt(S->getInit());
7068 if (Init.isInvalid())
7069 return StmtError();
7070
7071 // In OpenMP loop region loop control variable must be captured and be
7072 // private. Perform analysis of first part (if any).
7073 if (getSema().getLangOpts().OpenMP && Init.isUsable())
7074 getSema().ActOnOpenMPLoopInitialization(S->getForLoc(), Init.get());
7075
7076 // Transform the condition
7077 Sema::ConditionResult Cond = getDerived().TransformCondition(
7078 S->getForLoc(), S->getConditionVariable(), S->getCond(),
7079 Sema::ConditionKind::Boolean);
7080 if (Cond.isInvalid())
7081 return StmtError();
7082
7083 // Transform the increment
7084 ExprResult Inc = getDerived().TransformExpr(S->getInc());
7085 if (Inc.isInvalid())
7086 return StmtError();
7087
7088 Sema::FullExprArg FullInc(getSema().MakeFullDiscardedValueExpr(Inc.get()));
7089 if (S->getInc() && !FullInc.get())
7090 return StmtError();
7091
7092 // Transform the body
7093 StmtResult Body = getDerived().TransformStmt(S->getBody());
7094 if (Body.isInvalid())
7095 return StmtError();
7096
7097 if (!getDerived().AlwaysRebuild() &&
7098 Init.get() == S->getInit() &&
7099 Cond.get() == std::make_pair(S->getConditionVariable(), S->getCond()) &&
7100 Inc.get() == S->getInc() &&
7101 Body.get() == S->getBody())
7102 return S;
7103
7104 return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
7105 Init.get(), Cond, FullInc,
7106 S->getRParenLoc(), Body.get());
7107 }
7108
7109 template<typename Derived>
7110 StmtResult
7111 TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
7112 Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
7113 S->getLabel());
7114 if (!LD)
7115 return StmtError();
7116
7117 // Goto statements must always be rebuilt, to resolve the label.
7118 return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
7119 cast<LabelDecl>(LD));
7120 }
7121
7122 template<typename Derived>
7123 StmtResult
7124 TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
7125 ExprResult Target = getDerived().TransformExpr(S->getTarget());
7126 if (Target.isInvalid())
7127 return StmtError();
7128 Target = SemaRef.MaybeCreateExprWithCleanups(Target.get());
7129
7130 if (!getDerived().AlwaysRebuild() &&
7131 Target.get() == S->getTarget())
7132 return S;
7133
7134 return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
7135 Target.get());
7136 }
7137
7138 template<typename Derived>
7139 StmtResult
7140 TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
7141 return S;
7142 }
7143
7144 template<typename Derived>
7145 StmtResult
7146 TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
7147 return S;
7148 }
7149
7150 template<typename Derived>
7151 StmtResult
7152 TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
7153 ExprResult Result = getDerived().TransformInitializer(S->getRetValue(),
7154 /*NotCopyInit*/false);
7155 if (Result.isInvalid())
7156 return StmtError();
7157
7158 // FIXME: We always rebuild the return statement because there is no way
7159 // to tell whether the return type of the function has changed.
7160 return getDerived().RebuildReturnStmt(S->getReturnLoc(), Result.get());
7161 }
7162
7163 template<typename Derived>
7164 StmtResult
7165 TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
7166 bool DeclChanged = false;
7167 SmallVector<Decl *, 4> Decls;
7168 for (auto *D : S->decls()) {
7169 Decl *Transformed = getDerived().TransformDefinition(D->getLocation(), D);
7170 if (!Transformed)
7171 return StmtError();
7172
7173 if (Transformed != D)
7174 DeclChanged = true;
7175
7176 Decls.push_back(Transformed);
7177 }
7178
7179 if (!getDerived().AlwaysRebuild() && !DeclChanged)
7180 return S;
7181
7182 return getDerived().RebuildDeclStmt(Decls, S->getBeginLoc(), S->getEndLoc());
7183 }
7184
7185 template<typename Derived>
7186 StmtResult
7187 TreeTransform<Derived>::TransformGCCAsmStmt(GCCAsmStmt *S) {
7188
7189 SmallVector<Expr*, 8> Constraints;
7190 SmallVector<Expr*, 8> Exprs;
7191 SmallVector<IdentifierInfo *, 4> Names;
7192
7193 ExprResult AsmString;
7194 SmallVector<Expr*, 8> Clobbers;
7195
7196 bool ExprsChanged = false;
7197
7198 // Go through the outputs.
7199 for (unsigned I = 0, E = S->getNumOutputs(); I != E; ++I) {
7200 Names.push_back(S->getOutputIdentifier(I));
7201
7202 // No need to transform the constraint literal.
7203 Constraints.push_back(S->getOutputConstraintLiteral(I));
7204
7205 // Transform the output expr.
7206 Expr *OutputExpr = S->getOutputExpr(I);
7207 ExprResult Result = getDerived().TransformExpr(OutputExpr);
7208 if (Result.isInvalid())
7209 return StmtError();
7210
7211 ExprsChanged |= Result.get() != OutputExpr;
7212
7213 Exprs.push_back(Result.get());
7214 }
7215
7216 // Go through the inputs.
7217 for (unsigned I = 0, E = S->getNumInputs(); I != E; ++I) {
7218 Names.push_back(S->getInputIdentifier(I));
7219
7220 // No need to transform the constraint literal.
7221 Constraints.push_back(S->getInputConstraintLiteral(I));
7222
7223 // Transform the input expr.
7224 Expr *InputExpr = S->getInputExpr(I);
7225 ExprResult Result = getDerived().TransformExpr(InputExpr);
7226 if (Result.isInvalid())
7227 return StmtError();
7228
7229 ExprsChanged |= Result.get() != InputExpr;
7230
7231 Exprs.push_back(Result.get());
7232 }
7233
7234 // Go through the Labels.
7235 for (unsigned I = 0, E = S->getNumLabels(); I != E; ++I) {
7236 Names.push_back(S->getLabelIdentifier(I));
7237
7238 ExprResult Result = getDerived().TransformExpr(S->getLabelExpr(I));
7239 if (Result.isInvalid())
7240 return StmtError();
7241 ExprsChanged |= Result.get() != S->getLabelExpr(I);
7242 Exprs.push_back(Result.get());
7243 }
7244 if (!getDerived().AlwaysRebuild() && !ExprsChanged)
7245 return S;
7246
7247 // Go through the clobbers.
7248 for (unsigned I = 0, E = S->getNumClobbers(); I != E; ++I)
7249 Clobbers.push_back(S->getClobberStringLiteral(I));
7250
7251 // No need to transform the asm string literal.
7252 AsmString = S->getAsmString();
7253 return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
7254 S->isVolatile(), S->getNumOutputs(),
7255 S->getNumInputs(), Names.data(),
7256 Constraints, Exprs, AsmString.get(),
7257 Clobbers, S->getNumLabels(),
7258 S->getRParenLoc());
7259 }
7260
7261 template<typename Derived>
7262 StmtResult
7263 TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
7264 ArrayRef<Token> AsmToks =
7265 llvm::makeArrayRef(S->getAsmToks(), S->getNumAsmToks());
7266
7267 bool HadError = false, HadChange = false;
7268
7269 ArrayRef<Expr*> SrcExprs = S->getAllExprs();
7270 SmallVector<Expr*, 8> TransformedExprs;
7271 TransformedExprs.reserve(SrcExprs.size());
7272 for (unsigned i = 0, e = SrcExprs.size(); i != e; ++i) {
7273 ExprResult Result = getDerived().TransformExpr(SrcExprs[i]);
7274 if (!Result.isUsable()) {
7275 HadError = true;
7276 } else {
7277 HadChange |= (Result.get() != SrcExprs[i]);
7278 TransformedExprs.push_back(Result.get());
7279 }
7280 }
7281
7282 if (HadError) return StmtError();
7283 if (!HadChange && !getDerived().AlwaysRebuild())
7284 return Owned(S);
7285
7286 return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), S->getLBraceLoc(),
7287 AsmToks, S->getAsmString(),
7288 S->getNumOutputs(), S->getNumInputs(),
7289 S->getAllConstraints(), S->getClobbers(),
7290 TransformedExprs, S->getEndLoc());
7291 }
7292
7293 // C++ Coroutines TS
7294
7295 template<typename Derived>
7296 StmtResult
7297 TreeTransform<Derived>::TransformCoroutineBodyStmt(CoroutineBodyStmt *S) {
7298 auto *ScopeInfo = SemaRef.getCurFunction();
7299 auto *FD = cast<FunctionDecl>(SemaRef.CurContext);
7300 assert(FD && ScopeInfo && !ScopeInfo->CoroutinePromise &&
7301 ScopeInfo->NeedsCoroutineSuspends &&
7302 ScopeInfo->CoroutineSuspends.first == nullptr &&
7303 ScopeInfo->CoroutineSuspends.second == nullptr &&
7304 "expected clean scope info");
7305
7306 // Set that we have (possibly-invalid) suspend points before we do anything
7307 // that may fail.
7308 ScopeInfo->setNeedsCoroutineSuspends(false);
7309
7310 // We re-build the coroutine promise object (and the coroutine parameters its
7311 // type and constructor depend on) based on the types used in our current
7312 // function. We must do so, and set it on the current FunctionScopeInfo,
7313 // before attempting to transform the other parts of the coroutine body
7314 // statement, such as the implicit suspend statements (because those
7315 // statements reference the FunctionScopeInfo::CoroutinePromise).
7316 if (!SemaRef.buildCoroutineParameterMoves(FD->getLocation()))
7317 return StmtError();
7318 auto *Promise = SemaRef.buildCoroutinePromise(FD->getLocation());
7319 if (!Promise)
7320 return StmtError();
7321 getDerived().transformedLocalDecl(S->getPromiseDecl(), {Promise});
7322 ScopeInfo->CoroutinePromise = Promise;
7323
7324 // Transform the implicit coroutine statements constructed using dependent
7325 // types during the previous parse: initial and final suspensions, the return
7326 // object, and others. We also transform the coroutine function's body.
7327 StmtResult InitSuspend = getDerived().TransformStmt(S->getInitSuspendStmt());
7328 if (InitSuspend.isInvalid())
7329 return StmtError();
7330 StmtResult FinalSuspend =
7331 getDerived().TransformStmt(S->getFinalSuspendStmt());
7332 if (FinalSuspend.isInvalid())
7333 return StmtError();
7334 ScopeInfo->setCoroutineSuspends(InitSuspend.get(), FinalSuspend.get());
7335 assert(isa<Expr>(InitSuspend.get()) && isa<Expr>(FinalSuspend.get()));
7336
7337 StmtResult BodyRes = getDerived().TransformStmt(S->getBody());
7338 if (BodyRes.isInvalid())
7339 return StmtError();
7340
7341 CoroutineStmtBuilder Builder(SemaRef, *FD, *ScopeInfo, BodyRes.get());
7342 if (Builder.isInvalid())
7343 return StmtError();
7344
7345 Expr *ReturnObject = S->getReturnValueInit();
7346 assert(ReturnObject && "the return object is expected to be valid");
7347 ExprResult Res = getDerived().TransformInitializer(ReturnObject,
7348 /*NoCopyInit*/ false);
7349 if (Res.isInvalid())
7350 return StmtError();
7351 Builder.ReturnValue = Res.get();
7352
7353 // If during the previous parse the coroutine still had a dependent promise
7354 // statement, we may need to build some implicit coroutine statements
7355 // (such as exception and fallthrough handlers) for the first time.
7356 if (S->hasDependentPromiseType()) {
7357 // We can only build these statements, however, if the current promise type
7358 // is not dependent.
7359 if (!Promise->getType()->isDependentType()) {
7360 assert(!S->getFallthroughHandler() && !S->getExceptionHandler() &&
7361 !S->getReturnStmtOnAllocFailure() && !S->getDeallocate() &&
7362 "these nodes should not have been built yet");
7363 if (!Builder.buildDependentStatements())
7364 return StmtError();
7365 }
7366 } else {
7367 if (auto *OnFallthrough = S->getFallthroughHandler()) {
7368 StmtResult Res = getDerived().TransformStmt(OnFallthrough);
7369 if (Res.isInvalid())
7370 return StmtError();
7371 Builder.OnFallthrough = Res.get();
7372 }
7373
7374 if (auto *OnException = S->getExceptionHandler()) {
7375 StmtResult Res = getDerived().TransformStmt(OnException);
7376 if (Res.isInvalid())
7377 return StmtError();
7378 Builder.OnException = Res.get();
7379 }
7380
7381 if (auto *OnAllocFailure = S->getReturnStmtOnAllocFailure()) {
7382 StmtResult Res = getDerived().TransformStmt(OnAllocFailure);
7383 if (Res.isInvalid())
7384 return StmtError();
7385 Builder.ReturnStmtOnAllocFailure = Res.get();
7386 }
7387
7388 // Transform any additional statements we may have already built
7389 assert(S->getAllocate() && S->getDeallocate() &&
7390 "allocation and deallocation calls must already be built");
7391 ExprResult AllocRes = getDerived().TransformExpr(S->getAllocate());
7392 if (AllocRes.isInvalid())
7393 return StmtError();
7394 Builder.Allocate = AllocRes.get();
7395
7396 ExprResult DeallocRes = getDerived().TransformExpr(S->getDeallocate());
7397 if (DeallocRes.isInvalid())
7398 return StmtError();
7399 Builder.Deallocate = DeallocRes.get();
7400
7401 assert(S->getResultDecl() && "ResultDecl must already be built");
7402 StmtResult ResultDecl = getDerived().TransformStmt(S->getResultDecl());
7403 if (ResultDecl.isInvalid())
7404 return StmtError();
7405 Builder.ResultDecl = ResultDecl.get();
7406
7407 if (auto *ReturnStmt = S->getReturnStmt()) {
7408 StmtResult Res = getDerived().TransformStmt(ReturnStmt);
7409 if (Res.isInvalid())
7410 return StmtError();
7411 Builder.ReturnStmt = Res.get();
7412 }
7413 }
7414
7415 return getDerived().RebuildCoroutineBodyStmt(Builder);
7416 }
7417
7418 template<typename Derived>
7419 StmtResult
7420 TreeTransform<Derived>::TransformCoreturnStmt(CoreturnStmt *S) {
7421 ExprResult Result = getDerived().TransformInitializer(S->getOperand(),
7422 /*NotCopyInit*/false);
7423 if (Result.isInvalid())
7424 return StmtError();
7425
7426 // Always rebuild; we don't know if this needs to be injected into a new
7427 // context or if the promise type has changed.
7428 return getDerived().RebuildCoreturnStmt(S->getKeywordLoc(), Result.get(),
7429 S->isImplicit());
7430 }
7431
7432 template<typename Derived>
7433 ExprResult
7434 TreeTransform<Derived>::TransformCoawaitExpr(CoawaitExpr *E) {
7435 ExprResult Result = getDerived().TransformInitializer(E->getOperand(),
7436 /*NotCopyInit*/false);
7437 if (Result.isInvalid())
7438 return ExprError();
7439
7440 // Always rebuild; we don't know if this needs to be injected into a new
7441 // context or if the promise type has changed.
7442 return getDerived().RebuildCoawaitExpr(E->getKeywordLoc(), Result.get(),
7443 E->isImplicit());
7444 }
7445
7446 template <typename Derived>
7447 ExprResult
7448 TreeTransform<Derived>::TransformDependentCoawaitExpr(DependentCoawaitExpr *E) {
7449 ExprResult OperandResult = getDerived().TransformInitializer(E->getOperand(),
7450 /*NotCopyInit*/ false);
7451 if (OperandResult.isInvalid())
7452 return ExprError();
7453
7454 ExprResult LookupResult = getDerived().TransformUnresolvedLookupExpr(
7455 E->getOperatorCoawaitLookup());
7456
7457 if (LookupResult.isInvalid())
7458 return ExprError();
7459
7460 // Always rebuild; we don't know if this needs to be injected into a new
7461 // context or if the promise type has changed.
7462 return getDerived().RebuildDependentCoawaitExpr(
7463 E->getKeywordLoc(), OperandResult.get(),
7464 cast<UnresolvedLookupExpr>(LookupResult.get()));
7465 }
7466
7467 template<typename Derived>
7468 ExprResult
7469 TreeTransform<Derived>::TransformCoyieldExpr(CoyieldExpr *E) {
7470 ExprResult Result = getDerived().TransformInitializer(E->getOperand(),
7471 /*NotCopyInit*/false);
7472 if (Result.isInvalid())
7473 return ExprError();
7474
7475 // Always rebuild; we don't know if this needs to be injected into a new
7476 // context or if the promise type has changed.
7477 return getDerived().RebuildCoyieldExpr(E->getKeywordLoc(), Result.get());
7478 }
7479
7480 // Objective-C Statements.
7481
7482 template<typename Derived>
7483 StmtResult
7484 TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
7485 // Transform the body of the @try.
7486 StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
7487 if (TryBody.isInvalid())
7488 return StmtError();
7489
7490 // Transform the @catch statements (if present).
7491 bool AnyCatchChanged = false;
7492 SmallVector<Stmt*, 8> CatchStmts;
7493 for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
7494 StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
7495 if (Catch.isInvalid())
7496 return StmtError();
7497 if (Catch.get() != S->getCatchStmt(I))
7498 AnyCatchChanged = true;
7499 CatchStmts.push_back(Catch.get());
7500 }
7501
7502 // Transform the @finally statement (if present).
7503 StmtResult Finally;
7504 if (S->getFinallyStmt()) {
7505 Finally = getDerived().TransformStmt(S->getFinallyStmt());
7506 if (Finally.isInvalid())
7507 return StmtError();
7508 }
7509
7510 // If nothing changed, just retain this statement.
7511 if (!getDerived().AlwaysRebuild() &&
7512 TryBody.get() == S->getTryBody() &&
7513 !AnyCatchChanged &&
7514 Finally.get() == S->getFinallyStmt())
7515 return S;
7516
7517 // Build a new statement.
7518 return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
7519 CatchStmts, Finally.get());
7520 }
7521
7522 template<typename Derived>
7523 StmtResult
7524 TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
7525 // Transform the @catch parameter, if there is one.
7526 VarDecl *Var = nullptr;
7527 if (VarDecl *FromVar = S->getCatchParamDecl()) {
7528 TypeSourceInfo *TSInfo = nullptr;
7529 if (FromVar->getTypeSourceInfo()) {
7530 TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
7531 if (!TSInfo)
7532 return StmtError();
7533 }
7534
7535 QualType T;
7536 if (TSInfo)
7537 T = TSInfo->getType();
7538 else {
7539 T = getDerived().TransformType(FromVar->getType());
7540 if (T.isNull())
7541 return StmtError();
7542 }
7543
7544 Var = getDerived().RebuildObjCExceptionDecl(FromVar, TSInfo, T);
7545 if (!Var)
7546 return StmtError();
7547 }
7548
7549 StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
7550 if (Body.isInvalid())
7551 return StmtError();
7552
7553 return getDerived().RebuildObjCAtCatchStmt(S->getAtCatchLoc(),
7554 S->getRParenLoc(),
7555 Var, Body.get());
7556 }
7557
7558 template<typename Derived>
7559 StmtResult
7560 TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
7561 // Transform the body.
7562 StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
7563 if (Body.isInvalid())
7564 return StmtError();
7565
7566 // If nothing changed, just retain this statement.
7567 if (!getDerived().AlwaysRebuild() &&
7568 Body.get() == S->getFinallyBody())
7569 return S;
7570
7571 // Build a new statement.
7572 return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
7573 Body.get());
7574 }
7575
7576 template<typename Derived>
7577 StmtResult
7578 TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
7579 ExprResult Operand;
7580 if (S->getThrowExpr()) {
7581 Operand = getDerived().TransformExpr(S->getThrowExpr());
7582 if (Operand.isInvalid())
7583 return StmtError();
7584 }
7585
7586 if (!getDerived().AlwaysRebuild() &&
7587 Operand.get() == S->getThrowExpr())
7588 return S;
7589
7590 return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(), Operand.get());
7591 }
7592
7593 template<typename Derived>
7594 StmtResult
7595 TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
7596 ObjCAtSynchronizedStmt *S) {
7597 // Transform the object we are locking.
7598 ExprResult Object = getDerived().TransformExpr(S->getSynchExpr());
7599 if (Object.isInvalid())
7600 return StmtError();
7601 Object =
7602 getDerived().RebuildObjCAtSynchronizedOperand(S->getAtSynchronizedLoc(),
7603 Object.get());
7604 if (Object.isInvalid())
7605 return StmtError();
7606
7607 // Transform the body.
7608 StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
7609 if (Body.isInvalid())
7610 return StmtError();
7611
7612 // If nothing change, just retain the current statement.
7613 if (!getDerived().AlwaysRebuild() &&
7614 Object.get() == S->getSynchExpr() &&
7615 Body.get() == S->getSynchBody())
7616 return S;
7617
7618 // Build a new statement.
7619 return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
7620 Object.get(), Body.get());
7621 }
7622
7623 template<typename Derived>
7624 StmtResult
7625 TreeTransform<Derived>::TransformObjCAutoreleasePoolStmt(
7626 ObjCAutoreleasePoolStmt *S) {
7627 // Transform the body.
7628 StmtResult Body = getDerived().TransformStmt(S->getSubStmt());
7629 if (Body.isInvalid())
7630 return StmtError();
7631
7632 // If nothing changed, just retain this statement.
7633 if (!getDerived().AlwaysRebuild() &&
7634 Body.get() == S->getSubStmt())
7635 return S;
7636
7637 // Build a new statement.
7638 return getDerived().RebuildObjCAutoreleasePoolStmt(
7639 S->getAtLoc(), Body.get());
7640 }
7641
7642 template<typename Derived>
7643 StmtResult
7644 TreeTransform<Derived>::TransformObjCForCollectionStmt(
7645 ObjCForCollectionStmt *S) {
7646 // Transform the element statement.
7647 StmtResult Element =
7648 getDerived().TransformStmt(S->getElement(), SDK_NotDiscarded);
7649 if (Element.isInvalid())
7650 return StmtError();
7651
7652 // Transform the collection expression.
7653 ExprResult Collection = getDerived().TransformExpr(S->getCollection());
7654 if (Collection.isInvalid())
7655 return StmtError();
7656
7657 // Transform the body.
7658 StmtResult Body = getDerived().TransformStmt(S->getBody());
7659 if (Body.isInvalid())
7660 return StmtError();
7661
7662 // If nothing changed, just retain this statement.
7663 if (!getDerived().AlwaysRebuild() &&
7664 Element.get() == S->getElement() &&
7665 Collection.get() == S->getCollection() &&
7666 Body.get() == S->getBody())
7667 return S;
7668
7669 // Build a new statement.
7670 return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
7671 Element.get(),
7672 Collection.get(),
7673 S->getRParenLoc(),
7674 Body.get());
7675 }
7676
7677 template <typename Derived>
7678 StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
7679 // Transform the exception declaration, if any.
7680 VarDecl *Var = nullptr;
7681 if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
7682 TypeSourceInfo *T =
7683 getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
7684 if (!T)
7685 return StmtError();
7686
7687 Var = getDerived().RebuildExceptionDecl(
7688 ExceptionDecl, T, ExceptionDecl->getInnerLocStart(),
7689 ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier());
7690 if (!Var || Var->isInvalidDecl())
7691 return StmtError();
7692 }
7693
7694 // Transform the actual exception handler.
7695 StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
7696 if (Handler.isInvalid())
7697 return StmtError();
7698
7699 if (!getDerived().AlwaysRebuild() && !Var &&
7700 Handler.get() == S->getHandlerBlock())
7701 return S;
7702
7703 return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
7704 }
7705
7706 template <typename Derived>
7707 StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
7708 // Transform the try block itself.
7709 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
7710 if (TryBlock.isInvalid())
7711 return StmtError();
7712
7713 // Transform the handlers.
7714 bool HandlerChanged = false;
7715 SmallVector<Stmt *, 8> Handlers;
7716 for (unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
7717 StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I));
7718 if (Handler.isInvalid())
7719 return StmtError();
7720
7721 HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
7722 Handlers.push_back(Handler.getAs<Stmt>());
7723 }
7724
7725 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
7726 !HandlerChanged)
7727 return S;
7728
7729 return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
7730 Handlers);
7731 }
7732
7733 template<typename Derived>
7734 StmtResult
7735 TreeTransform<Derived>::TransformCXXForRangeStmt(CXXForRangeStmt *S) {
7736 StmtResult Init =
7737 S->getInit() ? getDerived().TransformStmt(S->getInit()) : StmtResult();
7738 if (Init.isInvalid())
7739 return StmtError();
7740
7741 StmtResult Range = getDerived().TransformStmt(S->getRangeStmt());
7742 if (Range.isInvalid())
7743 return StmtError();
7744
7745 StmtResult Begin = getDerived().TransformStmt(S->getBeginStmt());
7746 if (Begin.isInvalid())
7747 return StmtError();
7748 StmtResult End = getDerived().TransformStmt(S->getEndStmt());
7749 if (End.isInvalid())
7750 return StmtError();
7751
7752 ExprResult Cond = getDerived().TransformExpr(S->getCond());
7753 if (Cond.isInvalid())
7754 return StmtError();
7755 if (Cond.get())
7756 Cond = SemaRef.CheckBooleanCondition(S->getColonLoc(), Cond.get());
7757 if (Cond.isInvalid())
7758 return StmtError();
7759 if (Cond.get())
7760 Cond = SemaRef.MaybeCreateExprWithCleanups(Cond.get());
7761
7762 ExprResult Inc = getDerived().TransformExpr(S->getInc());
7763 if (Inc.isInvalid())
7764 return StmtError();
7765 if (Inc.get())
7766 Inc = SemaRef.MaybeCreateExprWithCleanups(Inc.get());
7767
7768 StmtResult LoopVar = getDerived().TransformStmt(S->getLoopVarStmt());
7769 if (LoopVar.isInvalid())
7770 return StmtError();
7771
7772 StmtResult NewStmt = S;
7773 if (getDerived().AlwaysRebuild() ||
7774 Init.get() != S->getInit() ||
7775 Range.get() != S->getRangeStmt() ||
7776 Begin.get() != S->getBeginStmt() ||
7777 End.get() != S->getEndStmt() ||
7778 Cond.get() != S->getCond() ||
7779 Inc.get() != S->getInc() ||
7780 LoopVar.get() != S->getLoopVarStmt()) {
7781 NewStmt = getDerived().RebuildCXXForRangeStmt(S->getForLoc(),
7782 S->getCoawaitLoc(), Init.get(),
7783 S->getColonLoc(), Range.get(),
7784 Begin.get(), End.get(),
7785 Cond.get(),
7786 Inc.get(), LoopVar.get(),
7787 S->getRParenLoc());
7788 if (NewStmt.isInvalid())
7789 return StmtError();
7790 }
7791
7792 StmtResult Body = getDerived().TransformStmt(S->getBody());
7793 if (Body.isInvalid())
7794 return StmtError();
7795
7796 // Body has changed but we didn't rebuild the for-range statement. Rebuild
7797 // it now so we have a new statement to attach the body to.
7798 if (Body.get() != S->getBody() && NewStmt.get() == S) {
7799 NewStmt = getDerived().RebuildCXXForRangeStmt(S->getForLoc(),
7800 S->getCoawaitLoc(), Init.get(),
7801 S->getColonLoc(), Range.get(),
7802 Begin.get(), End.get(),
7803 Cond.get(),
7804 Inc.get(), LoopVar.get(),
7805 S->getRParenLoc());
7806 if (NewStmt.isInvalid())
7807 return StmtError();
7808 }
7809
7810 if (NewStmt.get() == S)
7811 return S;
7812
7813 return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
7814 }
7815
7816 template<typename Derived>
7817 StmtResult
7818 TreeTransform<Derived>::TransformMSDependentExistsStmt(
7819 MSDependentExistsStmt *S) {
7820 // Transform the nested-name-specifier, if any.
7821 NestedNameSpecifierLoc QualifierLoc;
7822 if (S->getQualifierLoc()) {
7823 QualifierLoc
7824 = getDerived().TransformNestedNameSpecifierLoc(S->getQualifierLoc());
7825 if (!QualifierLoc)
7826 return StmtError();
7827 }
7828
7829 // Transform the declaration name.
7830 DeclarationNameInfo NameInfo = S->getNameInfo();
7831 if (NameInfo.getName()) {
7832 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
7833 if (!NameInfo.getName())
7834 return StmtError();
7835 }
7836
7837 // Check whether anything changed.
7838 if (!getDerived().AlwaysRebuild() &&
7839 QualifierLoc == S->getQualifierLoc() &&
7840 NameInfo.getName() == S->getNameInfo().getName())
7841 return S;
7842
7843 // Determine whether this name exists, if we can.
7844 CXXScopeSpec SS;
7845 SS.Adopt(QualifierLoc);
7846 bool Dependent = false;
7847 switch (getSema().CheckMicrosoftIfExistsSymbol(/*S=*/nullptr, SS, NameInfo)) {
7848 case Sema::IER_Exists:
7849 if (S->isIfExists())
7850 break;
7851
7852 return new (getSema().Context) NullStmt(S->getKeywordLoc());
7853
7854 case Sema::IER_DoesNotExist:
7855 if (S->isIfNotExists())
7856 break;
7857
7858 return new (getSema().Context) NullStmt(S->getKeywordLoc());
7859
7860 case Sema::IER_Dependent:
7861 Dependent = true;
7862 break;
7863
7864 case Sema::IER_Error:
7865 return StmtError();
7866 }
7867
7868 // We need to continue with the instantiation, so do so now.
7869 StmtResult SubStmt = getDerived().TransformCompoundStmt(S->getSubStmt());
7870 if (SubStmt.isInvalid())
7871 return StmtError();
7872
7873 // If we have resolved the name, just transform to the substatement.
7874 if (!Dependent)
7875 return SubStmt;
7876
7877 // The name is still dependent, so build a dependent expression again.
7878 return getDerived().RebuildMSDependentExistsStmt(S->getKeywordLoc(),
7879 S->isIfExists(),
7880 QualifierLoc,
7881 NameInfo,
7882 SubStmt.get());
7883 }
7884
7885 template<typename Derived>
7886 ExprResult
7887 TreeTransform<Derived>::TransformMSPropertyRefExpr(MSPropertyRefExpr *E) {
7888 NestedNameSpecifierLoc QualifierLoc;
7889 if (E->getQualifierLoc()) {
7890 QualifierLoc
7891 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
7892 if (!QualifierLoc)
7893 return ExprError();
7894 }
7895
7896 MSPropertyDecl *PD = cast_or_null<MSPropertyDecl>(
7897 getDerived().TransformDecl(E->getMemberLoc(), E->getPropertyDecl()));
7898 if (!PD)
7899 return ExprError();
7900
7901 ExprResult Base = getDerived().TransformExpr(E->getBaseExpr());
7902 if (Base.isInvalid())
7903 return ExprError();
7904
7905 return new (SemaRef.getASTContext())
7906 MSPropertyRefExpr(Base.get(), PD, E->isArrow(),
7907 SemaRef.getASTContext().PseudoObjectTy, VK_LValue,
7908 QualifierLoc, E->getMemberLoc());
7909 }
7910
7911 template <typename Derived>
7912 ExprResult TreeTransform<Derived>::TransformMSPropertySubscriptExpr(
7913 MSPropertySubscriptExpr *E) {
7914 auto BaseRes = getDerived().TransformExpr(E->getBase());
7915 if (BaseRes.isInvalid())
7916 return ExprError();
7917 auto IdxRes = getDerived().TransformExpr(E->getIdx());
7918 if (IdxRes.isInvalid())
7919 return ExprError();
7920
7921 if (!getDerived().AlwaysRebuild() &&
7922 BaseRes.get() == E->getBase() &&
7923 IdxRes.get() == E->getIdx())
7924 return E;
7925
7926 return getDerived().RebuildArraySubscriptExpr(
7927 BaseRes.get(), SourceLocation(), IdxRes.get(), E->getRBracketLoc());
7928 }
7929
7930 template <typename Derived>
7931 StmtResult TreeTransform<Derived>::TransformSEHTryStmt(SEHTryStmt *S) {
7932 StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock());
7933 if (TryBlock.isInvalid())
7934 return StmtError();
7935
7936 StmtResult Handler = getDerived().TransformSEHHandler(S->getHandler());
7937 if (Handler.isInvalid())
7938 return StmtError();
7939
7940 if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
7941 Handler.get() == S->getHandler())
7942 return S;
7943
7944 return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
7945 TryBlock.get(), Handler.get());
7946 }
7947
7948 template <typename Derived>
7949 StmtResult TreeTransform<Derived>::TransformSEHFinallyStmt(SEHFinallyStmt *S) {
7950 StmtResult Block = getDerived().TransformCompoundStmt(S->getBlock());
7951 if (Block.isInvalid())
7952 return StmtError();
7953
7954 return getDerived().RebuildSEHFinallyStmt(S->getFinallyLoc(), Block.get());
7955 }
7956
7957 template <typename Derived>
7958 StmtResult TreeTransform<Derived>::TransformSEHExceptStmt(SEHExceptStmt *S) {
7959 ExprResult FilterExpr = getDerived().TransformExpr(S->getFilterExpr());
7960 if (FilterExpr.isInvalid())
7961 return StmtError();
7962
7963 StmtResult Block = getDerived().TransformCompoundStmt(S->getBlock());
7964 if (Block.isInvalid())
7965 return StmtError();
7966
7967 return getDerived().RebuildSEHExceptStmt(S->getExceptLoc(), FilterExpr.get(),
7968 Block.get());
7969 }
7970
7971 template <typename Derived>
7972 StmtResult TreeTransform<Derived>::TransformSEHHandler(Stmt *Handler) {
7973 if (isa<SEHFinallyStmt>(Handler))
7974 return getDerived().TransformSEHFinallyStmt(cast<SEHFinallyStmt>(Handler));
7975 else
7976 return getDerived().TransformSEHExceptStmt(cast<SEHExceptStmt>(Handler));
7977 }
7978
7979 template<typename Derived>
7980 StmtResult
7981 TreeTransform<Derived>::TransformSEHLeaveStmt(SEHLeaveStmt *S) {
7982 return S;
7983 }
7984
7985 //===----------------------------------------------------------------------===//
7986 // OpenMP directive transformation
7987 //===----------------------------------------------------------------------===//
7988 template <typename Derived>
7989 StmtResult TreeTransform<Derived>::TransformOMPExecutableDirective(
7990 OMPExecutableDirective *D) {
7991
7992 // Transform the clauses
7993 llvm::SmallVector<OMPClause *, 16> TClauses;
7994 ArrayRef<OMPClause *> Clauses = D->clauses();
7995 TClauses.reserve(Clauses.size());
7996 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
7997 I != E; ++I) {
7998 if (*I) {
7999 getDerived().getSema().StartOpenMPClause((*I)->getClauseKind());
8000 OMPClause *Clause = getDerived().TransformOMPClause(*I);
8001 getDerived().getSema().EndOpenMPClause();
8002 if (Clause)
8003 TClauses.push_back(Clause);
8004 } else {
8005 TClauses.push_back(nullptr);
8006 }
8007 }
8008 StmtResult AssociatedStmt;
8009 if (D->hasAssociatedStmt() && D->getAssociatedStmt()) {
8010 getDerived().getSema().ActOnOpenMPRegionStart(D->getDirectiveKind(),
8011 /*CurScope=*/nullptr);
8012 StmtResult Body;
8013 {
8014 Sema::CompoundScopeRAII CompoundScope(getSema());
8015 Stmt *CS = D->getInnermostCapturedStmt()->getCapturedStmt();
8016 Body = getDerived().TransformStmt(CS);
8017 }
8018 AssociatedStmt =
8019 getDerived().getSema().ActOnOpenMPRegionEnd(Body, TClauses);
8020 if (AssociatedStmt.isInvalid()) {
8021 return StmtError();
8022 }
8023 }
8024 if (TClauses.size() != Clauses.size()) {
8025 return StmtError();
8026 }
8027
8028 // Transform directive name for 'omp critical' directive.
8029 DeclarationNameInfo DirName;
8030 if (D->getDirectiveKind() == OMPD_critical) {
8031 DirName = cast<OMPCriticalDirective>(D)->getDirectiveName();
8032 DirName = getDerived().TransformDeclarationNameInfo(DirName);
8033 }
8034 OpenMPDirectiveKind CancelRegion = OMPD_unknown;
8035 if (D->getDirectiveKind() == OMPD_cancellation_point) {
8036 CancelRegion = cast<OMPCancellationPointDirective>(D)->getCancelRegion();
8037 } else if (D->getDirectiveKind() == OMPD_cancel) {
8038 CancelRegion = cast<OMPCancelDirective>(D)->getCancelRegion();
8039 }
8040
8041 return getDerived().RebuildOMPExecutableDirective(
8042 D->getDirectiveKind(), DirName, CancelRegion, TClauses,
8043 AssociatedStmt.get(), D->getBeginLoc(), D->getEndLoc());
8044 }
8045
8046 template <typename Derived>
8047 StmtResult
8048 TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
8049 DeclarationNameInfo DirName;
8050 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, nullptr,
8051 D->getBeginLoc());
8052 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8053 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8054 return Res;
8055 }
8056
8057 template <typename Derived>
8058 StmtResult
8059 TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
8060 DeclarationNameInfo DirName;
8061 getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName, nullptr,
8062 D->getBeginLoc());
8063 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8064 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8065 return Res;
8066 }
8067
8068 template <typename Derived>
8069 StmtResult
8070 TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *D) {
8071 DeclarationNameInfo DirName;
8072 getDerived().getSema().StartOpenMPDSABlock(OMPD_for, DirName, nullptr,
8073 D->getBeginLoc());
8074 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8075 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8076 return Res;
8077 }
8078
8079 template <typename Derived>
8080 StmtResult
8081 TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *D) {
8082 DeclarationNameInfo DirName;
8083 getDerived().getSema().StartOpenMPDSABlock(OMPD_for_simd, DirName, nullptr,
8084 D->getBeginLoc());
8085 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8086 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8087 return Res;
8088 }
8089
8090 template <typename Derived>
8091 StmtResult
8092 TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *D) {
8093 DeclarationNameInfo DirName;
8094 getDerived().getSema().StartOpenMPDSABlock(OMPD_sections, DirName, nullptr,
8095 D->getBeginLoc());
8096 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8097 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8098 return Res;
8099 }
8100
8101 template <typename Derived>
8102 StmtResult
8103 TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *D) {
8104 DeclarationNameInfo DirName;
8105 getDerived().getSema().StartOpenMPDSABlock(OMPD_section, DirName, nullptr,
8106 D->getBeginLoc());
8107 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8108 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8109 return Res;
8110 }
8111
8112 template <typename Derived>
8113 StmtResult
8114 TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *D) {
8115 DeclarationNameInfo DirName;
8116 getDerived().getSema().StartOpenMPDSABlock(OMPD_single, DirName, nullptr,
8117 D->getBeginLoc());
8118 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8119 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8120 return Res;
8121 }
8122
8123 template <typename Derived>
8124 StmtResult
8125 TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *D) {
8126 DeclarationNameInfo DirName;
8127 getDerived().getSema().StartOpenMPDSABlock(OMPD_master, DirName, nullptr,
8128 D->getBeginLoc());
8129 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8130 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8131 return Res;
8132 }
8133
8134 template <typename Derived>
8135 StmtResult
8136 TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *D) {
8137 getDerived().getSema().StartOpenMPDSABlock(
8138 OMPD_critical, D->getDirectiveName(), nullptr, D->getBeginLoc());
8139 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8140 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8141 return Res;
8142 }
8143
8144 template <typename Derived>
8145 StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
8146 OMPParallelForDirective *D) {
8147 DeclarationNameInfo DirName;
8148 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for, DirName,
8149 nullptr, D->getBeginLoc());
8150 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8151 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8152 return Res;
8153 }
8154
8155 template <typename Derived>
8156 StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
8157 OMPParallelForSimdDirective *D) {
8158 DeclarationNameInfo DirName;
8159 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for_simd, DirName,
8160 nullptr, D->getBeginLoc());
8161 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8162 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8163 return Res;
8164 }
8165
8166 template <typename Derived>
8167 StmtResult TreeTransform<Derived>::TransformOMPParallelMasterDirective(
8168 OMPParallelMasterDirective *D) {
8169 DeclarationNameInfo DirName;
8170 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_master, DirName,
8171 nullptr, D->getBeginLoc());
8172 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8173 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8174 return Res;
8175 }
8176
8177 template <typename Derived>
8178 StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
8179 OMPParallelSectionsDirective *D) {
8180 DeclarationNameInfo DirName;
8181 getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_sections, DirName,
8182 nullptr, D->getBeginLoc());
8183 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8184 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8185 return Res;
8186 }
8187
8188 template <typename Derived>
8189 StmtResult
8190 TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *D) {
8191 DeclarationNameInfo DirName;
8192 getDerived().getSema().StartOpenMPDSABlock(OMPD_task, DirName, nullptr,
8193 D->getBeginLoc());
8194 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8195 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8196 return Res;
8197 }
8198
8199 template <typename Derived>
8200 StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
8201 OMPTaskyieldDirective *D) {
8202 DeclarationNameInfo DirName;
8203 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskyield, DirName, nullptr,
8204 D->getBeginLoc());
8205 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8206 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8207 return Res;
8208 }
8209
8210 template <typename Derived>
8211 StmtResult
8212 TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *D) {
8213 DeclarationNameInfo DirName;
8214 getDerived().getSema().StartOpenMPDSABlock(OMPD_barrier, DirName, nullptr,
8215 D->getBeginLoc());
8216 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8217 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8218 return Res;
8219 }
8220
8221 template <typename Derived>
8222 StmtResult
8223 TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
8224 DeclarationNameInfo DirName;
8225 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskwait, DirName, nullptr,
8226 D->getBeginLoc());
8227 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8228 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8229 return Res;
8230 }
8231
8232 template <typename Derived>
8233 StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
8234 OMPTaskgroupDirective *D) {
8235 DeclarationNameInfo DirName;
8236 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskgroup, DirName, nullptr,
8237 D->getBeginLoc());
8238 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8239 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8240 return Res;
8241 }
8242
8243 template <typename Derived>
8244 StmtResult
8245 TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *D) {
8246 DeclarationNameInfo DirName;
8247 getDerived().getSema().StartOpenMPDSABlock(OMPD_flush, DirName, nullptr,
8248 D->getBeginLoc());
8249 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8250 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8251 return Res;
8252 }
8253
8254 template <typename Derived>
8255 StmtResult
8256 TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *D) {
8257 DeclarationNameInfo DirName;
8258 getDerived().getSema().StartOpenMPDSABlock(OMPD_ordered, DirName, nullptr,
8259 D->getBeginLoc());
8260 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8261 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8262 return Res;
8263 }
8264
8265 template <typename Derived>
8266 StmtResult
8267 TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *D) {
8268 DeclarationNameInfo DirName;
8269 getDerived().getSema().StartOpenMPDSABlock(OMPD_atomic, DirName, nullptr,
8270 D->getBeginLoc());
8271 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8272 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8273 return Res;
8274 }
8275
8276 template <typename Derived>
8277 StmtResult
8278 TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *D) {
8279 DeclarationNameInfo DirName;
8280 getDerived().getSema().StartOpenMPDSABlock(OMPD_target, DirName, nullptr,
8281 D->getBeginLoc());
8282 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8283 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8284 return Res;
8285 }
8286
8287 template <typename Derived>
8288 StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
8289 OMPTargetDataDirective *D) {
8290 DeclarationNameInfo DirName;
8291 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_data, DirName, nullptr,
8292 D->getBeginLoc());
8293 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8294 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8295 return Res;
8296 }
8297
8298 template <typename Derived>
8299 StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
8300 OMPTargetEnterDataDirective *D) {
8301 DeclarationNameInfo DirName;
8302 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_enter_data, DirName,
8303 nullptr, D->getBeginLoc());
8304 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8305 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8306 return Res;
8307 }
8308
8309 template <typename Derived>
8310 StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
8311 OMPTargetExitDataDirective *D) {
8312 DeclarationNameInfo DirName;
8313 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_exit_data, DirName,
8314 nullptr, D->getBeginLoc());
8315 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8316 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8317 return Res;
8318 }
8319
8320 template <typename Derived>
8321 StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
8322 OMPTargetParallelDirective *D) {
8323 DeclarationNameInfo DirName;
8324 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel, DirName,
8325 nullptr, D->getBeginLoc());
8326 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8327 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8328 return Res;
8329 }
8330
8331 template <typename Derived>
8332 StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
8333 OMPTargetParallelForDirective *D) {
8334 DeclarationNameInfo DirName;
8335 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for, DirName,
8336 nullptr, D->getBeginLoc());
8337 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8338 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8339 return Res;
8340 }
8341
8342 template <typename Derived>
8343 StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
8344 OMPTargetUpdateDirective *D) {
8345 DeclarationNameInfo DirName;
8346 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_update, DirName,
8347 nullptr, D->getBeginLoc());
8348 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8349 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8350 return Res;
8351 }
8352
8353 template <typename Derived>
8354 StmtResult
8355 TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *D) {
8356 DeclarationNameInfo DirName;
8357 getDerived().getSema().StartOpenMPDSABlock(OMPD_teams, DirName, nullptr,
8358 D->getBeginLoc());
8359 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8360 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8361 return Res;
8362 }
8363
8364 template <typename Derived>
8365 StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
8366 OMPCancellationPointDirective *D) {
8367 DeclarationNameInfo DirName;
8368 getDerived().getSema().StartOpenMPDSABlock(OMPD_cancellation_point, DirName,
8369 nullptr, D->getBeginLoc());
8370 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8371 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8372 return Res;
8373 }
8374
8375 template <typename Derived>
8376 StmtResult
8377 TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *D) {
8378 DeclarationNameInfo DirName;
8379 getDerived().getSema().StartOpenMPDSABlock(OMPD_cancel, DirName, nullptr,
8380 D->getBeginLoc());
8381 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8382 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8383 return Res;
8384 }
8385
8386 template <typename Derived>
8387 StmtResult
8388 TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
8389 DeclarationNameInfo DirName;
8390 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop, DirName, nullptr,
8391 D->getBeginLoc());
8392 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8393 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8394 return Res;
8395 }
8396
8397 template <typename Derived>
8398 StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
8399 OMPTaskLoopSimdDirective *D) {
8400 DeclarationNameInfo DirName;
8401 getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop_simd, DirName,
8402 nullptr, D->getBeginLoc());
8403 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8404 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8405 return Res;
8406 }
8407
8408 template <typename Derived>
8409 StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopDirective(
8410 OMPMasterTaskLoopDirective *D) {
8411 DeclarationNameInfo DirName;
8412 getDerived().getSema().StartOpenMPDSABlock(OMPD_master_taskloop, DirName,
8413 nullptr, D->getBeginLoc());
8414 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8415 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8416 return Res;
8417 }
8418
8419 template <typename Derived>
8420 StmtResult TreeTransform<Derived>::TransformOMPMasterTaskLoopSimdDirective(
8421 OMPMasterTaskLoopSimdDirective *D) {
8422 DeclarationNameInfo DirName;
8423 getDerived().getSema().StartOpenMPDSABlock(OMPD_master_taskloop_simd, DirName,
8424 nullptr, D->getBeginLoc());
8425 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8426 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8427 return Res;
8428 }
8429
8430 template <typename Derived>
8431 StmtResult TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopDirective(
8432 OMPParallelMasterTaskLoopDirective *D) {
8433 DeclarationNameInfo DirName;
8434 getDerived().getSema().StartOpenMPDSABlock(
8435 OMPD_parallel_master_taskloop, DirName, nullptr, D->getBeginLoc());
8436 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8437 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8438 return Res;
8439 }
8440
8441 template <typename Derived>
8442 StmtResult
8443 TreeTransform<Derived>::TransformOMPParallelMasterTaskLoopSimdDirective(
8444 OMPParallelMasterTaskLoopSimdDirective *D) {
8445 DeclarationNameInfo DirName;
8446 getDerived().getSema().StartOpenMPDSABlock(
8447 OMPD_parallel_master_taskloop_simd, DirName, nullptr, D->getBeginLoc());
8448 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8449 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8450 return Res;
8451 }
8452
8453 template <typename Derived>
8454 StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
8455 OMPDistributeDirective *D) {
8456 DeclarationNameInfo DirName;
8457 getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName, nullptr,
8458 D->getBeginLoc());
8459 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8460 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8461 return Res;
8462 }
8463
8464 template <typename Derived>
8465 StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
8466 OMPDistributeParallelForDirective *D) {
8467 DeclarationNameInfo DirName;
8468 getDerived().getSema().StartOpenMPDSABlock(
8469 OMPD_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
8470 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8471 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8472 return Res;
8473 }
8474
8475 template <typename Derived>
8476 StmtResult
8477 TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
8478 OMPDistributeParallelForSimdDirective *D) {
8479 DeclarationNameInfo DirName;
8480 getDerived().getSema().StartOpenMPDSABlock(
8481 OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
8482 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8483 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8484 return Res;
8485 }
8486
8487 template <typename Derived>
8488 StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
8489 OMPDistributeSimdDirective *D) {
8490 DeclarationNameInfo DirName;
8491 getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute_simd, DirName,
8492 nullptr, D->getBeginLoc());
8493 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8494 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8495 return Res;
8496 }
8497
8498 template <typename Derived>
8499 StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
8500 OMPTargetParallelForSimdDirective *D) {
8501 DeclarationNameInfo DirName;
8502 getDerived().getSema().StartOpenMPDSABlock(
8503 OMPD_target_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
8504 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8505 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8506 return Res;
8507 }
8508
8509 template <typename Derived>
8510 StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
8511 OMPTargetSimdDirective *D) {
8512 DeclarationNameInfo DirName;
8513 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_simd, DirName, nullptr,
8514 D->getBeginLoc());
8515 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8516 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8517 return Res;
8518 }
8519
8520 template <typename Derived>
8521 StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
8522 OMPTeamsDistributeDirective *D) {
8523 DeclarationNameInfo DirName;
8524 getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute, DirName,
8525 nullptr, D->getBeginLoc());
8526 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8527 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8528 return Res;
8529 }
8530
8531 template <typename Derived>
8532 StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
8533 OMPTeamsDistributeSimdDirective *D) {
8534 DeclarationNameInfo DirName;
8535 getDerived().getSema().StartOpenMPDSABlock(
8536 OMPD_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
8537 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8538 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8539 return Res;
8540 }
8541
8542 template <typename Derived>
8543 StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDirective(
8544 OMPTeamsDistributeParallelForSimdDirective *D) {
8545 DeclarationNameInfo DirName;
8546 getDerived().getSema().StartOpenMPDSABlock(
8547 OMPD_teams_distribute_parallel_for_simd, DirName, nullptr,
8548 D->getBeginLoc());
8549 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8550 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8551 return Res;
8552 }
8553
8554 template <typename Derived>
8555 StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
8556 OMPTeamsDistributeParallelForDirective *D) {
8557 DeclarationNameInfo DirName;
8558 getDerived().getSema().StartOpenMPDSABlock(
8559 OMPD_teams_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
8560 StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
8561 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8562 return Res;
8563 }
8564
8565 template <typename Derived>
8566 StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
8567 OMPTargetTeamsDirective *D) {
8568 DeclarationNameInfo DirName;
8569 getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams, DirName,
8570 nullptr, D->getBeginLoc());
8571 auto Res = getDerived().TransformOMPExecutableDirective(D);
8572 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8573 return Res;
8574 }
8575
8576 template <typename Derived>
8577 StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
8578 OMPTargetTeamsDistributeDirective *D) {
8579 DeclarationNameInfo DirName;
8580 getDerived().getSema().StartOpenMPDSABlock(
8581 OMPD_target_teams_distribute, DirName, nullptr, D->getBeginLoc());
8582 auto Res = getDerived().TransformOMPExecutableDirective(D);
8583 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8584 return Res;
8585 }
8586
8587 template <typename Derived>
8588 StmtResult
8589 TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
8590 OMPTargetTeamsDistributeParallelForDirective *D) {
8591 DeclarationNameInfo DirName;
8592 getDerived().getSema().StartOpenMPDSABlock(
8593 OMPD_target_teams_distribute_parallel_for, DirName, nullptr,
8594 D->getBeginLoc());
8595 auto Res = getDerived().TransformOMPExecutableDirective(D);
8596 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8597 return Res;
8598 }
8599
8600 template <typename Derived>
8601 StmtResult TreeTransform<Derived>::
8602 TransformOMPTargetTeamsDistributeParallelForSimdDirective(
8603 OMPTargetTeamsDistributeParallelForSimdDirective *D) {
8604 DeclarationNameInfo DirName;
8605 getDerived().getSema().StartOpenMPDSABlock(
8606 OMPD_target_teams_distribute_parallel_for_simd, DirName, nullptr,
8607 D->getBeginLoc());
8608 auto Res = getDerived().TransformOMPExecutableDirective(D);
8609 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8610 return Res;
8611 }
8612
8613 template <typename Derived>
8614 StmtResult
8615 TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
8616 OMPTargetTeamsDistributeSimdDirective *D) {
8617 DeclarationNameInfo DirName;
8618 getDerived().getSema().StartOpenMPDSABlock(
8619 OMPD_target_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
8620 auto Res = getDerived().TransformOMPExecutableDirective(D);
8621 getDerived().getSema().EndOpenMPDSABlock(Res.get());
8622 return Res;
8623 }
8624
8625
8626 //===----------------------------------------------------------------------===//
8627 // OpenMP clause transformation
8628 //===----------------------------------------------------------------------===//
8629 template <typename Derived>
8630 OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *C) {
8631 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
8632 if (Cond.isInvalid())
8633 return nullptr;
8634 return getDerived().RebuildOMPIfClause(
8635 C->getNameModifier(), Cond.get(), C->getBeginLoc(), C->getLParenLoc(),
8636 C->getNameModifierLoc(), C->getColonLoc(), C->getEndLoc());
8637 }
8638
8639 template <typename Derived>
8640 OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *C) {
8641 ExprResult Cond = getDerived().TransformExpr(C->getCondition());
8642 if (Cond.isInvalid())
8643 return nullptr;
8644 return getDerived().RebuildOMPFinalClause(Cond.get(), C->getBeginLoc(),
8645 C->getLParenLoc(), C->getEndLoc());
8646 }
8647
8648 template <typename Derived>
8649 OMPClause *
8650 TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *C) {
8651 ExprResult NumThreads = getDerived().TransformExpr(C->getNumThreads());
8652 if (NumThreads.isInvalid())
8653 return nullptr;
8654 return getDerived().RebuildOMPNumThreadsClause(
8655 NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8656 }
8657
8658 template <typename Derived>
8659 OMPClause *
8660 TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *C) {
8661 ExprResult E = getDerived().TransformExpr(C->getSafelen());
8662 if (E.isInvalid())
8663 return nullptr;
8664 return getDerived().RebuildOMPSafelenClause(
8665 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8666 }
8667
8668 template <typename Derived>
8669 OMPClause *
8670 TreeTransform<Derived>::TransformOMPAllocatorClause(OMPAllocatorClause *C) {
8671 ExprResult E = getDerived().TransformExpr(C->getAllocator());
8672 if (E.isInvalid())
8673 return nullptr;
8674 return getDerived().RebuildOMPAllocatorClause(
8675 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8676 }
8677
8678 template <typename Derived>
8679 OMPClause *
8680 TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *C) {
8681 ExprResult E = getDerived().TransformExpr(C->getSimdlen());
8682 if (E.isInvalid())
8683 return nullptr;
8684 return getDerived().RebuildOMPSimdlenClause(
8685 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8686 }
8687
8688 template <typename Derived>
8689 OMPClause *
8690 TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *C) {
8691 ExprResult E = getDerived().TransformExpr(C->getNumForLoops());
8692 if (E.isInvalid())
8693 return nullptr;
8694 return getDerived().RebuildOMPCollapseClause(
8695 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8696 }
8697
8698 template <typename Derived>
8699 OMPClause *
8700 TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *C) {
8701 return getDerived().RebuildOMPDefaultClause(
8702 C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getBeginLoc(),
8703 C->getLParenLoc(), C->getEndLoc());
8704 }
8705
8706 template <typename Derived>
8707 OMPClause *
8708 TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *C) {
8709 return getDerived().RebuildOMPProcBindClause(
8710 C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getBeginLoc(),
8711 C->getLParenLoc(), C->getEndLoc());
8712 }
8713
8714 template <typename Derived>
8715 OMPClause *
8716 TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *C) {
8717 ExprResult E = getDerived().TransformExpr(C->getChunkSize());
8718 if (E.isInvalid())
8719 return nullptr;
8720 return getDerived().RebuildOMPScheduleClause(
8721 C->getFirstScheduleModifier(), C->getSecondScheduleModifier(),
8722 C->getScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
8723 C->getFirstScheduleModifierLoc(), C->getSecondScheduleModifierLoc(),
8724 C->getScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc());
8725 }
8726
8727 template <typename Derived>
8728 OMPClause *
8729 TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *C) {
8730 ExprResult E;
8731 if (auto *Num = C->getNumForLoops()) {
8732 E = getDerived().TransformExpr(Num);
8733 if (E.isInvalid())
8734 return nullptr;
8735 }
8736 return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getEndLoc(),
8737 C->getLParenLoc(), E.get());
8738 }
8739
8740 template <typename Derived>
8741 OMPClause *
8742 TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *C) {
8743 // No need to rebuild this clause, no template-dependent parameters.
8744 return C;
8745 }
8746
8747 template <typename Derived>
8748 OMPClause *
8749 TreeTransform<Derived>::TransformOMPUntiedClause(OMPUntiedClause *C) {
8750 // No need to rebuild this clause, no template-dependent parameters.
8751 return C;
8752 }
8753
8754 template <typename Derived>
8755 OMPClause *
8756 TreeTransform<Derived>::TransformOMPMergeableClause(OMPMergeableClause *C) {
8757 // No need to rebuild this clause, no template-dependent parameters.
8758 return C;
8759 }
8760
8761 template <typename Derived>
8762 OMPClause *TreeTransform<Derived>::TransformOMPReadClause(OMPReadClause *C) {
8763 // No need to rebuild this clause, no template-dependent parameters.
8764 return C;
8765 }
8766
8767 template <typename Derived>
8768 OMPClause *TreeTransform<Derived>::TransformOMPWriteClause(OMPWriteClause *C) {
8769 // No need to rebuild this clause, no template-dependent parameters.
8770 return C;
8771 }
8772
8773 template <typename Derived>
8774 OMPClause *
8775 TreeTransform<Derived>::TransformOMPUpdateClause(OMPUpdateClause *C) {
8776 // No need to rebuild this clause, no template-dependent parameters.
8777 return C;
8778 }
8779
8780 template <typename Derived>
8781 OMPClause *
8782 TreeTransform<Derived>::TransformOMPCaptureClause(OMPCaptureClause *C) {
8783 // No need to rebuild this clause, no template-dependent parameters.
8784 return C;
8785 }
8786
8787 template <typename Derived>
8788 OMPClause *
8789 TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *C) {
8790 // No need to rebuild this clause, no template-dependent parameters.
8791 return C;
8792 }
8793
8794 template <typename Derived>
8795 OMPClause *
8796 TreeTransform<Derived>::TransformOMPThreadsClause(OMPThreadsClause *C) {
8797 // No need to rebuild this clause, no template-dependent parameters.
8798 return C;
8799 }
8800
8801 template <typename Derived>
8802 OMPClause *TreeTransform<Derived>::TransformOMPSIMDClause(OMPSIMDClause *C) {
8803 // No need to rebuild this clause, no template-dependent parameters.
8804 return C;
8805 }
8806
8807 template <typename Derived>
8808 OMPClause *
8809 TreeTransform<Derived>::TransformOMPNogroupClause(OMPNogroupClause *C) {
8810 // No need to rebuild this clause, no template-dependent parameters.
8811 return C;
8812 }
8813
8814 template <typename Derived>
8815 OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
8816 OMPUnifiedAddressClause *C) {
8817 llvm_unreachable("unified_address clause cannot appear in dependent context");
8818 }
8819
8820 template <typename Derived>
8821 OMPClause *TreeTransform<Derived>::TransformOMPUnifiedSharedMemoryClause(
8822 OMPUnifiedSharedMemoryClause *C) {
8823 llvm_unreachable(
8824 "unified_shared_memory clause cannot appear in dependent context");
8825 }
8826
8827 template <typename Derived>
8828 OMPClause *TreeTransform<Derived>::TransformOMPReverseOffloadClause(
8829 OMPReverseOffloadClause *C) {
8830 llvm_unreachable("reverse_offload clause cannot appear in dependent context");
8831 }
8832
8833 template <typename Derived>
8834 OMPClause *TreeTransform<Derived>::TransformOMPDynamicAllocatorsClause(
8835 OMPDynamicAllocatorsClause *C) {
8836 llvm_unreachable(
8837 "dynamic_allocators clause cannot appear in dependent context");
8838 }
8839
8840 template <typename Derived>
8841 OMPClause *TreeTransform<Derived>::TransformOMPAtomicDefaultMemOrderClause(
8842 OMPAtomicDefaultMemOrderClause *C) {
8843 llvm_unreachable(
8844 "atomic_default_mem_order clause cannot appear in dependent context");
8845 }
8846
8847 template <typename Derived>
8848 OMPClause *
8849 TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
8850 llvm::SmallVector<Expr *, 16> Vars;
8851 Vars.reserve(C->varlist_size());
8852 for (auto *VE : C->varlists()) {
8853 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8854 if (EVar.isInvalid())
8855 return nullptr;
8856 Vars.push_back(EVar.get());
8857 }
8858 return getDerived().RebuildOMPPrivateClause(
8859 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8860 }
8861
8862 template <typename Derived>
8863 OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
8864 OMPFirstprivateClause *C) {
8865 llvm::SmallVector<Expr *, 16> Vars;
8866 Vars.reserve(C->varlist_size());
8867 for (auto *VE : C->varlists()) {
8868 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8869 if (EVar.isInvalid())
8870 return nullptr;
8871 Vars.push_back(EVar.get());
8872 }
8873 return getDerived().RebuildOMPFirstprivateClause(
8874 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
8875 }
8876
8877 template <typename Derived>
8878 OMPClause *
8879 TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *C) {
8880 llvm::SmallVector<Expr *, 16> Vars;
8881 Vars.reserve(C->varlist_size());
8882 for (auto *VE : C->varlists()) {
8883 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8884 if (EVar.isInvalid())
8885 return nullptr;
8886 Vars.push_back(EVar.get());
8887 }
8888 return getDerived().RebuildOMPLastprivateClause(
8889 Vars, C->getKind(), C->getKindLoc(), C->getColonLoc(), C->getBeginLoc(),
8890 C->getLParenLoc(), C->getEndLoc());
8891 }
8892
8893 template <typename Derived>
8894 OMPClause *
8895 TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
8896 llvm::SmallVector<Expr *, 16> Vars;
8897 Vars.reserve(C->varlist_size());
8898 for (auto *VE : C->varlists()) {
8899 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8900 if (EVar.isInvalid())
8901 return nullptr;
8902 Vars.push_back(EVar.get());
8903 }
8904 return getDerived().RebuildOMPSharedClause(Vars, C->getBeginLoc(),
8905 C->getLParenLoc(), C->getEndLoc());
8906 }
8907
8908 template <typename Derived>
8909 OMPClause *
8910 TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *C) {
8911 llvm::SmallVector<Expr *, 16> Vars;
8912 Vars.reserve(C->varlist_size());
8913 for (auto *VE : C->varlists()) {
8914 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8915 if (EVar.isInvalid())
8916 return nullptr;
8917 Vars.push_back(EVar.get());
8918 }
8919 CXXScopeSpec ReductionIdScopeSpec;
8920 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
8921
8922 DeclarationNameInfo NameInfo = C->getNameInfo();
8923 if (NameInfo.getName()) {
8924 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
8925 if (!NameInfo.getName())
8926 return nullptr;
8927 }
8928 // Build a list of all UDR decls with the same names ranged by the Scopes.
8929 // The Scope boundary is a duplication of the previous decl.
8930 llvm::SmallVector<Expr *, 16> UnresolvedReductions;
8931 for (auto *E : C->reduction_ops()) {
8932 // Transform all the decls.
8933 if (E) {
8934 auto *ULE = cast<UnresolvedLookupExpr>(E);
8935 UnresolvedSet<8> Decls;
8936 for (auto *D : ULE->decls()) {
8937 NamedDecl *InstD =
8938 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
8939 Decls.addDecl(InstD, InstD->getAccess());
8940 }
8941 UnresolvedReductions.push_back(
8942 UnresolvedLookupExpr::Create(
8943 SemaRef.Context, /*NamingClass=*/nullptr,
8944 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context),
8945 NameInfo, /*ADL=*/true, ULE->isOverloaded(),
8946 Decls.begin(), Decls.end()));
8947 } else
8948 UnresolvedReductions.push_back(nullptr);
8949 }
8950 return getDerived().RebuildOMPReductionClause(
8951 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
8952 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
8953 }
8954
8955 template <typename Derived>
8956 OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
8957 OMPTaskReductionClause *C) {
8958 llvm::SmallVector<Expr *, 16> Vars;
8959 Vars.reserve(C->varlist_size());
8960 for (auto *VE : C->varlists()) {
8961 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
8962 if (EVar.isInvalid())
8963 return nullptr;
8964 Vars.push_back(EVar.get());
8965 }
8966 CXXScopeSpec ReductionIdScopeSpec;
8967 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
8968
8969 DeclarationNameInfo NameInfo = C->getNameInfo();
8970 if (NameInfo.getName()) {
8971 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
8972 if (!NameInfo.getName())
8973 return nullptr;
8974 }
8975 // Build a list of all UDR decls with the same names ranged by the Scopes.
8976 // The Scope boundary is a duplication of the previous decl.
8977 llvm::SmallVector<Expr *, 16> UnresolvedReductions;
8978 for (auto *E : C->reduction_ops()) {
8979 // Transform all the decls.
8980 if (E) {
8981 auto *ULE = cast<UnresolvedLookupExpr>(E);
8982 UnresolvedSet<8> Decls;
8983 for (auto *D : ULE->decls()) {
8984 NamedDecl *InstD =
8985 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
8986 Decls.addDecl(InstD, InstD->getAccess());
8987 }
8988 UnresolvedReductions.push_back(UnresolvedLookupExpr::Create(
8989 SemaRef.Context, /*NamingClass=*/nullptr,
8990 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), NameInfo,
8991 /*ADL=*/true, ULE->isOverloaded(), Decls.begin(), Decls.end()));
8992 } else
8993 UnresolvedReductions.push_back(nullptr);
8994 }
8995 return getDerived().RebuildOMPTaskReductionClause(
8996 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
8997 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
8998 }
8999
9000 template <typename Derived>
9001 OMPClause *
9002 TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *C) {
9003 llvm::SmallVector<Expr *, 16> Vars;
9004 Vars.reserve(C->varlist_size());
9005 for (auto *VE : C->varlists()) {
9006 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9007 if (EVar.isInvalid())
9008 return nullptr;
9009 Vars.push_back(EVar.get());
9010 }
9011 CXXScopeSpec ReductionIdScopeSpec;
9012 ReductionIdScopeSpec.Adopt(C->getQualifierLoc());
9013
9014 DeclarationNameInfo NameInfo = C->getNameInfo();
9015 if (NameInfo.getName()) {
9016 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9017 if (!NameInfo.getName())
9018 return nullptr;
9019 }
9020 // Build a list of all UDR decls with the same names ranged by the Scopes.
9021 // The Scope boundary is a duplication of the previous decl.
9022 llvm::SmallVector<Expr *, 16> UnresolvedReductions;
9023 for (auto *E : C->reduction_ops()) {
9024 // Transform all the decls.
9025 if (E) {
9026 auto *ULE = cast<UnresolvedLookupExpr>(E);
9027 UnresolvedSet<8> Decls;
9028 for (auto *D : ULE->decls()) {
9029 NamedDecl *InstD =
9030 cast<NamedDecl>(getDerived().TransformDecl(E->getExprLoc(), D));
9031 Decls.addDecl(InstD, InstD->getAccess());
9032 }
9033 UnresolvedReductions.push_back(UnresolvedLookupExpr::Create(
9034 SemaRef.Context, /*NamingClass=*/nullptr,
9035 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), NameInfo,
9036 /*ADL=*/true, ULE->isOverloaded(), Decls.begin(), Decls.end()));
9037 } else
9038 UnresolvedReductions.push_back(nullptr);
9039 }
9040 return getDerived().RebuildOMPInReductionClause(
9041 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
9042 C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
9043 }
9044
9045 template <typename Derived>
9046 OMPClause *
9047 TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *C) {
9048 llvm::SmallVector<Expr *, 16> Vars;
9049 Vars.reserve(C->varlist_size());
9050 for (auto *VE : C->varlists()) {
9051 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9052 if (EVar.isInvalid())
9053 return nullptr;
9054 Vars.push_back(EVar.get());
9055 }
9056 ExprResult Step = getDerived().TransformExpr(C->getStep());
9057 if (Step.isInvalid())
9058 return nullptr;
9059 return getDerived().RebuildOMPLinearClause(
9060 Vars, Step.get(), C->getBeginLoc(), C->getLParenLoc(), C->getModifier(),
9061 C->getModifierLoc(), C->getColonLoc(), C->getEndLoc());
9062 }
9063
9064 template <typename Derived>
9065 OMPClause *
9066 TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *C) {
9067 llvm::SmallVector<Expr *, 16> Vars;
9068 Vars.reserve(C->varlist_size());
9069 for (auto *VE : C->varlists()) {
9070 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9071 if (EVar.isInvalid())
9072 return nullptr;
9073 Vars.push_back(EVar.get());
9074 }
9075 ExprResult Alignment = getDerived().TransformExpr(C->getAlignment());
9076 if (Alignment.isInvalid())
9077 return nullptr;
9078 return getDerived().RebuildOMPAlignedClause(
9079 Vars, Alignment.get(), C->getBeginLoc(), C->getLParenLoc(),
9080 C->getColonLoc(), C->getEndLoc());
9081 }
9082
9083 template <typename Derived>
9084 OMPClause *
9085 TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *C) {
9086 llvm::SmallVector<Expr *, 16> Vars;
9087 Vars.reserve(C->varlist_size());
9088 for (auto *VE : C->varlists()) {
9089 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9090 if (EVar.isInvalid())
9091 return nullptr;
9092 Vars.push_back(EVar.get());
9093 }
9094 return getDerived().RebuildOMPCopyinClause(Vars, C->getBeginLoc(),
9095 C->getLParenLoc(), C->getEndLoc());
9096 }
9097
9098 template <typename Derived>
9099 OMPClause *
9100 TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *C) {
9101 llvm::SmallVector<Expr *, 16> Vars;
9102 Vars.reserve(C->varlist_size());
9103 for (auto *VE : C->varlists()) {
9104 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9105 if (EVar.isInvalid())
9106 return nullptr;
9107 Vars.push_back(EVar.get());
9108 }
9109 return getDerived().RebuildOMPCopyprivateClause(
9110 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9111 }
9112
9113 template <typename Derived>
9114 OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *C) {
9115 llvm::SmallVector<Expr *, 16> Vars;
9116 Vars.reserve(C->varlist_size());
9117 for (auto *VE : C->varlists()) {
9118 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9119 if (EVar.isInvalid())
9120 return nullptr;
9121 Vars.push_back(EVar.get());
9122 }
9123 return getDerived().RebuildOMPFlushClause(Vars, C->getBeginLoc(),
9124 C->getLParenLoc(), C->getEndLoc());
9125 }
9126
9127 template <typename Derived>
9128 OMPClause *
9129 TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *C) {
9130 llvm::SmallVector<Expr *, 16> Vars;
9131 Vars.reserve(C->varlist_size());
9132 for (auto *VE : C->varlists()) {
9133 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9134 if (EVar.isInvalid())
9135 return nullptr;
9136 Vars.push_back(EVar.get());
9137 }
9138 return getDerived().RebuildOMPDependClause(
9139 C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(), Vars,
9140 C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9141 }
9142
9143 template <typename Derived>
9144 OMPClause *
9145 TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *C) {
9146 ExprResult E = getDerived().TransformExpr(C->getDevice());
9147 if (E.isInvalid())
9148 return nullptr;
9149 return getDerived().RebuildOMPDeviceClause(E.get(), C->getBeginLoc(),
9150 C->getLParenLoc(), C->getEndLoc());
9151 }
9152
9153 template <typename Derived, class T>
9154 bool transformOMPMappableExprListClause(
9155 TreeTransform<Derived> &TT, OMPMappableExprListClause<T> *C,
9156 llvm::SmallVectorImpl<Expr *> &Vars, CXXScopeSpec &MapperIdScopeSpec,
9157 DeclarationNameInfo &MapperIdInfo,
9158 llvm::SmallVectorImpl<Expr *> &UnresolvedMappers) {
9159 // Transform expressions in the list.
9160 Vars.reserve(C->varlist_size());
9161 for (auto *VE : C->varlists()) {
9162 ExprResult EVar = TT.getDerived().TransformExpr(cast<Expr>(VE));
9163 if (EVar.isInvalid())
9164 return true;
9165 Vars.push_back(EVar.get());
9166 }
9167 // Transform mapper scope specifier and identifier.
9168 NestedNameSpecifierLoc QualifierLoc;
9169 if (C->getMapperQualifierLoc()) {
9170 QualifierLoc = TT.getDerived().TransformNestedNameSpecifierLoc(
9171 C->getMapperQualifierLoc());
9172 if (!QualifierLoc)
9173 return true;
9174 }
9175 MapperIdScopeSpec.Adopt(QualifierLoc);
9176 MapperIdInfo = C->getMapperIdInfo();
9177 if (MapperIdInfo.getName()) {
9178 MapperIdInfo = TT.getDerived().TransformDeclarationNameInfo(MapperIdInfo);
9179 if (!MapperIdInfo.getName())
9180 return true;
9181 }
9182 // Build a list of all candidate OMPDeclareMapperDecls, which is provided by
9183 // the previous user-defined mapper lookup in dependent environment.
9184 for (auto *E : C->mapperlists()) {
9185 // Transform all the decls.
9186 if (E) {
9187 auto *ULE = cast<UnresolvedLookupExpr>(E);
9188 UnresolvedSet<8> Decls;
9189 for (auto *D : ULE->decls()) {
9190 NamedDecl *InstD =
9191 cast<NamedDecl>(TT.getDerived().TransformDecl(E->getExprLoc(), D));
9192 Decls.addDecl(InstD, InstD->getAccess());
9193 }
9194 UnresolvedMappers.push_back(UnresolvedLookupExpr::Create(
9195 TT.getSema().Context, /*NamingClass=*/nullptr,
9196 MapperIdScopeSpec.getWithLocInContext(TT.getSema().Context),
9197 MapperIdInfo, /*ADL=*/true, ULE->isOverloaded(), Decls.begin(),
9198 Decls.end()));
9199 } else {
9200 UnresolvedMappers.push_back(nullptr);
9201 }
9202 }
9203 return false;
9204 }
9205
9206 template <typename Derived>
9207 OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *C) {
9208 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9209 llvm::SmallVector<Expr *, 16> Vars;
9210 CXXScopeSpec MapperIdScopeSpec;
9211 DeclarationNameInfo MapperIdInfo;
9212 llvm::SmallVector<Expr *, 16> UnresolvedMappers;
9213 if (transformOMPMappableExprListClause<Derived, OMPMapClause>(
9214 *this, C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
9215 return nullptr;
9216 return getDerived().RebuildOMPMapClause(
9217 C->getMapTypeModifiers(), C->getMapTypeModifiersLoc(), MapperIdScopeSpec,
9218 MapperIdInfo, C->getMapType(), C->isImplicitMapType(), C->getMapLoc(),
9219 C->getColonLoc(), Vars, Locs, UnresolvedMappers);
9220 }
9221
9222 template <typename Derived>
9223 OMPClause *
9224 TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *C) {
9225 Expr *Allocator = C->getAllocator();
9226 if (Allocator) {
9227 ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
9228 if (AllocatorRes.isInvalid())
9229 return nullptr;
9230 Allocator = AllocatorRes.get();
9231 }
9232 llvm::SmallVector<Expr *, 16> Vars;
9233 Vars.reserve(C->varlist_size());
9234 for (auto *VE : C->varlists()) {
9235 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9236 if (EVar.isInvalid())
9237 return nullptr;
9238 Vars.push_back(EVar.get());
9239 }
9240 return getDerived().RebuildOMPAllocateClause(
9241 Allocator, Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
9242 C->getEndLoc());
9243 }
9244
9245 template <typename Derived>
9246 OMPClause *
9247 TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *C) {
9248 ExprResult E = getDerived().TransformExpr(C->getNumTeams());
9249 if (E.isInvalid())
9250 return nullptr;
9251 return getDerived().RebuildOMPNumTeamsClause(
9252 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9253 }
9254
9255 template <typename Derived>
9256 OMPClause *
9257 TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *C) {
9258 ExprResult E = getDerived().TransformExpr(C->getThreadLimit());
9259 if (E.isInvalid())
9260 return nullptr;
9261 return getDerived().RebuildOMPThreadLimitClause(
9262 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9263 }
9264
9265 template <typename Derived>
9266 OMPClause *
9267 TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *C) {
9268 ExprResult E = getDerived().TransformExpr(C->getPriority());
9269 if (E.isInvalid())
9270 return nullptr;
9271 return getDerived().RebuildOMPPriorityClause(
9272 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9273 }
9274
9275 template <typename Derived>
9276 OMPClause *
9277 TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *C) {
9278 ExprResult E = getDerived().TransformExpr(C->getGrainsize());
9279 if (E.isInvalid())
9280 return nullptr;
9281 return getDerived().RebuildOMPGrainsizeClause(
9282 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9283 }
9284
9285 template <typename Derived>
9286 OMPClause *
9287 TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *C) {
9288 ExprResult E = getDerived().TransformExpr(C->getNumTasks());
9289 if (E.isInvalid())
9290 return nullptr;
9291 return getDerived().RebuildOMPNumTasksClause(
9292 E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9293 }
9294
9295 template <typename Derived>
9296 OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *C) {
9297 ExprResult E = getDerived().TransformExpr(C->getHint());
9298 if (E.isInvalid())
9299 return nullptr;
9300 return getDerived().RebuildOMPHintClause(E.get(), C->getBeginLoc(),
9301 C->getLParenLoc(), C->getEndLoc());
9302 }
9303
9304 template <typename Derived>
9305 OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
9306 OMPDistScheduleClause *C) {
9307 ExprResult E = getDerived().TransformExpr(C->getChunkSize());
9308 if (E.isInvalid())
9309 return nullptr;
9310 return getDerived().RebuildOMPDistScheduleClause(
9311 C->getDistScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
9312 C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc());
9313 }
9314
9315 template <typename Derived>
9316 OMPClause *
9317 TreeTransform<Derived>::TransformOMPDefaultmapClause(OMPDefaultmapClause *C) {
9318 // Rebuild Defaultmap Clause since we need to invoke the checking of
9319 // defaultmap(none:variable-category) after template initialization.
9320 return getDerived().RebuildOMPDefaultmapClause(C->getDefaultmapModifier(),
9321 C->getDefaultmapKind(),
9322 C->getBeginLoc(),
9323 C->getLParenLoc(),
9324 C->getDefaultmapModifierLoc(),
9325 C->getDefaultmapKindLoc(),
9326 C->getEndLoc());
9327 }
9328
9329 template <typename Derived>
9330 OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *C) {
9331 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9332 llvm::SmallVector<Expr *, 16> Vars;
9333 CXXScopeSpec MapperIdScopeSpec;
9334 DeclarationNameInfo MapperIdInfo;
9335 llvm::SmallVector<Expr *, 16> UnresolvedMappers;
9336 if (transformOMPMappableExprListClause<Derived, OMPToClause>(
9337 *this, C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
9338 return nullptr;
9339 return getDerived().RebuildOMPToClause(Vars, MapperIdScopeSpec, MapperIdInfo,
9340 Locs, UnresolvedMappers);
9341 }
9342
9343 template <typename Derived>
9344 OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *C) {
9345 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9346 llvm::SmallVector<Expr *, 16> Vars;
9347 CXXScopeSpec MapperIdScopeSpec;
9348 DeclarationNameInfo MapperIdInfo;
9349 llvm::SmallVector<Expr *, 16> UnresolvedMappers;
9350 if (transformOMPMappableExprListClause<Derived, OMPFromClause>(
9351 *this, C, Vars, MapperIdScopeSpec, MapperIdInfo, UnresolvedMappers))
9352 return nullptr;
9353 return getDerived().RebuildOMPFromClause(
9354 Vars, MapperIdScopeSpec, MapperIdInfo, Locs, UnresolvedMappers);
9355 }
9356
9357 template <typename Derived>
9358 OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
9359 OMPUseDevicePtrClause *C) {
9360 llvm::SmallVector<Expr *, 16> Vars;
9361 Vars.reserve(C->varlist_size());
9362 for (auto *VE : C->varlists()) {
9363 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9364 if (EVar.isInvalid())
9365 return nullptr;
9366 Vars.push_back(EVar.get());
9367 }
9368 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9369 return getDerived().RebuildOMPUseDevicePtrClause(Vars, Locs);
9370 }
9371
9372 template <typename Derived>
9373 OMPClause *
9374 TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
9375 llvm::SmallVector<Expr *, 16> Vars;
9376 Vars.reserve(C->varlist_size());
9377 for (auto *VE : C->varlists()) {
9378 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9379 if (EVar.isInvalid())
9380 return nullptr;
9381 Vars.push_back(EVar.get());
9382 }
9383 OMPVarListLocTy Locs(C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9384 return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
9385 }
9386
9387 template <typename Derived>
9388 OMPClause *
9389 TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *C) {
9390 llvm::SmallVector<Expr *, 16> Vars;
9391 Vars.reserve(C->varlist_size());
9392 for (auto *VE : C->varlists()) {
9393 ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
9394 if (EVar.isInvalid())
9395 return nullptr;
9396 Vars.push_back(EVar.get());
9397 }
9398 return getDerived().RebuildOMPNontemporalClause(
9399 Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
9400 }
9401
9402 //===----------------------------------------------------------------------===//
9403 // Expression transformation
9404 //===----------------------------------------------------------------------===//
9405 template<typename Derived>
9406 ExprResult
9407 TreeTransform<Derived>::TransformConstantExpr(ConstantExpr *E) {
9408 return TransformExpr(E->getSubExpr());
9409 }
9410
9411 template<typename Derived>
9412 ExprResult
9413 TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
9414 if (!E->isTypeDependent())
9415 return E;
9416
9417 return getDerived().RebuildPredefinedExpr(E->getLocation(),
9418 E->getIdentKind());
9419 }
9420
9421 template<typename Derived>
9422 ExprResult
9423 TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
9424 NestedNameSpecifierLoc QualifierLoc;
9425 if (E->getQualifierLoc()) {
9426 QualifierLoc
9427 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9428 if (!QualifierLoc)
9429 return ExprError();
9430 }
9431
9432 ValueDecl *ND
9433 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getLocation(),
9434 E->getDecl()));
9435 if (!ND)
9436 return ExprError();
9437
9438 NamedDecl *Found = ND;
9439 if (E->getFoundDecl() != E->getDecl()) {
9440 Found = cast_or_null<NamedDecl>(
9441 getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
9442 if (!Found)
9443 return ExprError();
9444 }
9445
9446 DeclarationNameInfo NameInfo = E->getNameInfo();
9447 if (NameInfo.getName()) {
9448 NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
9449 if (!NameInfo.getName())
9450 return ExprError();
9451 }
9452
9453 if (!getDerived().AlwaysRebuild() &&
9454 QualifierLoc == E->getQualifierLoc() &&
9455 ND == E->getDecl() &&
9456 Found == E->getFoundDecl() &&
9457 NameInfo.getName() == E->getDecl()->getDeclName() &&
9458 !E->hasExplicitTemplateArgs()) {
9459
9460 // Mark it referenced in the new context regardless.
9461 // FIXME: this is a bit instantiation-specific.
9462 SemaRef.MarkDeclRefReferenced(E);
9463
9464 return E;
9465 }
9466
9467 TemplateArgumentListInfo TransArgs, *TemplateArgs = nullptr;
9468 if (E->hasExplicitTemplateArgs()) {
9469 TemplateArgs = &TransArgs;
9470 TransArgs.setLAngleLoc(E->getLAngleLoc());
9471 TransArgs.setRAngleLoc(E->getRAngleLoc());
9472 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
9473 E->getNumTemplateArgs(),
9474 TransArgs))
9475 return ExprError();
9476 }
9477
9478 return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
9479 Found, TemplateArgs);
9480 }
9481
9482 template<typename Derived>
9483 ExprResult
9484 TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
9485 return E;
9486 }
9487
9488 template <typename Derived>
9489 ExprResult TreeTransform<Derived>::TransformFixedPointLiteral(
9490 FixedPointLiteral *E) {
9491 return E;
9492 }
9493
9494 template<typename Derived>
9495 ExprResult
9496 TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
9497 return E;
9498 }
9499
9500 template<typename Derived>
9501 ExprResult
9502 TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
9503 return E;
9504 }
9505
9506 template<typename Derived>
9507 ExprResult
9508 TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
9509 return E;
9510 }
9511
9512 template<typename Derived>
9513 ExprResult
9514 TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
9515 return E;
9516 }
9517
9518 template<typename Derived>
9519 ExprResult
9520 TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
9521 if (FunctionDecl *FD = E->getDirectCallee())
9522 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), FD);
9523 return SemaRef.MaybeBindToTemporary(E);
9524 }
9525
9526 template<typename Derived>
9527 ExprResult
9528 TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *E) {
9529 ExprResult ControllingExpr =
9530 getDerived().TransformExpr(E->getControllingExpr());
9531 if (ControllingExpr.isInvalid())
9532 return ExprError();
9533
9534 SmallVector<Expr *, 4> AssocExprs;
9535 SmallVector<TypeSourceInfo *, 4> AssocTypes;
9536 for (const GenericSelectionExpr::Association Assoc : E->associations()) {
9537 TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
9538 if (TSI) {
9539 TypeSourceInfo *AssocType = getDerived().TransformType(TSI);
9540 if (!AssocType)
9541 return ExprError();
9542 AssocTypes.push_back(AssocType);
9543 } else {
9544 AssocTypes.push_back(nullptr);
9545 }
9546
9547 ExprResult AssocExpr =
9548 getDerived().TransformExpr(Assoc.getAssociationExpr());
9549 if (AssocExpr.isInvalid())
9550 return ExprError();
9551 AssocExprs.push_back(AssocExpr.get());
9552 }
9553
9554 return getDerived().RebuildGenericSelectionExpr(E->getGenericLoc(),
9555 E->getDefaultLoc(),
9556 E->getRParenLoc(),
9557 ControllingExpr.get(),
9558 AssocTypes,
9559 AssocExprs);
9560 }
9561
9562 template<typename Derived>
9563 ExprResult
9564 TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
9565 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
9566 if (SubExpr.isInvalid())
9567 return ExprError();
9568
9569 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
9570 return E;
9571
9572 return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
9573 E->getRParen());
9574 }
9575
9576 /// The operand of a unary address-of operator has special rules: it's
9577 /// allowed to refer to a non-static member of a class even if there's no 'this'
9578 /// object available.
9579 template<typename Derived>
9580 ExprResult
9581 TreeTransform<Derived>::TransformAddressOfOperand(Expr *E) {
9582 if (DependentScopeDeclRefExpr *DRE = dyn_cast<DependentScopeDeclRefExpr>(E))
9583 return getDerived().TransformDependentScopeDeclRefExpr(DRE, true, nullptr);
9584 else
9585 return getDerived().TransformExpr(E);
9586 }
9587
9588 template<typename Derived>
9589 ExprResult
9590 TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) {
9591 ExprResult SubExpr;
9592 if (E->getOpcode() == UO_AddrOf)
9593 SubExpr = TransformAddressOfOperand(E->getSubExpr());
9594 else
9595 SubExpr = TransformExpr(E->getSubExpr());
9596 if (SubExpr.isInvalid())
9597 return ExprError();
9598
9599 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
9600 return E;
9601
9602 return getDerived().RebuildUnaryOperator(E->getOperatorLoc(),
9603 E->getOpcode(),
9604 SubExpr.get());
9605 }
9606
9607 template<typename Derived>
9608 ExprResult
9609 TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
9610 // Transform the type.
9611 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
9612 if (!Type)
9613 return ExprError();
9614
9615 // Transform all of the components into components similar to what the
9616 // parser uses.
9617 // FIXME: It would be slightly more efficient in the non-dependent case to
9618 // just map FieldDecls, rather than requiring the rebuilder to look for
9619 // the fields again. However, __builtin_offsetof is rare enough in
9620 // template code that we don't care.
9621 bool ExprChanged = false;
9622 typedef Sema::OffsetOfComponent Component;
9623 SmallVector<Component, 4> Components;
9624 for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
9625 const OffsetOfNode &ON = E->getComponent(I);
9626 Component Comp;
9627 Comp.isBrackets = true;
9628 Comp.LocStart = ON.getSourceRange().getBegin();
9629 Comp.LocEnd = ON.getSourceRange().getEnd();
9630 switch (ON.getKind()) {
9631 case OffsetOfNode::Array: {
9632 Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
9633 ExprResult Index = getDerived().TransformExpr(FromIndex);
9634 if (Index.isInvalid())
9635 return ExprError();
9636
9637 ExprChanged = ExprChanged || Index.get() != FromIndex;
9638 Comp.isBrackets = true;
9639 Comp.U.E = Index.get();
9640 break;
9641 }
9642
9643 case OffsetOfNode::Field:
9644 case OffsetOfNode::Identifier:
9645 Comp.isBrackets = false;
9646 Comp.U.IdentInfo = ON.getFieldName();
9647 if (!Comp.U.IdentInfo)
9648 continue;
9649
9650 break;
9651
9652 case OffsetOfNode::Base:
9653 // Will be recomputed during the rebuild.
9654 continue;
9655 }
9656
9657 Components.push_back(Comp);
9658 }
9659
9660 // If nothing changed, retain the existing expression.
9661 if (!getDerived().AlwaysRebuild() &&
9662 Type == E->getTypeSourceInfo() &&
9663 !ExprChanged)
9664 return E;
9665
9666 // Build a new offsetof expression.
9667 return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type,
9668 Components, E->getRParenLoc());
9669 }
9670
9671 template<typename Derived>
9672 ExprResult
9673 TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
9674 assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
9675 "opaque value expression requires transformation");
9676 return E;
9677 }
9678
9679 template<typename Derived>
9680 ExprResult
9681 TreeTransform<Derived>::TransformTypoExpr(TypoExpr *E) {
9682 return E;
9683 }
9684
9685 template<typename Derived>
9686 ExprResult
9687 TreeTransform<Derived>::TransformPseudoObjectExpr(PseudoObjectExpr *E) {
9688 // Rebuild the syntactic form. The original syntactic form has
9689 // opaque-value expressions in it, so strip those away and rebuild
9690 // the result. This is a really awful way of doing this, but the
9691 // better solution (rebuilding the semantic expressions and
9692 // rebinding OVEs as necessary) doesn't work; we'd need
9693 // TreeTransform to not strip away implicit conversions.
9694 Expr *newSyntacticForm = SemaRef.recreateSyntacticForm(E);
9695 ExprResult result = getDerived().TransformExpr(newSyntacticForm);
9696 if (result.isInvalid()) return ExprError();
9697
9698 // If that gives us a pseudo-object result back, the pseudo-object
9699 // expression must have been an lvalue-to-rvalue conversion which we
9700 // should reapply.
9701 if (result.get()->hasPlaceholderType(BuiltinType::PseudoObject))
9702 result = SemaRef.checkPseudoObjectRValue(result.get());
9703
9704 return result;
9705 }
9706
9707 template<typename Derived>
9708 ExprResult
9709 TreeTransform<Derived>::TransformUnaryExprOrTypeTraitExpr(
9710 UnaryExprOrTypeTraitExpr *E) {
9711 if (E->isArgumentType()) {
9712 TypeSourceInfo *OldT = E->getArgumentTypeInfo();
9713
9714 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
9715 if (!NewT)
9716 return ExprError();
9717
9718 if (!getDerived().AlwaysRebuild() && OldT == NewT)
9719 return E;
9720
9721 return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
9722 E->getKind(),
9723 E->getSourceRange());
9724 }
9725
9726 // C++0x [expr.sizeof]p1:
9727 // The operand is either an expression, which is an unevaluated operand
9728 // [...]
9729 EnterExpressionEvaluationContext Unevaluated(
9730 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated,
9731 Sema::ReuseLambdaContextDecl);
9732
9733 // Try to recover if we have something like sizeof(T::X) where X is a type.
9734 // Notably, there must be *exactly* one set of parens if X is a type.
9735 TypeSourceInfo *RecoveryTSI = nullptr;
9736 ExprResult SubExpr;
9737 auto *PE = dyn_cast<ParenExpr>(E->getArgumentExpr());
9738 if (auto *DRE =
9739 PE ? dyn_cast<DependentScopeDeclRefExpr>(PE->getSubExpr()) : nullptr)
9740 SubExpr = getDerived().TransformParenDependentScopeDeclRefExpr(
9741 PE, DRE, false, &RecoveryTSI);
9742 else
9743 SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
9744
9745 if (RecoveryTSI) {
9746 return getDerived().RebuildUnaryExprOrTypeTrait(
9747 RecoveryTSI, E->getOperatorLoc(), E->getKind(), E->getSourceRange());
9748 } else if (SubExpr.isInvalid())
9749 return ExprError();
9750
9751 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
9752 return E;
9753
9754 return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
9755 E->getOperatorLoc(),
9756 E->getKind(),
9757 E->getSourceRange());
9758 }
9759
9760 template<typename Derived>
9761 ExprResult
9762 TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
9763 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
9764 if (LHS.isInvalid())
9765 return ExprError();
9766
9767 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
9768 if (RHS.isInvalid())
9769 return ExprError();
9770
9771
9772 if (!getDerived().AlwaysRebuild() &&
9773 LHS.get() == E->getLHS() &&
9774 RHS.get() == E->getRHS())
9775 return E;
9776
9777 return getDerived().RebuildArraySubscriptExpr(
9778 LHS.get(),
9779 /*FIXME:*/ E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
9780 }
9781
9782 template <typename Derived>
9783 ExprResult
9784 TreeTransform<Derived>::TransformOMPArraySectionExpr(OMPArraySectionExpr *E) {
9785 ExprResult Base = getDerived().TransformExpr(E->getBase());
9786 if (Base.isInvalid())
9787 return ExprError();
9788
9789 ExprResult LowerBound;
9790 if (E->getLowerBound()) {
9791 LowerBound = getDerived().TransformExpr(E->getLowerBound());
9792 if (LowerBound.isInvalid())
9793 return ExprError();
9794 }
9795
9796 ExprResult Length;
9797 if (E->getLength()) {
9798 Length = getDerived().TransformExpr(E->getLength());
9799 if (Length.isInvalid())
9800 return ExprError();
9801 }
9802
9803 if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase() &&
9804 LowerBound.get() == E->getLowerBound() && Length.get() == E->getLength())
9805 return E;
9806
9807 return getDerived().RebuildOMPArraySectionExpr(
9808 Base.get(), E->getBase()->getEndLoc(), LowerBound.get(), E->getColonLoc(),
9809 Length.get(), E->getRBracketLoc());
9810 }
9811
9812 template<typename Derived>
9813 ExprResult
9814 TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
9815 // Transform the callee.
9816 ExprResult Callee = getDerived().TransformExpr(E->getCallee());
9817 if (Callee.isInvalid())
9818 return ExprError();
9819
9820 // Transform arguments.
9821 bool ArgChanged = false;
9822 SmallVector<Expr*, 8> Args;
9823 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
9824 &ArgChanged))
9825 return ExprError();
9826
9827 if (!getDerived().AlwaysRebuild() &&
9828 Callee.get() == E->getCallee() &&
9829 !ArgChanged)
9830 return SemaRef.MaybeBindToTemporary(E);
9831
9832 // FIXME: Wrong source location information for the '('.
9833 SourceLocation FakeLParenLoc
9834 = ((Expr *)Callee.get())->getSourceRange().getBegin();
9835 return getDerived().RebuildCallExpr(Callee.get(), FakeLParenLoc,
9836 Args,
9837 E->getRParenLoc());
9838 }
9839
9840 template<typename Derived>
9841 ExprResult
9842 TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
9843 ExprResult Base = getDerived().TransformExpr(E->getBase());
9844 if (Base.isInvalid())
9845 return ExprError();
9846
9847 NestedNameSpecifierLoc QualifierLoc;
9848 if (E->hasQualifier()) {
9849 QualifierLoc
9850 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
9851
9852 if (!QualifierLoc)
9853 return ExprError();
9854 }
9855 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
9856
9857 ValueDecl *Member
9858 = cast_or_null<ValueDecl>(getDerived().TransformDecl(E->getMemberLoc(),
9859 E->getMemberDecl()));
9860 if (!Member)
9861 return ExprError();
9862
9863 NamedDecl *FoundDecl = E->getFoundDecl();
9864 if (FoundDecl == E->getMemberDecl()) {
9865 FoundDecl = Member;
9866 } else {
9867 FoundDecl = cast_or_null<NamedDecl>(
9868 getDerived().TransformDecl(E->getMemberLoc(), FoundDecl));
9869 if (!FoundDecl)
9870 return ExprError();
9871 }
9872
9873 if (!getDerived().AlwaysRebuild() &&
9874 Base.get() == E->getBase() &&
9875 QualifierLoc == E->getQualifierLoc() &&
9876 Member == E->getMemberDecl() &&
9877 FoundDecl == E->getFoundDecl() &&
9878 !E->hasExplicitTemplateArgs()) {
9879
9880 // Mark it referenced in the new context regardless.
9881 // FIXME: this is a bit instantiation-specific.
9882 SemaRef.MarkMemberReferenced(E);
9883
9884 return E;
9885 }
9886
9887 TemplateArgumentListInfo TransArgs;
9888 if (E->hasExplicitTemplateArgs()) {
9889 TransArgs.setLAngleLoc(E->getLAngleLoc());
9890 TransArgs.setRAngleLoc(E->getRAngleLoc());
9891 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
9892 E->getNumTemplateArgs(),
9893 TransArgs))
9894 return ExprError();
9895 }
9896
9897 // FIXME: Bogus source location for the operator
9898 SourceLocation FakeOperatorLoc =
9899 SemaRef.getLocForEndOfToken(E->getBase()->getSourceRange().getEnd());
9900
9901 // FIXME: to do this check properly, we will need to preserve the
9902 // first-qualifier-in-scope here, just in case we had a dependent
9903 // base (and therefore couldn't do the check) and a
9904 // nested-name-qualifier (and therefore could do the lookup).
9905 NamedDecl *FirstQualifierInScope = nullptr;
9906 DeclarationNameInfo MemberNameInfo = E->getMemberNameInfo();
9907 if (MemberNameInfo.getName()) {
9908 MemberNameInfo = getDerived().TransformDeclarationNameInfo(MemberNameInfo);
9909 if (!MemberNameInfo.getName())
9910 return ExprError();
9911 }
9912
9913 return getDerived().RebuildMemberExpr(Base.get(), FakeOperatorLoc,
9914 E->isArrow(),
9915 QualifierLoc,
9916 TemplateKWLoc,
9917 MemberNameInfo,
9918 Member,
9919 FoundDecl,
9920 (E->hasExplicitTemplateArgs()
9921 ? &TransArgs : nullptr),
9922 FirstQualifierInScope);
9923 }
9924
9925 template<typename Derived>
9926 ExprResult
9927 TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
9928 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
9929 if (LHS.isInvalid())
9930 return ExprError();
9931
9932 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
9933 if (RHS.isInvalid())
9934 return ExprError();
9935
9936 if (!getDerived().AlwaysRebuild() &&
9937 LHS.get() == E->getLHS() &&
9938 RHS.get() == E->getRHS())
9939 return E;
9940
9941 Sema::FPContractStateRAII FPContractState(getSema());
9942 getSema().FPFeatures = E->getFPFeatures();
9943
9944 return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
9945 LHS.get(), RHS.get());
9946 }
9947
9948 template <typename Derived>
9949 ExprResult TreeTransform<Derived>::TransformCXXRewrittenBinaryOperator(
9950 CXXRewrittenBinaryOperator *E) {
9951 CXXRewrittenBinaryOperator::DecomposedForm Decomp = E->getDecomposedForm();
9952
9953 ExprResult LHS = getDerived().TransformExpr(const_cast<Expr*>(Decomp.LHS));
9954 if (LHS.isInvalid())
9955 return ExprError();
9956
9957 ExprResult RHS = getDerived().TransformExpr(const_cast<Expr*>(Decomp.RHS));
9958 if (RHS.isInvalid())
9959 return ExprError();
9960
9961 if (!getDerived().AlwaysRebuild() &&
9962 LHS.get() == Decomp.LHS &&
9963 RHS.get() == Decomp.RHS)
9964 return E;
9965
9966 // Extract the already-resolved callee declarations so that we can restrict
9967 // ourselves to using them as the unqualified lookup results when rebuilding.
9968 UnresolvedSet<2> UnqualLookups;
9969 Expr *PossibleBinOps[] = {E->getSemanticForm(),
9970 const_cast<Expr *>(Decomp.InnerBinOp)};
9971 for (Expr *PossibleBinOp : PossibleBinOps) {
9972 auto *Op = dyn_cast<CXXOperatorCallExpr>(PossibleBinOp->IgnoreImplicit());
9973 if (!Op)
9974 continue;
9975 auto *Callee = dyn_cast<DeclRefExpr>(Op->getCallee()->IgnoreImplicit());
9976 if (!Callee || isa<CXXMethodDecl>(Callee->getDecl()))
9977 continue;
9978
9979 // Transform the callee in case we built a call to a local extern
9980 // declaration.
9981 NamedDecl *Found = cast_or_null<NamedDecl>(getDerived().TransformDecl(
9982 E->getOperatorLoc(), Callee->getFoundDecl()));
9983 if (!Found)
9984 return ExprError();
9985 UnqualLookups.addDecl(Found);
9986 }
9987
9988 return getDerived().RebuildCXXRewrittenBinaryOperator(
9989 E->getOperatorLoc(), Decomp.Opcode, UnqualLookups, LHS.get(), RHS.get());
9990 }
9991
9992 template<typename Derived>
9993 ExprResult
9994 TreeTransform<Derived>::TransformCompoundAssignOperator(
9995 CompoundAssignOperator *E) {
9996 return getDerived().TransformBinaryOperator(E);
9997 }
9998
9999 template<typename Derived>
10000 ExprResult TreeTransform<Derived>::
10001 TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
10002 // Just rebuild the common and RHS expressions and see whether we
10003 // get any changes.
10004
10005 ExprResult commonExpr = getDerived().TransformExpr(e->getCommon());
10006 if (commonExpr.isInvalid())
10007 return ExprError();
10008
10009 ExprResult rhs = getDerived().TransformExpr(e->getFalseExpr());
10010 if (rhs.isInvalid())
10011 return ExprError();
10012
10013 if (!getDerived().AlwaysRebuild() &&
10014 commonExpr.get() == e->getCommon() &&
10015 rhs.get() == e->getFalseExpr())
10016 return e;
10017
10018 return getDerived().RebuildConditionalOperator(commonExpr.get(),
10019 e->getQuestionLoc(),
10020 nullptr,
10021 e->getColonLoc(),
10022 rhs.get());
10023 }
10024
10025 template<typename Derived>
10026 ExprResult
10027 TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
10028 ExprResult Cond = getDerived().TransformExpr(E->getCond());
10029 if (Cond.isInvalid())
10030 return ExprError();
10031
10032 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
10033 if (LHS.isInvalid())
10034 return ExprError();
10035
10036 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
10037 if (RHS.isInvalid())
10038 return ExprError();
10039
10040 if (!getDerived().AlwaysRebuild() &&
10041 Cond.get() == E->getCond() &&
10042 LHS.get() == E->getLHS() &&
10043 RHS.get() == E->getRHS())
10044 return E;
10045
10046 return getDerived().RebuildConditionalOperator(Cond.get(),
10047 E->getQuestionLoc(),
10048 LHS.get(),
10049 E->getColonLoc(),
10050 RHS.get());
10051 }
10052
10053 template<typename Derived>
10054 ExprResult
10055 TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) {
10056 // Implicit casts are eliminated during transformation, since they
10057 // will be recomputed by semantic analysis after transformation.
10058 return getDerived().TransformExpr(E->getSubExprAsWritten());
10059 }
10060
10061 template<typename Derived>
10062 ExprResult
10063 TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
10064 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeInfoAsWritten());
10065 if (!Type)
10066 return ExprError();
10067
10068 ExprResult SubExpr
10069 = getDerived().TransformExpr(E->getSubExprAsWritten());
10070 if (SubExpr.isInvalid())
10071 return ExprError();
10072
10073 if (!getDerived().AlwaysRebuild() &&
10074 Type == E->getTypeInfoAsWritten() &&
10075 SubExpr.get() == E->getSubExpr())
10076 return E;
10077
10078 return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
10079 Type,
10080 E->getRParenLoc(),
10081 SubExpr.get());
10082 }
10083
10084 template<typename Derived>
10085 ExprResult
10086 TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
10087 TypeSourceInfo *OldT = E->getTypeSourceInfo();
10088 TypeSourceInfo *NewT = getDerived().TransformType(OldT);
10089 if (!NewT)
10090 return ExprError();
10091
10092 ExprResult Init = getDerived().TransformExpr(E->getInitializer());
10093 if (Init.isInvalid())
10094 return ExprError();
10095
10096 if (!getDerived().AlwaysRebuild() &&
10097 OldT == NewT &&
10098 Init.get() == E->getInitializer())
10099 return SemaRef.MaybeBindToTemporary(E);
10100
10101 // Note: the expression type doesn't necessarily match the
10102 // type-as-written, but that's okay, because it should always be
10103 // derivable from the initializer.
10104
10105 return getDerived().RebuildCompoundLiteralExpr(
10106 E->getLParenLoc(), NewT,
10107 /*FIXME:*/ E->getInitializer()->getEndLoc(), Init.get());
10108 }
10109
10110 template<typename Derived>
10111 ExprResult
10112 TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
10113 ExprResult Base = getDerived().TransformExpr(E->getBase());
10114 if (Base.isInvalid())
10115 return ExprError();
10116
10117 if (!getDerived().AlwaysRebuild() &&
10118 Base.get() == E->getBase())
10119 return E;
10120
10121 // FIXME: Bad source location
10122 SourceLocation FakeOperatorLoc =
10123 SemaRef.getLocForEndOfToken(E->getBase()->getEndLoc());
10124 return getDerived().RebuildExtVectorElementExpr(Base.get(), FakeOperatorLoc,
10125 E->getAccessorLoc(),
10126 E->getAccessor());
10127 }
10128
10129 template<typename Derived>
10130 ExprResult
10131 TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
10132 if (InitListExpr *Syntactic = E->getSyntacticForm())
10133 E = Syntactic;
10134
10135 bool InitChanged = false;
10136
10137 EnterExpressionEvaluationContext Context(
10138 getSema(), EnterExpressionEvaluationContext::InitList);
10139
10140 SmallVector<Expr*, 4> Inits;
10141 if (getDerived().TransformExprs(E->getInits(), E->getNumInits(), false,
10142 Inits, &InitChanged))
10143 return ExprError();
10144
10145 if (!getDerived().AlwaysRebuild() && !InitChanged) {
10146 // FIXME: Attempt to reuse the existing syntactic form of the InitListExpr
10147 // in some cases. We can't reuse it in general, because the syntactic and
10148 // semantic forms are linked, and we can't know that semantic form will
10149 // match even if the syntactic form does.
10150 }
10151
10152 return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
10153 E->getRBraceLoc());
10154 }
10155
10156 template<typename Derived>
10157 ExprResult
10158 TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
10159 Designation Desig;
10160
10161 // transform the initializer value
10162 ExprResult Init = getDerived().TransformExpr(E->getInit());
10163 if (Init.isInvalid())
10164 return ExprError();
10165
10166 // transform the designators.
10167 SmallVector<Expr*, 4> ArrayExprs;
10168 bool ExprChanged = false;
10169 for (const DesignatedInitExpr::Designator &D : E->designators()) {
10170 if (D.isFieldDesignator()) {
10171 Desig.AddDesignator(Designator::getField(D.getFieldName(),
10172 D.getDotLoc(),
10173 D.getFieldLoc()));
10174 if (D.getField()) {
10175 FieldDecl *Field = cast_or_null<FieldDecl>(
10176 getDerived().TransformDecl(D.getFieldLoc(), D.getField()));
10177 if (Field != D.getField())
10178 // Rebuild the expression when the transformed FieldDecl is
10179 // different to the already assigned FieldDecl.
10180 ExprChanged = true;
10181 } else {
10182 // Ensure that the designator expression is rebuilt when there isn't
10183 // a resolved FieldDecl in the designator as we don't want to assign
10184 // a FieldDecl to a pattern designator that will be instantiated again.
10185 ExprChanged = true;
10186 }
10187 continue;
10188 }
10189
10190 if (D.isArrayDesignator()) {
10191 ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(D));
10192 if (Index.isInvalid())
10193 return ExprError();
10194
10195 Desig.AddDesignator(
10196 Designator::getArray(Index.get(), D.getLBracketLoc()));
10197
10198 ExprChanged = ExprChanged || Init.get() != E->getArrayIndex(D);
10199 ArrayExprs.push_back(Index.get());
10200 continue;
10201 }
10202
10203 assert(D.isArrayRangeDesignator() && "New kind of designator?");
10204 ExprResult Start
10205 = getDerived().TransformExpr(E->getArrayRangeStart(D));
10206 if (Start.isInvalid())
10207 return ExprError();
10208
10209 ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(D));
10210 if (End.isInvalid())
10211 return ExprError();
10212
10213 Desig.AddDesignator(Designator::getArrayRange(Start.get(),
10214 End.get(),
10215 D.getLBracketLoc(),
10216 D.getEllipsisLoc()));
10217
10218 ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(D) ||
10219 End.get() != E->getArrayRangeEnd(D);
10220
10221 ArrayExprs.push_back(Start.get());
10222 ArrayExprs.push_back(End.get());
10223 }
10224
10225 if (!getDerived().AlwaysRebuild() &&
10226 Init.get() == E->getInit() &&
10227 !ExprChanged)
10228 return E;
10229
10230 return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
10231 E->getEqualOrColonLoc(),
10232 E->usesGNUSyntax(), Init.get());
10233 }
10234
10235 // Seems that if TransformInitListExpr() only works on the syntactic form of an
10236 // InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
10237 template<typename Derived>
10238 ExprResult
10239 TreeTransform<Derived>::TransformDesignatedInitUpdateExpr(
10240 DesignatedInitUpdateExpr *E) {
10241 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
10242 "initializer");
10243 return ExprError();
10244 }
10245
10246 template<typename Derived>
10247 ExprResult
10248 TreeTransform<Derived>::TransformNoInitExpr(
10249 NoInitExpr *E) {
10250 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
10251 return ExprError();
10252 }
10253
10254 template<typename Derived>
10255 ExprResult
10256 TreeTransform<Derived>::TransformArrayInitLoopExpr(ArrayInitLoopExpr *E) {
10257 llvm_unreachable("Unexpected ArrayInitLoopExpr outside of initializer");
10258 return ExprError();
10259 }
10260
10261 template<typename Derived>
10262 ExprResult
10263 TreeTransform<Derived>::TransformArrayInitIndexExpr(ArrayInitIndexExpr *E) {
10264 llvm_unreachable("Unexpected ArrayInitIndexExpr outside of initializer");
10265 return ExprError();
10266 }
10267
10268 template<typename Derived>
10269 ExprResult
10270 TreeTransform<Derived>::TransformImplicitValueInitExpr(
10271 ImplicitValueInitExpr *E) {
10272 TemporaryBase Rebase(*this, E->getBeginLoc(), DeclarationName());
10273
10274 // FIXME: Will we ever have proper type location here? Will we actually
10275 // need to transform the type?
10276 QualType T = getDerived().TransformType(E->getType());
10277 if (T.isNull())
10278 return ExprError();
10279
10280 if (!getDerived().AlwaysRebuild() &&
10281 T == E->getType())
10282 return E;
10283
10284 return getDerived().RebuildImplicitValueInitExpr(T);
10285 }
10286
10287 template<typename Derived>
10288 ExprResult
10289 TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
10290 TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
10291 if (!TInfo)
10292 return ExprError();
10293
10294 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
10295 if (SubExpr.isInvalid())
10296 return ExprError();
10297
10298 if (!getDerived().AlwaysRebuild() &&
10299 TInfo == E->getWrittenTypeInfo() &&
10300 SubExpr.get() == E->getSubExpr())
10301 return E;
10302
10303 return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
10304 TInfo, E->getRParenLoc());
10305 }
10306
10307 template<typename Derived>
10308 ExprResult
10309 TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
10310 bool ArgumentChanged = false;
10311 SmallVector<Expr*, 4> Inits;
10312 if (TransformExprs(E->getExprs(), E->getNumExprs(), true, Inits,
10313 &ArgumentChanged))
10314 return ExprError();
10315
10316 return getDerived().RebuildParenListExpr(E->getLParenLoc(),
10317 Inits,
10318 E->getRParenLoc());
10319 }
10320
10321 /// Transform an address-of-label expression.
10322 ///
10323 /// By default, the transformation of an address-of-label expression always
10324 /// rebuilds the expression, so that the label identifier can be resolved to
10325 /// the corresponding label statement by semantic analysis.
10326 template<typename Derived>
10327 ExprResult
10328 TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) {
10329 Decl *LD = getDerived().TransformDecl(E->getLabel()->getLocation(),
10330 E->getLabel());
10331 if (!LD)
10332 return ExprError();
10333
10334 return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
10335 cast<LabelDecl>(LD));
10336 }
10337
10338 template<typename Derived>
10339 ExprResult
10340 TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
10341 SemaRef.ActOnStartStmtExpr();
10342 StmtResult SubStmt
10343 = getDerived().TransformCompoundStmt(E->getSubStmt(), true);
10344 if (SubStmt.isInvalid()) {
10345 SemaRef.ActOnStmtExprError();
10346 return ExprError();
10347 }
10348
10349 if (!getDerived().AlwaysRebuild() &&
10350 SubStmt.get() == E->getSubStmt()) {
10351 // Calling this an 'error' is unintuitive, but it does the right thing.
10352 SemaRef.ActOnStmtExprError();
10353 return SemaRef.MaybeBindToTemporary(E);
10354 }
10355
10356 return getDerived().RebuildStmtExpr(E->getLParenLoc(),
10357 SubStmt.get(),
10358 E->getRParenLoc());
10359 }
10360
10361 template<typename Derived>
10362 ExprResult
10363 TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
10364 ExprResult Cond = getDerived().TransformExpr(E->getCond());
10365 if (Cond.isInvalid())
10366 return ExprError();
10367
10368 ExprResult LHS = getDerived().TransformExpr(E->getLHS());
10369 if (LHS.isInvalid())
10370 return ExprError();
10371
10372 ExprResult RHS = getDerived().TransformExpr(E->getRHS());
10373 if (RHS.isInvalid())
10374 return ExprError();
10375
10376 if (!getDerived().AlwaysRebuild() &&
10377 Cond.get() == E->getCond() &&
10378 LHS.get() == E->getLHS() &&
10379 RHS.get() == E->getRHS())
10380 return E;
10381
10382 return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
10383 Cond.get(), LHS.get(), RHS.get(),
10384 E->getRParenLoc());
10385 }
10386
10387 template<typename Derived>
10388 ExprResult
10389 TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
10390 return E;
10391 }
10392
10393 template<typename Derived>
10394 ExprResult
10395 TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
10396 switch (E->getOperator()) {
10397 case OO_New:
10398 case OO_Delete:
10399 case OO_Array_New:
10400 case OO_Array_Delete:
10401 llvm_unreachable("new and delete operators cannot use CXXOperatorCallExpr");
10402
10403 case OO_Call: {
10404 // This is a call to an object's operator().
10405 assert(E->getNumArgs() >= 1 && "Object call is missing arguments");
10406
10407 // Transform the object itself.
10408 ExprResult Object = getDerived().TransformExpr(E->getArg(0));
10409 if (Object.isInvalid())
10410 return ExprError();
10411
10412 // FIXME: Poor location information
10413 SourceLocation FakeLParenLoc = SemaRef.getLocForEndOfToken(
10414 static_cast<Expr *>(Object.get())->getEndLoc());
10415
10416 // Transform the call arguments.
10417 SmallVector<Expr*, 8> Args;
10418 if (getDerived().TransformExprs(E->getArgs() + 1, E->getNumArgs() - 1, true,
10419 Args))
10420 return ExprError();
10421
10422 return getDerived().RebuildCallExpr(Object.get(), FakeLParenLoc, Args,
10423 E->getEndLoc());
10424 }
10425
10426 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
10427 case OO_##Name:
10428 #define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
10429 #include "clang/Basic/OperatorKinds.def"
10430 case OO_Subscript:
10431 // Handled below.
10432 break;
10433
10434 case OO_Conditional:
10435 llvm_unreachable("conditional operator is not actually overloadable");
10436
10437 case OO_None:
10438 case NUM_OVERLOADED_OPERATORS:
10439 llvm_unreachable("not an overloaded operator?");
10440 }
10441
10442 ExprResult Callee = getDerived().TransformExpr(E->getCallee());
10443 if (Callee.isInvalid())
10444 return ExprError();
10445
10446 ExprResult First;
10447 if (E->getOperator() == OO_Amp)
10448 First = getDerived().TransformAddressOfOperand(E->getArg(0));
10449 else
10450 First = getDerived().TransformExpr(E->getArg(0));
10451 if (First.isInvalid())
10452 return ExprError();
10453
10454 ExprResult Second;
10455 if (E->getNumArgs() == 2) {
10456 Second = getDerived().TransformExpr(E->getArg(1));
10457 if (Second.isInvalid())
10458 return ExprError();
10459 }
10460
10461 if (!getDerived().AlwaysRebuild() &&
10462 Callee.get() == E->getCallee() &&
10463 First.get() == E->getArg(0) &&
10464 (E->getNumArgs() != 2 || Second.get() == E->getArg(1)))
10465 return SemaRef.MaybeBindToTemporary(E);
10466
10467 Sema::FPContractStateRAII FPContractState(getSema());
10468 getSema().FPFeatures = E->getFPFeatures();
10469
10470 return getDerived().RebuildCXXOperatorCallExpr(E->getOperator(),
10471 E->getOperatorLoc(),
10472 Callee.get(),
10473 First.get(),
10474 Second.get());
10475 }
10476
10477 template<typename Derived>
10478 ExprResult
10479 TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) {
10480 return getDerived().TransformCallExpr(E);
10481 }
10482
10483 template <typename Derived>
10484 ExprResult TreeTransform<Derived>::TransformSourceLocExpr(SourceLocExpr *E) {
10485 bool NeedRebuildFunc = E->getIdentKind() == SourceLocExpr::Function &&
10486 getSema().CurContext != E->getParentContext();
10487
10488 if (!getDerived().AlwaysRebuild() && !NeedRebuildFunc)
10489 return E;
10490
10491 return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getBeginLoc(),
10492 E->getEndLoc(),
10493 getSema().CurContext);
10494 }
10495
10496 template<typename Derived>
10497 ExprResult
10498 TreeTransform<Derived>::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
10499 // Transform the callee.
10500 ExprResult Callee = getDerived().TransformExpr(E->getCallee());
10501 if (Callee.isInvalid())
10502 return ExprError();
10503
10504 // Transform exec config.
10505 ExprResult EC = getDerived().TransformCallExpr(E->getConfig());
10506 if (EC.isInvalid())
10507 return ExprError();
10508
10509 // Transform arguments.
10510 bool ArgChanged = false;
10511 SmallVector<Expr*, 8> Args;
10512 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
10513 &ArgChanged))
10514 return ExprError();
10515
10516 if (!getDerived().AlwaysRebuild() &&
10517 Callee.get() == E->getCallee() &&
10518 !ArgChanged)
10519 return SemaRef.MaybeBindToTemporary(E);
10520
10521 // FIXME: Wrong source location information for the '('.
10522 SourceLocation FakeLParenLoc
10523 = ((Expr *)Callee.get())->getSourceRange().getBegin();
10524 return getDerived().RebuildCallExpr(Callee.get(), FakeLParenLoc,
10525 Args,
10526 E->getRParenLoc(), EC.get());
10527 }
10528
10529 template<typename Derived>
10530 ExprResult
10531 TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) {
10532 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeInfoAsWritten());
10533 if (!Type)
10534 return ExprError();
10535
10536 ExprResult SubExpr
10537 = getDerived().TransformExpr(E->getSubExprAsWritten());
10538 if (SubExpr.isInvalid())
10539 return ExprError();
10540
10541 if (!getDerived().AlwaysRebuild() &&
10542 Type == E->getTypeInfoAsWritten() &&
10543 SubExpr.get() == E->getSubExpr())
10544 return E;
10545 return getDerived().RebuildCXXNamedCastExpr(
10546 E->getOperatorLoc(), E->getStmtClass(), E->getAngleBrackets().getBegin(),
10547 Type, E->getAngleBrackets().getEnd(),
10548 // FIXME. this should be '(' location
10549 E->getAngleBrackets().getEnd(), SubExpr.get(), E->getRParenLoc());
10550 }
10551
10552 template<typename Derived>
10553 ExprResult
10554 TreeTransform<Derived>::TransformBuiltinBitCastExpr(BuiltinBitCastExpr *BCE) {
10555 TypeSourceInfo *TSI =
10556 getDerived().TransformType(BCE->getTypeInfoAsWritten());
10557 if (!TSI)
10558 return ExprError();
10559
10560 ExprResult Sub = getDerived().TransformExpr(BCE->getSubExpr());
10561 if (Sub.isInvalid())
10562 return ExprError();
10563
10564 return getDerived().RebuildBuiltinBitCastExpr(BCE->getBeginLoc(), TSI,
10565 Sub.get(), BCE->getEndLoc());
10566 }
10567
10568 template<typename Derived>
10569 ExprResult
10570 TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
10571 return getDerived().TransformCXXNamedCastExpr(E);
10572 }
10573
10574 template<typename Derived>
10575 ExprResult
10576 TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
10577 return getDerived().TransformCXXNamedCastExpr(E);
10578 }
10579
10580 template<typename Derived>
10581 ExprResult
10582 TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
10583 CXXReinterpretCastExpr *E) {
10584 return getDerived().TransformCXXNamedCastExpr(E);
10585 }
10586
10587 template<typename Derived>
10588 ExprResult
10589 TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) {
10590 return getDerived().TransformCXXNamedCastExpr(E);
10591 }
10592
10593 template<typename Derived>
10594 ExprResult
10595 TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
10596 CXXFunctionalCastExpr *E) {
10597 TypeSourceInfo *Type =
10598 getDerived().TransformTypeWithDeducedTST(E->getTypeInfoAsWritten());
10599 if (!Type)
10600 return ExprError();
10601
10602 ExprResult SubExpr
10603 = getDerived().TransformExpr(E->getSubExprAsWritten());
10604 if (SubExpr.isInvalid())
10605 return ExprError();
10606
10607 if (!getDerived().AlwaysRebuild() &&
10608 Type == E->getTypeInfoAsWritten() &&
10609 SubExpr.get() == E->getSubExpr())
10610 return E;
10611
10612 return getDerived().RebuildCXXFunctionalCastExpr(Type,
10613 E->getLParenLoc(),
10614 SubExpr.get(),
10615 E->getRParenLoc(),
10616 E->isListInitialization());
10617 }
10618
10619 template<typename Derived>
10620 ExprResult
10621 TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
10622 if (E->isTypeOperand()) {
10623 TypeSourceInfo *TInfo
10624 = getDerived().TransformType(E->getTypeOperandSourceInfo());
10625 if (!TInfo)
10626 return ExprError();
10627
10628 if (!getDerived().AlwaysRebuild() &&
10629 TInfo == E->getTypeOperandSourceInfo())
10630 return E;
10631
10632 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
10633 TInfo, E->getEndLoc());
10634 }
10635
10636 // We don't know whether the subexpression is potentially evaluated until
10637 // after we perform semantic analysis. We speculatively assume it is
10638 // unevaluated; it will get fixed later if the subexpression is in fact
10639 // potentially evaluated.
10640 EnterExpressionEvaluationContext Unevaluated(
10641 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated,
10642 Sema::ReuseLambdaContextDecl);
10643
10644 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
10645 if (SubExpr.isInvalid())
10646 return ExprError();
10647
10648 if (!getDerived().AlwaysRebuild() &&
10649 SubExpr.get() == E->getExprOperand())
10650 return E;
10651
10652 return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
10653 SubExpr.get(), E->getEndLoc());
10654 }
10655
10656 template<typename Derived>
10657 ExprResult
10658 TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *E) {
10659 if (E->isTypeOperand()) {
10660 TypeSourceInfo *TInfo
10661 = getDerived().TransformType(E->getTypeOperandSourceInfo());
10662 if (!TInfo)
10663 return ExprError();
10664
10665 if (!getDerived().AlwaysRebuild() &&
10666 TInfo == E->getTypeOperandSourceInfo())
10667 return E;
10668
10669 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
10670 TInfo, E->getEndLoc());
10671 }
10672
10673 EnterExpressionEvaluationContext Unevaluated(
10674 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
10675
10676 ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
10677 if (SubExpr.isInvalid())
10678 return ExprError();
10679
10680 if (!getDerived().AlwaysRebuild() &&
10681 SubExpr.get() == E->getExprOperand())
10682 return E;
10683
10684 return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
10685 SubExpr.get(), E->getEndLoc());
10686 }
10687
10688 template<typename Derived>
10689 ExprResult
10690 TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
10691 return E;
10692 }
10693
10694 template<typename Derived>
10695 ExprResult
10696 TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
10697 CXXNullPtrLiteralExpr *E) {
10698 return E;
10699 }
10700
10701 template<typename Derived>
10702 ExprResult
10703 TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
10704 QualType T = getSema().getCurrentThisType();
10705
10706 if (!getDerived().AlwaysRebuild() && T == E->getType()) {
10707 // Mark it referenced in the new context regardless.
10708 // FIXME: this is a bit instantiation-specific.
10709 getSema().MarkThisReferenced(E);
10710 return E;
10711 }
10712
10713 return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
10714 }
10715
10716 template<typename Derived>
10717 ExprResult
10718 TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
10719 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
10720 if (SubExpr.isInvalid())
10721 return ExprError();
10722
10723 if (!getDerived().AlwaysRebuild() &&
10724 SubExpr.get() == E->getSubExpr())
10725 return E;
10726
10727 return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
10728 E->isThrownVariableInScope());
10729 }
10730
10731 template<typename Derived>
10732 ExprResult
10733 TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
10734 ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
10735 getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
10736 if (!Param)
10737 return ExprError();
10738
10739 if (!getDerived().AlwaysRebuild() && Param == E->getParam() &&
10740 E->getUsedContext() == SemaRef.CurContext)
10741 return E;
10742
10743 return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param);
10744 }
10745
10746 template<typename Derived>
10747 ExprResult
10748 TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
10749 FieldDecl *Field = cast_or_null<FieldDecl>(
10750 getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
10751 if (!Field)
10752 return ExprError();
10753
10754 if (!getDerived().AlwaysRebuild() && Field == E->getField() &&
10755 E->getUsedContext() == SemaRef.CurContext)
10756 return E;
10757
10758 return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
10759 }
10760
10761 template<typename Derived>
10762 ExprResult
10763 TreeTransform<Derived>::TransformCXXScalarValueInitExpr(
10764 CXXScalarValueInitExpr *E) {
10765 TypeSourceInfo *T = getDerived().TransformType(E->getTypeSourceInfo());
10766 if (!T)
10767 return ExprError();
10768
10769 if (!getDerived().AlwaysRebuild() &&
10770 T == E->getTypeSourceInfo())
10771 return E;
10772
10773 return getDerived().RebuildCXXScalarValueInitExpr(T,
10774 /*FIXME:*/T->getTypeLoc().getEndLoc(),
10775 E->getRParenLoc());
10776 }
10777
10778 template<typename Derived>
10779 ExprResult
10780 TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
10781 // Transform the type that we're allocating
10782 TypeSourceInfo *AllocTypeInfo =
10783 getDerived().TransformTypeWithDeducedTST(E->getAllocatedTypeSourceInfo());
10784 if (!AllocTypeInfo)
10785 return ExprError();
10786
10787 // Transform the size of the array we're allocating (if any).
10788 Optional<Expr *> ArraySize;
10789 if (Optional<Expr *> OldArraySize = E->getArraySize()) {
10790 ExprResult NewArraySize;
10791 if (*OldArraySize) {
10792 NewArraySize = getDerived().TransformExpr(*OldArraySize);
10793 if (NewArraySize.isInvalid())
10794 return ExprError();
10795 }
10796 ArraySize = NewArraySize.get();
10797 }
10798
10799 // Transform the placement arguments (if any).
10800 bool ArgumentChanged = false;
10801 SmallVector<Expr*, 8> PlacementArgs;
10802 if (getDerived().TransformExprs(E->getPlacementArgs(),
10803 E->getNumPlacementArgs(), true,
10804 PlacementArgs, &ArgumentChanged))
10805 return ExprError();
10806
10807 // Transform the initializer (if any).
10808 Expr *OldInit = E->getInitializer();
10809 ExprResult NewInit;
10810 if (OldInit)
10811 NewInit = getDerived().TransformInitializer(OldInit, true);
10812 if (NewInit.isInvalid())
10813 return ExprError();
10814
10815 // Transform new operator and delete operator.
10816 FunctionDecl *OperatorNew = nullptr;
10817 if (E->getOperatorNew()) {
10818 OperatorNew = cast_or_null<FunctionDecl>(
10819 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
10820 if (!OperatorNew)
10821 return ExprError();
10822 }
10823
10824 FunctionDecl *OperatorDelete = nullptr;
10825 if (E->getOperatorDelete()) {
10826 OperatorDelete = cast_or_null<FunctionDecl>(
10827 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
10828 if (!OperatorDelete)
10829 return ExprError();
10830 }
10831
10832 if (!getDerived().AlwaysRebuild() &&
10833 AllocTypeInfo == E->getAllocatedTypeSourceInfo() &&
10834 ArraySize == E->getArraySize() &&
10835 NewInit.get() == OldInit &&
10836 OperatorNew == E->getOperatorNew() &&
10837 OperatorDelete == E->getOperatorDelete() &&
10838 !ArgumentChanged) {
10839 // Mark any declarations we need as referenced.
10840 // FIXME: instantiation-specific.
10841 if (OperatorNew)
10842 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorNew);
10843 if (OperatorDelete)
10844 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
10845
10846 if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
10847 QualType ElementType
10848 = SemaRef.Context.getBaseElementType(E->getAllocatedType());
10849 if (const RecordType *RecordT = ElementType->getAs<RecordType>()) {
10850 CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordT->getDecl());
10851 if (CXXDestructorDecl *Destructor = SemaRef.LookupDestructor(Record)) {
10852 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Destructor);
10853 }
10854 }
10855 }
10856
10857 return E;
10858 }
10859
10860 QualType AllocType = AllocTypeInfo->getType();
10861 if (!ArraySize) {
10862 // If no array size was specified, but the new expression was
10863 // instantiated with an array type (e.g., "new T" where T is
10864 // instantiated with "int[4]"), extract the outer bound from the
10865 // array type as our array size. We do this with constant and
10866 // dependently-sized array types.
10867 const ArrayType *ArrayT = SemaRef.Context.getAsArrayType(AllocType);
10868 if (!ArrayT) {
10869 // Do nothing
10870 } else if (const ConstantArrayType *ConsArrayT
10871 = dyn_cast<ConstantArrayType>(ArrayT)) {
10872 ArraySize = IntegerLiteral::Create(SemaRef.Context, ConsArrayT->getSize(),
10873 SemaRef.Context.getSizeType(),
10874 /*FIXME:*/ E->getBeginLoc());
10875 AllocType = ConsArrayT->getElementType();
10876 } else if (const DependentSizedArrayType *DepArrayT
10877 = dyn_cast<DependentSizedArrayType>(ArrayT)) {
10878 if (DepArrayT->getSizeExpr()) {
10879 ArraySize = DepArrayT->getSizeExpr();
10880 AllocType = DepArrayT->getElementType();
10881 }
10882 }
10883 }
10884
10885 return getDerived().RebuildCXXNewExpr(
10886 E->getBeginLoc(), E->isGlobalNew(),
10887 /*FIXME:*/ E->getBeginLoc(), PlacementArgs,
10888 /*FIXME:*/ E->getBeginLoc(), E->getTypeIdParens(), AllocType,
10889 AllocTypeInfo, ArraySize, E->getDirectInitRange(), NewInit.get());
10890 }
10891
10892 template<typename Derived>
10893 ExprResult
10894 TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
10895 ExprResult Operand = getDerived().TransformExpr(E->getArgument());
10896 if (Operand.isInvalid())
10897 return ExprError();
10898
10899 // Transform the delete operator, if known.
10900 FunctionDecl *OperatorDelete = nullptr;
10901 if (E->getOperatorDelete()) {
10902 OperatorDelete = cast_or_null<FunctionDecl>(
10903 getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
10904 if (!OperatorDelete)
10905 return ExprError();
10906 }
10907
10908 if (!getDerived().AlwaysRebuild() &&
10909 Operand.get() == E->getArgument() &&
10910 OperatorDelete == E->getOperatorDelete()) {
10911 // Mark any declarations we need as referenced.
10912 // FIXME: instantiation-specific.
10913 if (OperatorDelete)
10914 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
10915
10916 if (!E->getArgument()->isTypeDependent()) {
10917 QualType Destroyed = SemaRef.Context.getBaseElementType(
10918 E->getDestroyedType());
10919 if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
10920 CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
10921 SemaRef.MarkFunctionReferenced(E->getBeginLoc(),
10922 SemaRef.LookupDestructor(Record));
10923 }
10924 }
10925
10926 return E;
10927 }
10928
10929 return getDerived().RebuildCXXDeleteExpr(
10930 E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(), Operand.get());
10931 }
10932
10933 template<typename Derived>
10934 ExprResult
10935 TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
10936 CXXPseudoDestructorExpr *E) {
10937 ExprResult Base = getDerived().TransformExpr(E->getBase());
10938 if (Base.isInvalid())
10939 return ExprError();
10940
10941 ParsedType ObjectTypePtr;
10942 bool MayBePseudoDestructor = false;
10943 Base = SemaRef.ActOnStartCXXMemberReference(nullptr, Base.get(),
10944 E->getOperatorLoc(),
10945 E->isArrow()? tok::arrow : tok::period,
10946 ObjectTypePtr,
10947 MayBePseudoDestructor);
10948 if (Base.isInvalid())
10949 return ExprError();
10950
10951 QualType ObjectType = ObjectTypePtr.get();
10952 NestedNameSpecifierLoc QualifierLoc = E->getQualifierLoc();
10953 if (QualifierLoc) {
10954 QualifierLoc
10955 = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc, ObjectType);
10956 if (!QualifierLoc)
10957 return ExprError();
10958 }
10959 CXXScopeSpec SS;
10960 SS.Adopt(QualifierLoc);
10961
10962 PseudoDestructorTypeStorage Destroyed;
10963 if (E->getDestroyedTypeInfo()) {
10964 TypeSourceInfo *DestroyedTypeInfo
10965 = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
10966 ObjectType, nullptr, SS);
10967 if (!DestroyedTypeInfo)
10968 return ExprError();
10969 Destroyed = DestroyedTypeInfo;
10970 } else if (!ObjectType.isNull() && ObjectType->isDependentType()) {
10971 // We aren't likely to be able to resolve the identifier down to a type
10972 // now anyway, so just retain the identifier.
10973 Destroyed = PseudoDestructorTypeStorage(E->getDestroyedTypeIdentifier(),
10974 E->getDestroyedTypeLoc());
10975 } else {
10976 // Look for a destructor known with the given name.
10977 ParsedType T = SemaRef.getDestructorName(E->getTildeLoc(),
10978 *E->getDestroyedTypeIdentifier(),
10979 E->getDestroyedTypeLoc(),
10980 /*Scope=*/nullptr,
10981 SS, ObjectTypePtr,
10982 false);
10983 if (!T)
10984 return ExprError();
10985
10986 Destroyed
10987 = SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.GetTypeFromParser(T),
10988 E->getDestroyedTypeLoc());
10989 }
10990
10991 TypeSourceInfo *ScopeTypeInfo = nullptr;
10992 if (E->getScopeTypeInfo()) {
10993 CXXScopeSpec EmptySS;
10994 ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
10995 E->getScopeTypeInfo(), ObjectType, nullptr, EmptySS);
10996 if (!ScopeTypeInfo)
10997 return ExprError();
10998 }
10999
11000 return getDerived().RebuildCXXPseudoDestructorExpr(Base.get(),
11001 E->getOperatorLoc(),
11002 E->isArrow(),
11003 SS,
11004 ScopeTypeInfo,
11005 E->getColonColonLoc(),
11006 E->getTildeLoc(),
11007 Destroyed);
11008 }
11009
11010 template <typename Derived>
11011 bool TreeTransform<Derived>::TransformOverloadExprDecls(OverloadExpr *Old,
11012 bool RequiresADL,
11013 LookupResult &R) {
11014 // Transform all the decls.
11015 bool AllEmptyPacks = true;
11016 for (auto *OldD : Old->decls()) {
11017 Decl *InstD = getDerived().TransformDecl(Old->getNameLoc(), OldD);
11018 if (!InstD) {
11019 // Silently ignore these if a UsingShadowDecl instantiated to nothing.
11020 // This can happen because of dependent hiding.
11021 if (isa<UsingShadowDecl>(OldD))
11022 continue;
11023 else {
11024 R.clear();
11025 return true;
11026 }
11027 }
11028
11029 // Expand using pack declarations.
11030 NamedDecl *SingleDecl = cast<NamedDecl>(InstD);
11031 ArrayRef<NamedDecl*> Decls = SingleDecl;
11032 if (auto *UPD = dyn_cast<UsingPackDecl>(InstD))
11033 Decls = UPD->expansions();
11034
11035 // Expand using declarations.
11036 for (auto *D : Decls) {
11037 if (auto *UD = dyn_cast<UsingDecl>(D)) {
11038 for (auto *SD : UD->shadows())
11039 R.addDecl(SD);
11040 } else {
11041 R.addDecl(D);
11042 }
11043 }
11044
11045 AllEmptyPacks &= Decls.empty();
11046 };
11047
11048 // C++ [temp.res]/8.4.2:
11049 // The program is ill-formed, no diagnostic required, if [...] lookup for
11050 // a name in the template definition found a using-declaration, but the
11051 // lookup in the corresponding scope in the instantiation odoes not find
11052 // any declarations because the using-declaration was a pack expansion and
11053 // the corresponding pack is empty
11054 if (AllEmptyPacks && !RequiresADL) {
11055 getSema().Diag(Old->getNameLoc(), diag::err_using_pack_expansion_empty)
11056 << isa<UnresolvedMemberExpr>(Old) << Old->getName();
11057 return true;
11058 }
11059
11060 // Resolve a kind, but don't do any further analysis. If it's
11061 // ambiguous, the callee needs to deal with it.
11062 R.resolveKind();
11063 return false;
11064 }
11065
11066 template<typename Derived>
11067 ExprResult
11068 TreeTransform<Derived>::TransformUnresolvedLookupExpr(
11069 UnresolvedLookupExpr *Old) {
11070 LookupResult R(SemaRef, Old->getName(), Old->getNameLoc(),
11071 Sema::LookupOrdinaryName);
11072
11073 // Transform the declaration set.
11074 if (TransformOverloadExprDecls(Old, Old->requiresADL(), R))
11075 return ExprError();
11076
11077 // Rebuild the nested-name qualifier, if present.
11078 CXXScopeSpec SS;
11079 if (Old->getQualifierLoc()) {
11080 NestedNameSpecifierLoc QualifierLoc
11081 = getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
11082 if (!QualifierLoc)
11083 return ExprError();
11084
11085 SS.Adopt(QualifierLoc);
11086 }
11087
11088 if (Old->getNamingClass()) {
11089 CXXRecordDecl *NamingClass
11090 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
11091 Old->getNameLoc(),
11092 Old->getNamingClass()));
11093 if (!NamingClass) {
11094 R.clear();
11095 return ExprError();
11096 }
11097
11098 R.setNamingClass(NamingClass);
11099 }
11100
11101 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
11102
11103 // If we have neither explicit template arguments, nor the template keyword,
11104 // it's a normal declaration name or member reference.
11105 if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid()) {
11106 NamedDecl *D = R.getAsSingle<NamedDecl>();
11107 // In a C++11 unevaluated context, an UnresolvedLookupExpr might refer to an
11108 // instance member. In other contexts, BuildPossibleImplicitMemberExpr will
11109 // give a good diagnostic.
11110 if (D && D->isCXXInstanceMember()) {
11111 return SemaRef.BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc, R,
11112 /*TemplateArgs=*/nullptr,
11113 /*Scope=*/nullptr);
11114 }
11115
11116 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
11117 }
11118
11119 // If we have template arguments, rebuild them, then rebuild the
11120 // templateid expression.
11121 TemplateArgumentListInfo TransArgs(Old->getLAngleLoc(), Old->getRAngleLoc());
11122 if (Old->hasExplicitTemplateArgs() &&
11123 getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
11124 Old->getNumTemplateArgs(),
11125 TransArgs)) {
11126 R.clear();
11127 return ExprError();
11128 }
11129
11130 return getDerived().RebuildTemplateIdExpr(SS, TemplateKWLoc, R,
11131 Old->requiresADL(), &TransArgs);
11132 }
11133
11134 template<typename Derived>
11135 ExprResult
11136 TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *E) {
11137 bool ArgChanged = false;
11138 SmallVector<TypeSourceInfo *, 4> Args;
11139 for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
11140 TypeSourceInfo *From = E->getArg(I);
11141 TypeLoc FromTL = From->getTypeLoc();
11142 if (!FromTL.getAs<PackExpansionTypeLoc>()) {
11143 TypeLocBuilder TLB;
11144 TLB.reserve(FromTL.getFullDataSize());
11145 QualType To = getDerived().TransformType(TLB, FromTL);
11146 if (To.isNull())
11147 return ExprError();
11148
11149 if (To == From->getType())
11150 Args.push_back(From);
11151 else {
11152 Args.push_back(TLB.getTypeSourceInfo(SemaRef.Context, To));
11153 ArgChanged = true;
11154 }
11155 continue;
11156 }
11157
11158 ArgChanged = true;
11159
11160 // We have a pack expansion. Instantiate it.
11161 PackExpansionTypeLoc ExpansionTL = FromTL.castAs<PackExpansionTypeLoc>();
11162 TypeLoc PatternTL = ExpansionTL.getPatternLoc();
11163 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
11164 SemaRef.collectUnexpandedParameterPacks(PatternTL, Unexpanded);
11165
11166 // Determine whether the set of unexpanded parameter packs can and should
11167 // be expanded.
11168 bool Expand = true;
11169 bool RetainExpansion = false;
11170 Optional<unsigned> OrigNumExpansions =
11171 ExpansionTL.getTypePtr()->getNumExpansions();
11172 Optional<unsigned> NumExpansions = OrigNumExpansions;
11173 if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(),
11174 PatternTL.getSourceRange(),
11175 Unexpanded,
11176 Expand, RetainExpansion,
11177 NumExpansions))
11178 return ExprError();
11179
11180 if (!Expand) {
11181 // The transform has determined that we should perform a simple
11182 // transformation on the pack expansion, producing another pack
11183 // expansion.
11184 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
11185
11186 TypeLocBuilder TLB;
11187 TLB.reserve(From->getTypeLoc().getFullDataSize());
11188
11189 QualType To = getDerived().TransformType(TLB, PatternTL);
11190 if (To.isNull())
11191 return ExprError();
11192
11193 To = getDerived().RebuildPackExpansionType(To,
11194 PatternTL.getSourceRange(),
11195 ExpansionTL.getEllipsisLoc(),
11196 NumExpansions);
11197 if (To.isNull())
11198 return ExprError();
11199
11200 PackExpansionTypeLoc ToExpansionTL
11201 = TLB.push<PackExpansionTypeLoc>(To);
11202 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
11203 Args.push_back(TLB.getTypeSourceInfo(SemaRef.Context, To));
11204 continue;
11205 }
11206
11207 // Expand the pack expansion by substituting for each argument in the
11208 // pack(s).
11209 for (unsigned I = 0; I != *NumExpansions; ++I) {
11210 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
11211 TypeLocBuilder TLB;
11212 TLB.reserve(PatternTL.getFullDataSize());
11213 QualType To = getDerived().TransformType(TLB, PatternTL);
11214 if (To.isNull())
11215 return ExprError();
11216
11217 if (To->containsUnexpandedParameterPack()) {
11218 To = getDerived().RebuildPackExpansionType(To,
11219 PatternTL.getSourceRange(),
11220 ExpansionTL.getEllipsisLoc(),
11221 NumExpansions);
11222 if (To.isNull())
11223 return ExprError();
11224
11225 PackExpansionTypeLoc ToExpansionTL
11226 = TLB.push<PackExpansionTypeLoc>(To);
11227 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
11228 }
11229
11230 Args.push_back(TLB.getTypeSourceInfo(SemaRef.Context, To));
11231 }
11232
11233 if (!RetainExpansion)
11234 continue;
11235
11236 // If we're supposed to retain a pack expansion, do so by temporarily
11237 // forgetting the partially-substituted parameter pack.
11238 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
11239
11240 TypeLocBuilder TLB;
11241 TLB.reserve(From->getTypeLoc().getFullDataSize());
11242
11243 QualType To = getDerived().TransformType(TLB, PatternTL);
11244 if (To.isNull())
11245 return ExprError();
11246
11247 To = getDerived().RebuildPackExpansionType(To,
11248 PatternTL.getSourceRange(),
11249 ExpansionTL.getEllipsisLoc(),
11250 NumExpansions);
11251 if (To.isNull())
11252 return ExprError();
11253
11254 PackExpansionTypeLoc ToExpansionTL
11255 = TLB.push<PackExpansionTypeLoc>(To);
11256 ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
11257 Args.push_back(TLB.getTypeSourceInfo(SemaRef.Context, To));
11258 }
11259
11260 if (!getDerived().AlwaysRebuild() && !ArgChanged)
11261 return E;
11262
11263 return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
11264 E->getEndLoc());
11265 }
11266
11267 template<typename Derived>
11268 ExprResult
11269 TreeTransform<Derived>::TransformConceptSpecializationExpr(
11270 ConceptSpecializationExpr *E) {
11271 const ASTTemplateArgumentListInfo *Old = E->getTemplateArgsAsWritten();
11272 TemplateArgumentListInfo TransArgs(Old->LAngleLoc, Old->RAngleLoc);
11273 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
11274 Old->NumTemplateArgs, TransArgs))
11275 return ExprError();
11276
11277 return getDerived().RebuildConceptSpecializationExpr(
11278 E->getNestedNameSpecifierLoc(), E->getTemplateKWLoc(),
11279 E->getConceptNameInfo(), E->getFoundDecl(), E->getNamedConcept(),
11280 &TransArgs);
11281 }
11282
11283 template<typename Derived>
11284 ExprResult
11285 TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *E) {
11286 SmallVector<ParmVarDecl*, 4> TransParams;
11287 SmallVector<QualType, 4> TransParamTypes;
11288 Sema::ExtParameterInfoBuilder ExtParamInfos;
11289
11290 // C++2a [expr.prim.req]p2
11291 // Expressions appearing within a requirement-body are unevaluated operands.
11292 EnterExpressionEvaluationContext Ctx(
11293 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
11294
11295 RequiresExprBodyDecl *Body = RequiresExprBodyDecl::Create(
11296 getSema().Context, E->getBody()->getDeclContext(),
11297 E->getBody()->getBeginLoc());
11298
11299 Sema::ContextRAII SavedContext(getSema(), Body, /*NewThisContext*/false);
11300
11301 if (getDerived().TransformFunctionTypeParams(E->getRequiresKWLoc(),
11302 E->getLocalParameters(),
11303 /*ParamTypes=*/nullptr,
11304 /*ParamInfos=*/nullptr,
11305 TransParamTypes, &TransParams,
11306 ExtParamInfos))
11307 return ExprError();
11308
11309 for (ParmVarDecl *Param : TransParams)
11310 Param->setDeclContext(Body);
11311
11312 SmallVector<concepts::Requirement *, 4> TransReqs;
11313 if (getDerived().TransformRequiresExprRequirements(E->getRequirements(),
11314 TransReqs))
11315 return ExprError();
11316
11317 for (concepts::Requirement *Req : TransReqs) {
11318 if (auto *ER = dyn_cast<concepts::ExprRequirement>(Req)) {
11319 if (ER->getReturnTypeRequirement().isTypeConstraint()) {
11320 ER->getReturnTypeRequirement()
11321 .getTypeConstraintTemplateParameterList()->getParam(0)
11322 ->setDeclContext(Body);
11323 }
11324 }
11325 }
11326
11327 return getDerived().RebuildRequiresExpr(E->getRequiresKWLoc(), Body,
11328 TransParams, TransReqs,
11329 E->getRBraceLoc());
11330 }
11331
11332 template<typename Derived>
11333 bool TreeTransform<Derived>::TransformRequiresExprRequirements(
11334 ArrayRef<concepts::Requirement *> Reqs,
11335 SmallVectorImpl<concepts::Requirement *> &Transformed) {
11336 for (concepts::Requirement *Req : Reqs) {
11337 concepts::Requirement *TransReq = nullptr;
11338 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req))
11339 TransReq = getDerived().TransformTypeRequirement(TypeReq);
11340 else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req))
11341 TransReq = getDerived().TransformExprRequirement(ExprReq);
11342 else
11343 TransReq = getDerived().TransformNestedRequirement(
11344 cast<concepts::NestedRequirement>(Req));
11345 if (!TransReq)
11346 return true;
11347 Transformed.push_back(TransReq);
11348 }
11349 return false;
11350 }
11351
11352 template<typename Derived>
11353 concepts::TypeRequirement *
11354 TreeTransform<Derived>::TransformTypeRequirement(
11355 concepts::TypeRequirement *Req) {
11356 if (Req->isSubstitutionFailure()) {
11357 if (getDerived().AlwaysRebuild())
11358 return getDerived().RebuildTypeRequirement(
11359 Req->getSubstitutionDiagnostic());
11360 return Req;
11361 }
11362 TypeSourceInfo *TransType = getDerived().TransformType(Req->getType());
11363 if (!TransType)
11364 return nullptr;
11365 return getDerived().RebuildTypeRequirement(TransType);
11366 }
11367
11368 template<typename Derived>
11369 concepts::ExprRequirement *
11370 TreeTransform<Derived>::TransformExprRequirement(concepts::ExprRequirement *Req) {
11371 llvm::PointerUnion<Expr *, concepts::Requirement::SubstitutionDiagnostic *> TransExpr;
11372 if (Req->isExprSubstitutionFailure())
11373 TransExpr = Req->getExprSubstitutionDiagnostic();
11374 else {
11375 ExprResult TransExprRes = getDerived().TransformExpr(Req->getExpr());
11376 if (TransExprRes.isInvalid())
11377 return nullptr;
11378 TransExpr = TransExprRes.get();
11379 }
11380
11381 llvm::Optional<concepts::ExprRequirement::ReturnTypeRequirement> TransRetReq;
11382 const auto &RetReq = Req->getReturnTypeRequirement();
11383 if (RetReq.isEmpty())
11384 TransRetReq.emplace();
11385 else if (RetReq.isSubstitutionFailure())
11386 TransRetReq.emplace(RetReq.getSubstitutionDiagnostic());
11387 else if (RetReq.isTypeConstraint()) {
11388 TemplateParameterList *OrigTPL =
11389 RetReq.getTypeConstraintTemplateParameterList();
11390 TemplateParameterList *TPL =
11391 getDerived().TransformTemplateParameterList(OrigTPL);
11392 if (!TPL)
11393 return nullptr;
11394 TransRetReq.emplace(TPL);
11395 }
11396 assert(TransRetReq.hasValue() &&
11397 "All code paths leading here must set TransRetReq");
11398 if (Expr *E = TransExpr.dyn_cast<Expr *>())
11399 return getDerived().RebuildExprRequirement(E, Req->isSimple(),
11400 Req->getNoexceptLoc(),
11401 std::move(*TransRetReq));
11402 return getDerived().RebuildExprRequirement(
11403 TransExpr.get<concepts::Requirement::SubstitutionDiagnostic *>(),
11404 Req->isSimple(), Req->getNoexceptLoc(), std::move(*TransRetReq));
11405 }
11406
11407 template<typename Derived>
11408 concepts::NestedRequirement *
11409 TreeTransform<Derived>::TransformNestedRequirement(
11410 concepts::NestedRequirement *Req) {
11411 if (Req->isSubstitutionFailure()) {
11412 if (getDerived().AlwaysRebuild())
11413 return getDerived().RebuildNestedRequirement(
11414 Req->getSubstitutionDiagnostic());
11415 return Req;
11416 }
11417 ExprResult TransConstraint =
11418 getDerived().TransformExpr(Req->getConstraintExpr());
11419 if (TransConstraint.isInvalid())
11420 return nullptr;
11421 return getDerived().RebuildNestedRequirement(TransConstraint.get());
11422 }
11423
11424 template<typename Derived>
11425 ExprResult
11426 TreeTransform<Derived>::TransformArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
11427 TypeSourceInfo *T = getDerived().TransformType(E->getQueriedTypeSourceInfo());
11428 if (!T)
11429 return ExprError();
11430
11431 if (!getDerived().AlwaysRebuild() &&
11432 T == E->getQueriedTypeSourceInfo())
11433 return E;
11434
11435 ExprResult SubExpr;
11436 {
11437 EnterExpressionEvaluationContext Unevaluated(
11438 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
11439 SubExpr = getDerived().TransformExpr(E->getDimensionExpression());
11440 if (SubExpr.isInvalid())
11441 return ExprError();
11442
11443 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getDimensionExpression())
11444 return E;
11445 }
11446
11447 return getDerived().RebuildArrayTypeTrait(E->getTrait(), E->getBeginLoc(), T,
11448 SubExpr.get(), E->getEndLoc());
11449 }
11450
11451 template<typename Derived>
11452 ExprResult
11453 TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *E) {
11454 ExprResult SubExpr;
11455 {
11456 EnterExpressionEvaluationContext Unevaluated(
11457 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
11458 SubExpr = getDerived().TransformExpr(E->getQueriedExpression());
11459 if (SubExpr.isInvalid())
11460 return ExprError();
11461
11462 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
11463 return E;
11464 }
11465
11466 return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
11467 SubExpr.get(), E->getEndLoc());
11468 }
11469
11470 template <typename Derived>
11471 ExprResult TreeTransform<Derived>::TransformParenDependentScopeDeclRefExpr(
11472 ParenExpr *PE, DependentScopeDeclRefExpr *DRE, bool AddrTaken,
11473 TypeSourceInfo **RecoveryTSI) {
11474 ExprResult NewDRE = getDerived().TransformDependentScopeDeclRefExpr(
11475 DRE, AddrTaken, RecoveryTSI);
11476
11477 // Propagate both errors and recovered types, which return ExprEmpty.
11478 if (!NewDRE.isUsable())
11479 return NewDRE;
11480
11481 // We got an expr, wrap it up in parens.
11482 if (!getDerived().AlwaysRebuild() && NewDRE.get() == DRE)
11483 return PE;
11484 return getDerived().RebuildParenExpr(NewDRE.get(), PE->getLParen(),
11485 PE->getRParen());
11486 }
11487
11488 template <typename Derived>
11489 ExprResult TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
11490 DependentScopeDeclRefExpr *E) {
11491 return TransformDependentScopeDeclRefExpr(E, /*IsAddressOfOperand=*/false,
11492 nullptr);
11493 }
11494
11495 template<typename Derived>
11496 ExprResult
11497 TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
11498 DependentScopeDeclRefExpr *E,
11499 bool IsAddressOfOperand,
11500 TypeSourceInfo **RecoveryTSI) {
11501 assert(E->getQualifierLoc());
11502 NestedNameSpecifierLoc QualifierLoc
11503 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
11504 if (!QualifierLoc)
11505 return ExprError();
11506 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
11507
11508 // TODO: If this is a conversion-function-id, verify that the
11509 // destination type name (if present) resolves the same way after
11510 // instantiation as it did in the local scope.
11511
11512 DeclarationNameInfo NameInfo
11513 = getDerived().TransformDeclarationNameInfo(E->getNameInfo());
11514 if (!NameInfo.getName())
11515 return ExprError();
11516
11517 if (!E->hasExplicitTemplateArgs()) {
11518 if (!getDerived().AlwaysRebuild() &&
11519 QualifierLoc == E->getQualifierLoc() &&
11520 // Note: it is sufficient to compare the Name component of NameInfo:
11521 // if name has not changed, DNLoc has not changed either.
11522 NameInfo.getName() == E->getDeclName())
11523 return E;
11524
11525 return getDerived().RebuildDependentScopeDeclRefExpr(
11526 QualifierLoc, TemplateKWLoc, NameInfo, /*TemplateArgs=*/nullptr,
11527 IsAddressOfOperand, RecoveryTSI);
11528 }
11529
11530 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
11531 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
11532 E->getNumTemplateArgs(),
11533 TransArgs))
11534 return ExprError();
11535
11536 return getDerived().RebuildDependentScopeDeclRefExpr(
11537 QualifierLoc, TemplateKWLoc, NameInfo, &TransArgs, IsAddressOfOperand,
11538 RecoveryTSI);
11539 }
11540
11541 template<typename Derived>
11542 ExprResult
11543 TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
11544 // CXXConstructExprs other than for list-initialization and
11545 // CXXTemporaryObjectExpr are always implicit, so when we have
11546 // a 1-argument construction we just transform that argument.
11547 if ((E->getNumArgs() == 1 ||
11548 (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) &&
11549 (!getDerived().DropCallArgument(E->getArg(0))) &&
11550 !E->isListInitialization())
11551 return getDerived().TransformExpr(E->getArg(0));
11552
11553 TemporaryBase Rebase(*this, /*FIXME*/ E->getBeginLoc(), DeclarationName());
11554
11555 QualType T = getDerived().TransformType(E->getType());
11556 if (T.isNull())
11557 return ExprError();
11558
11559 CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
11560 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
11561 if (!Constructor)
11562 return ExprError();
11563
11564 bool ArgumentChanged = false;
11565 SmallVector<Expr*, 8> Args;
11566 {
11567 EnterExpressionEvaluationContext Context(
11568 getSema(), EnterExpressionEvaluationContext::InitList,
11569 E->isListInitialization());
11570 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
11571 &ArgumentChanged))
11572 return ExprError();
11573 }
11574
11575 if (!getDerived().AlwaysRebuild() &&
11576 T == E->getType() &&
11577 Constructor == E->getConstructor() &&
11578 !ArgumentChanged) {
11579 // Mark the constructor as referenced.
11580 // FIXME: Instantiation-specific
11581 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
11582 return E;
11583 }
11584
11585 return getDerived().RebuildCXXConstructExpr(
11586 T, /*FIXME:*/ E->getBeginLoc(), Constructor, E->isElidable(), Args,
11587 E->hadMultipleCandidates(), E->isListInitialization(),
11588 E->isStdInitListInitialization(), E->requiresZeroInitialization(),
11589 E->getConstructionKind(), E->getParenOrBraceRange());
11590 }
11591
11592 template<typename Derived>
11593 ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
11594 CXXInheritedCtorInitExpr *E) {
11595 QualType T = getDerived().TransformType(E->getType());
11596 if (T.isNull())
11597 return ExprError();
11598
11599 CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
11600 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
11601 if (!Constructor)
11602 return ExprError();
11603
11604 if (!getDerived().AlwaysRebuild() &&
11605 T == E->getType() &&
11606 Constructor == E->getConstructor()) {
11607 // Mark the constructor as referenced.
11608 // FIXME: Instantiation-specific
11609 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
11610 return E;
11611 }
11612
11613 return getDerived().RebuildCXXInheritedCtorInitExpr(
11614 T, E->getLocation(), Constructor,
11615 E->constructsVBase(), E->inheritedFromVBase());
11616 }
11617
11618 /// Transform a C++ temporary-binding expression.
11619 ///
11620 /// Since CXXBindTemporaryExpr nodes are implicitly generated, we just
11621 /// transform the subexpression and return that.
11622 template<typename Derived>
11623 ExprResult
11624 TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
11625 return getDerived().TransformExpr(E->getSubExpr());
11626 }
11627
11628 /// Transform a C++ expression that contains cleanups that should
11629 /// be run after the expression is evaluated.
11630 ///
11631 /// Since ExprWithCleanups nodes are implicitly generated, we
11632 /// just transform the subexpression and return that.
11633 template<typename Derived>
11634 ExprResult
11635 TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *E) {
11636 return getDerived().TransformExpr(E->getSubExpr());
11637 }
11638
11639 template<typename Derived>
11640 ExprResult
11641 TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
11642 CXXTemporaryObjectExpr *E) {
11643 TypeSourceInfo *T =
11644 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
11645 if (!T)
11646 return ExprError();
11647
11648 CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
11649 getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
11650 if (!Constructor)
11651 return ExprError();
11652
11653 bool ArgumentChanged = false;
11654 SmallVector<Expr*, 8> Args;
11655 Args.reserve(E->getNumArgs());
11656 {
11657 EnterExpressionEvaluationContext Context(
11658 getSema(), EnterExpressionEvaluationContext::InitList,
11659 E->isListInitialization());
11660 if (TransformExprs(E->getArgs(), E->getNumArgs(), true, Args,
11661 &ArgumentChanged))
11662 return ExprError();
11663 }
11664
11665 if (!getDerived().AlwaysRebuild() &&
11666 T == E->getTypeSourceInfo() &&
11667 Constructor == E->getConstructor() &&
11668 !ArgumentChanged) {
11669 // FIXME: Instantiation-specific
11670 SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
11671 return SemaRef.MaybeBindToTemporary(E);
11672 }
11673
11674 // FIXME: We should just pass E->isListInitialization(), but we're not
11675 // prepared to handle list-initialization without a child InitListExpr.
11676 SourceLocation LParenLoc = T->getTypeLoc().getEndLoc();
11677 return getDerived().RebuildCXXTemporaryObjectExpr(
11678 T, LParenLoc, Args, E->getEndLoc(),
11679 /*ListInitialization=*/LParenLoc.isInvalid());
11680 }
11681
11682 template<typename Derived>
11683 ExprResult
11684 TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
11685 // Transform any init-capture expressions before entering the scope of the
11686 // lambda body, because they are not semantically within that scope.
11687 typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
11688 struct TransformedInitCapture {
11689 // The location of the ... if the result is retaining a pack expansion.
11690 SourceLocation EllipsisLoc;
11691 // Zero or more expansions of the init-capture.
11692 SmallVector<InitCaptureInfoTy, 4> Expansions;
11693 };
11694 SmallVector<TransformedInitCapture, 4> InitCaptures;
11695 InitCaptures.resize(E->explicit_capture_end() - E->explicit_capture_begin());
11696 for (LambdaExpr::capture_iterator C = E->capture_begin(),
11697 CEnd = E->capture_end();
11698 C != CEnd; ++C) {
11699 if (!E->isInitCapture(C))
11700 continue;
11701
11702 TransformedInitCapture &Result = InitCaptures[C - E->capture_begin()];
11703 VarDecl *OldVD = C->getCapturedVar();
11704
11705 auto SubstInitCapture = [&](SourceLocation EllipsisLoc,
11706 Optional<unsigned> NumExpansions) {
11707 ExprResult NewExprInitResult = getDerived().TransformInitializer(
11708 OldVD->getInit(), OldVD->getInitStyle() == VarDecl::CallInit);
11709
11710 if (NewExprInitResult.isInvalid()) {
11711 Result.Expansions.push_back(InitCaptureInfoTy(ExprError(), QualType()));
11712 return;
11713 }
11714 Expr *NewExprInit = NewExprInitResult.get();
11715
11716 QualType NewInitCaptureType =
11717 getSema().buildLambdaInitCaptureInitialization(
11718 C->getLocation(), OldVD->getType()->isReferenceType(),
11719 EllipsisLoc, NumExpansions, OldVD->getIdentifier(),
11720 C->getCapturedVar()->getInitStyle() != VarDecl::CInit,
11721 NewExprInit);
11722 Result.Expansions.push_back(
11723 InitCaptureInfoTy(NewExprInit, NewInitCaptureType));
11724 };
11725
11726 // If this is an init-capture pack, consider expanding the pack now.
11727 if (OldVD->isParameterPack()) {
11728 PackExpansionTypeLoc ExpansionTL = OldVD->getTypeSourceInfo()
11729 ->getTypeLoc()
11730 .castAs<PackExpansionTypeLoc>();
11731 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
11732 SemaRef.collectUnexpandedParameterPacks(OldVD->getInit(), Unexpanded);
11733
11734 // Determine whether the set of unexpanded parameter packs can and should
11735 // be expanded.
11736 bool Expand = true;
11737 bool RetainExpansion = false;
11738 Optional<unsigned> OrigNumExpansions =
11739 ExpansionTL.getTypePtr()->getNumExpansions();
11740 Optional<unsigned> NumExpansions = OrigNumExpansions;
11741 if (getDerived().TryExpandParameterPacks(
11742 ExpansionTL.getEllipsisLoc(),
11743 OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
11744 RetainExpansion, NumExpansions))
11745 return ExprError();
11746 if (Expand) {
11747 for (unsigned I = 0; I != *NumExpansions; ++I) {
11748 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
11749 SubstInitCapture(SourceLocation(), None);
11750 }
11751 }
11752 if (!Expand || RetainExpansion) {
11753 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
11754 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
11755 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
11756 }
11757 } else {
11758 SubstInitCapture(SourceLocation(), None);
11759 }
11760 }
11761
11762 LambdaScopeInfo *LSI = getSema().PushLambdaScope();
11763 Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
11764
11765 // Transform the template parameters, and add them to the current
11766 // instantiation scope. The null case is handled correctly.
11767 auto TPL = getDerived().TransformTemplateParameterList(
11768 E->getTemplateParameterList());
11769 LSI->GLTemplateParameterList = TPL;
11770
11771 // Transform the type of the original lambda's call operator.
11772 // The transformation MUST be done in the CurrentInstantiationScope since
11773 // it introduces a mapping of the original to the newly created
11774 // transformed parameters.
11775 TypeSourceInfo *NewCallOpTSI = nullptr;
11776 {
11777 TypeSourceInfo *OldCallOpTSI = E->getCallOperator()->getTypeSourceInfo();
11778 FunctionProtoTypeLoc OldCallOpFPTL =
11779 OldCallOpTSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
11780
11781 TypeLocBuilder NewCallOpTLBuilder;
11782 SmallVector<QualType, 4> ExceptionStorage;
11783 TreeTransform *This = this; // Work around gcc.gnu.org/PR56135.
11784 QualType NewCallOpType = TransformFunctionProtoType(
11785 NewCallOpTLBuilder, OldCallOpFPTL, nullptr, Qualifiers(),
11786 [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool &Changed) {
11787 return This->TransformExceptionSpec(OldCallOpFPTL.getBeginLoc(), ESI,
11788 ExceptionStorage, Changed);
11789 });
11790 if (NewCallOpType.isNull())
11791 return ExprError();
11792 NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,
11793 NewCallOpType);
11794 }
11795
11796 // Transform the trailing requires clause
11797 ExprResult NewTrailingRequiresClause;
11798 if (Expr *TRC = E->getCallOperator()->getTrailingRequiresClause())
11799 // FIXME: Concepts: Substitution into requires clause should only happen
11800 // when checking satisfaction.
11801 NewTrailingRequiresClause = getDerived().TransformExpr(TRC);
11802
11803 // Create the local class that will describe the lambda.
11804 CXXRecordDecl *OldClass = E->getLambdaClass();
11805 CXXRecordDecl *Class
11806 = getSema().createLambdaClosureType(E->getIntroducerRange(),
11807 NewCallOpTSI,
11808 /*KnownDependent=*/false,
11809 E->getCaptureDefault());
11810 getDerived().transformedLocalDecl(OldClass, {Class});
11811
11812 Optional<std::tuple<unsigned, bool, Decl *>> Mangling;
11813 if (getDerived().ReplacingOriginal())
11814 Mangling = std::make_tuple(OldClass->getLambdaManglingNumber(),
11815 OldClass->hasKnownLambdaInternalLinkage(),
11816 OldClass->getLambdaContextDecl());
11817
11818 // Build the call operator.
11819 CXXMethodDecl *NewCallOperator = getSema().startLambdaDefinition(
11820 Class, E->getIntroducerRange(), NewCallOpTSI,
11821 E->getCallOperator()->getEndLoc(),
11822 NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>().getParams(),
11823 E->getCallOperator()->getConstexprKind(),
11824 NewTrailingRequiresClause.get());
11825
11826 LSI->CallOperator = NewCallOperator;
11827
11828 for (unsigned I = 0, NumParams = NewCallOperator->getNumParams();
11829 I != NumParams; ++I) {
11830 auto *P = NewCallOperator->getParamDecl(I);
11831 if (P->hasUninstantiatedDefaultArg()) {
11832 EnterExpressionEvaluationContext Eval(
11833 getSema(),
11834 Sema::ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed, P);
11835 ExprResult R = getDerived().TransformExpr(
11836 E->getCallOperator()->getParamDecl(I)->getDefaultArg());
11837 P->setDefaultArg(R.get());
11838 }
11839 }
11840
11841 getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
11842 getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator});
11843
11844 // Number the lambda for linkage purposes if necessary.
11845 getSema().handleLambdaNumbering(Class, NewCallOperator, Mangling);
11846
11847 // Introduce the context of the call operator.
11848 Sema::ContextRAII SavedContext(getSema(), NewCallOperator,
11849 /*NewThisContext*/false);
11850
11851 // Enter the scope of the lambda.
11852 getSema().buildLambdaScope(LSI, NewCallOperator,
11853 E->getIntroducerRange(),
11854 E->getCaptureDefault(),
11855 E->getCaptureDefaultLoc(),
11856 E->hasExplicitParameters(),
11857 E->hasExplicitResultType(),
11858 E->isMutable());
11859
11860 bool Invalid = false;
11861
11862 // Transform captures.
11863 for (LambdaExpr::capture_iterator C = E->capture_begin(),
11864 CEnd = E->capture_end();
11865 C != CEnd; ++C) {
11866 // When we hit the first implicit capture, tell Sema that we've finished
11867 // the list of explicit captures.
11868 if (C->isImplicit())
11869 break;
11870
11871 // Capturing 'this' is trivial.
11872 if (C->capturesThis()) {
11873 getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(),
11874 /*BuildAndDiagnose*/ true, nullptr,
11875 C->getCaptureKind() == LCK_StarThis);
11876 continue;
11877 }
11878 // Captured expression will be recaptured during captured variables
11879 // rebuilding.
11880 if (C->capturesVLAType())
11881 continue;
11882
11883 // Rebuild init-captures, including the implied field declaration.
11884 if (E->isInitCapture(C)) {
11885 TransformedInitCapture &NewC = InitCaptures[C - E->capture_begin()];
11886
11887 VarDecl *OldVD = C->getCapturedVar();
11888 llvm::SmallVector<Decl*, 4> NewVDs;
11889
11890 for (InitCaptureInfoTy &Info : NewC.Expansions) {
11891 ExprResult Init = Info.first;
11892 QualType InitQualType = Info.second;
11893 if (Init.isInvalid() || InitQualType.isNull()) {
11894 Invalid = true;
11895 break;
11896 }
11897 VarDecl *NewVD = getSema().createLambdaInitCaptureVarDecl(
11898 OldVD->getLocation(), InitQualType, NewC.EllipsisLoc,
11899 OldVD->getIdentifier(), OldVD->getInitStyle(), Init.get());
11900 if (!NewVD) {
11901 Invalid = true;
11902 break;
11903 }
11904 NewVDs.push_back(NewVD);
11905 getSema().addInitCapture(LSI, NewVD);
11906 }
11907
11908 if (Invalid)
11909 break;
11910
11911 getDerived().transformedLocalDecl(OldVD, NewVDs);
11912 continue;
11913 }
11914
11915 assert(C->capturesVariable() && "unexpected kind of lambda capture");
11916
11917 // Determine the capture kind for Sema.
11918 Sema::TryCaptureKind Kind
11919 = C->isImplicit()? Sema::TryCapture_Implicit
11920 : C->getCaptureKind() == LCK_ByCopy
11921 ? Sema::TryCapture_ExplicitByVal
11922 : Sema::TryCapture_ExplicitByRef;
11923 SourceLocation EllipsisLoc;
11924 if (C->isPackExpansion()) {
11925 UnexpandedParameterPack Unexpanded(C->getCapturedVar(), C->getLocation());
11926 bool ShouldExpand = false;
11927 bool RetainExpansion = false;
11928 Optional<unsigned> NumExpansions;
11929 if (getDerived().TryExpandParameterPacks(C->getEllipsisLoc(),
11930 C->getLocation(),
11931 Unexpanded,
11932 ShouldExpand, RetainExpansion,
11933 NumExpansions)) {
11934 Invalid = true;
11935 continue;
11936 }
11937
11938 if (ShouldExpand) {
11939 // The transform has determined that we should perform an expansion;
11940 // transform and capture each of the arguments.
11941 // expansion of the pattern. Do so.
11942 VarDecl *Pack = C->getCapturedVar();
11943 for (unsigned I = 0; I != *NumExpansions; ++I) {
11944 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
11945 VarDecl *CapturedVar
11946 = cast_or_null<VarDecl>(getDerived().TransformDecl(C->getLocation(),
11947 Pack));
11948 if (!CapturedVar) {
11949 Invalid = true;
11950 continue;
11951 }
11952
11953 // Capture the transformed variable.
11954 getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind);
11955 }
11956
11957 // FIXME: Retain a pack expansion if RetainExpansion is true.
11958
11959 continue;
11960 }
11961
11962 EllipsisLoc = C->getEllipsisLoc();
11963 }
11964
11965 // Transform the captured variable.
11966 VarDecl *CapturedVar
11967 = cast_or_null<VarDecl>(getDerived().TransformDecl(C->getLocation(),
11968 C->getCapturedVar()));
11969 if (!CapturedVar || CapturedVar->isInvalidDecl()) {
11970 Invalid = true;
11971 continue;
11972 }
11973
11974 // Capture the transformed variable.
11975 getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind,
11976 EllipsisLoc);
11977 }
11978 getSema().finishLambdaExplicitCaptures(LSI);
11979
11980 // FIXME: Sema's lambda-building mechanism expects us to push an expression
11981 // evaluation context even if we're not transforming the function body.
11982 getSema().PushExpressionEvaluationContext(
11983 Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
11984
11985 // Instantiate the body of the lambda expression.
11986 StmtResult Body =
11987 Invalid ? StmtError() : getDerived().TransformLambdaBody(E, E->getBody());
11988
11989 // ActOnLambda* will pop the function scope for us.
11990 FuncScopeCleanup.disable();
11991
11992 if (Body.isInvalid()) {
11993 SavedContext.pop();
11994 getSema().ActOnLambdaError(E->getBeginLoc(), /*CurScope=*/nullptr,
11995 /*IsInstantiation=*/true);
11996 return ExprError();
11997 }
11998
11999 // Copy the LSI before ActOnFinishFunctionBody removes it.
12000 // FIXME: This is dumb. Store the lambda information somewhere that outlives
12001 // the call operator.
12002 auto LSICopy = *LSI;
12003 getSema().ActOnFinishFunctionBody(NewCallOperator, Body.get(),
12004 /*IsInstantiation*/ true);
12005 SavedContext.pop();
12006
12007 return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getEndLoc(),
12008 &LSICopy);
12009 }
12010
12011 template<typename Derived>
12012 StmtResult
12013 TreeTransform<Derived>::TransformLambdaBody(LambdaExpr *E, Stmt *S) {
12014 return TransformStmt(S);
12015 }
12016
12017 template<typename Derived>
12018 StmtResult
12019 TreeTransform<Derived>::SkipLambdaBody(LambdaExpr *E, Stmt *S) {
12020 // Transform captures.
12021 for (LambdaExpr::capture_iterator C = E->capture_begin(),
12022 CEnd = E->capture_end();
12023 C != CEnd; ++C) {
12024 // When we hit the first implicit capture, tell Sema that we've finished
12025 // the list of explicit captures.
12026 if (!C->isImplicit())
12027 continue;
12028
12029 // Capturing 'this' is trivial.
12030 if (C->capturesThis()) {
12031 getSema().CheckCXXThisCapture(C->getLocation(), C->isExplicit(),
12032 /*BuildAndDiagnose*/ true, nullptr,
12033 C->getCaptureKind() == LCK_StarThis);
12034 continue;
12035 }
12036 // Captured expression will be recaptured during captured variables
12037 // rebuilding.
12038 if (C->capturesVLAType())
12039 continue;
12040
12041 assert(C->capturesVariable() && "unexpected kind of lambda capture");
12042 assert(!E->isInitCapture(C) && "implicit init-capture?");
12043
12044 // Transform the captured variable.
12045 VarDecl *CapturedVar = cast_or_null<VarDecl>(
12046 getDerived().TransformDecl(C->getLocation(), C->getCapturedVar()));
12047 if (!CapturedVar || CapturedVar->isInvalidDecl())
12048 return StmtError();
12049
12050 // Capture the transformed variable.
12051 getSema().tryCaptureVariable(CapturedVar, C->getLocation());
12052 }
12053
12054 return S;
12055 }
12056
12057 template<typename Derived>
12058 ExprResult
12059 TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr(
12060 CXXUnresolvedConstructExpr *E) {
12061 TypeSourceInfo *T =
12062 getDerived().TransformTypeWithDeducedTST(E->getTypeSourceInfo());
12063 if (!T)
12064 return ExprError();
12065
12066 bool ArgumentChanged = false;
12067 SmallVector<Expr*, 8> Args;
12068 Args.reserve(E->arg_size());
12069 {
12070 EnterExpressionEvaluationContext Context(
12071 getSema(), EnterExpressionEvaluationContext::InitList,
12072 E->isListInitialization());
12073 if (getDerived().TransformExprs(E->arg_begin(), E->arg_size(), true, Args,
12074 &ArgumentChanged))
12075 return ExprError();
12076 }
12077
12078 if (!getDerived().AlwaysRebuild() &&
12079 T == E->getTypeSourceInfo() &&
12080 !ArgumentChanged)
12081 return E;
12082
12083 // FIXME: we're faking the locations of the commas
12084 return getDerived().RebuildCXXUnresolvedConstructExpr(
12085 T, E->getLParenLoc(), Args, E->getRParenLoc(), E->isListInitialization());
12086 }
12087
12088 template<typename Derived>
12089 ExprResult
12090 TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
12091 CXXDependentScopeMemberExpr *E) {
12092 // Transform the base of the expression.
12093 ExprResult Base((Expr*) nullptr);
12094 Expr *OldBase;
12095 QualType BaseType;
12096 QualType ObjectType;
12097 if (!E->isImplicitAccess()) {
12098 OldBase = E->getBase();
12099 Base = getDerived().TransformExpr(OldBase);
12100 if (Base.isInvalid())
12101 return ExprError();
12102
12103 // Start the member reference and compute the object's type.
12104 ParsedType ObjectTy;
12105 bool MayBePseudoDestructor = false;
12106 Base = SemaRef.ActOnStartCXXMemberReference(nullptr, Base.get(),
12107 E->getOperatorLoc(),
12108 E->isArrow()? tok::arrow : tok::period,
12109 ObjectTy,
12110 MayBePseudoDestructor);
12111 if (Base.isInvalid())
12112 return ExprError();
12113
12114 ObjectType = ObjectTy.get();
12115 BaseType = ((Expr*) Base.get())->getType();
12116 } else {
12117 OldBase = nullptr;
12118 BaseType = getDerived().TransformType(E->getBaseType());
12119 ObjectType = BaseType->castAs<PointerType>()->getPointeeType();
12120 }
12121
12122 // Transform the first part of the nested-name-specifier that qualifies
12123 // the member name.
12124 NamedDecl *FirstQualifierInScope
12125 = getDerived().TransformFirstQualifierInScope(
12126 E->getFirstQualifierFoundInScope(),
12127 E->getQualifierLoc().getBeginLoc());
12128
12129 NestedNameSpecifierLoc QualifierLoc;
12130 if (E->getQualifier()) {
12131 QualifierLoc
12132 = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc(),
12133 ObjectType,
12134 FirstQualifierInScope);
12135 if (!QualifierLoc)
12136 return ExprError();
12137 }
12138
12139 SourceLocation TemplateKWLoc = E->getTemplateKeywordLoc();
12140
12141 // TODO: If this is a conversion-function-id, verify that the
12142 // destination type name (if present) resolves the same way after
12143 // instantiation as it did in the local scope.
12144
12145 DeclarationNameInfo NameInfo
12146 = getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
12147 if (!NameInfo.getName())
12148 return ExprError();
12149
12150 if (!E->hasExplicitTemplateArgs()) {
12151 // This is a reference to a member without an explicitly-specified
12152 // template argument list. Optimize for this common case.
12153 if (!getDerived().AlwaysRebuild() &&
12154 Base.get() == OldBase &&
12155 BaseType == E->getBaseType() &&
12156 QualifierLoc == E->getQualifierLoc() &&
12157 NameInfo.getName() == E->getMember() &&
12158 FirstQualifierInScope == E->getFirstQualifierFoundInScope())
12159 return E;
12160
12161 return getDerived().RebuildCXXDependentScopeMemberExpr(Base.get(),
12162 BaseType,
12163 E->isArrow(),
12164 E->getOperatorLoc(),
12165 QualifierLoc,
12166 TemplateKWLoc,
12167 FirstQualifierInScope,
12168 NameInfo,
12169 /*TemplateArgs*/nullptr);
12170 }
12171
12172 TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
12173 if (getDerived().TransformTemplateArguments(E->getTemplateArgs(),
12174 E->getNumTemplateArgs(),
12175 TransArgs))
12176 return ExprError();
12177
12178 return getDerived().RebuildCXXDependentScopeMemberExpr(Base.get(),
12179 BaseType,
12180 E->isArrow(),
12181 E->getOperatorLoc(),
12182 QualifierLoc,
12183 TemplateKWLoc,
12184 FirstQualifierInScope,
12185 NameInfo,
12186 &TransArgs);
12187 }
12188
12189 template<typename Derived>
12190 ExprResult
12191 TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) {
12192 // Transform the base of the expression.
12193 ExprResult Base((Expr*) nullptr);
12194 QualType BaseType;
12195 if (!Old->isImplicitAccess()) {
12196 Base = getDerived().TransformExpr(Old->getBase());
12197 if (Base.isInvalid())
12198 return ExprError();
12199 Base = getSema().PerformMemberExprBaseConversion(Base.get(),
12200 Old->isArrow());
12201 if (Base.isInvalid())
12202 return ExprError();
12203 BaseType = Base.get()->getType();
12204 } else {
12205 BaseType = getDerived().TransformType(Old->getBaseType());
12206 }
12207
12208 NestedNameSpecifierLoc QualifierLoc;
12209 if (Old->getQualifierLoc()) {
12210 QualifierLoc
12211 = getDerived().TransformNestedNameSpecifierLoc(Old->getQualifierLoc());
12212 if (!QualifierLoc)
12213 return ExprError();
12214 }
12215
12216 SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
12217
12218 LookupResult R(SemaRef, Old->getMemberNameInfo(),
12219 Sema::LookupOrdinaryName);
12220
12221 // Transform the declaration set.
12222 if (TransformOverloadExprDecls(Old, /*RequiresADL*/false, R))
12223 return ExprError();
12224
12225 // Determine the naming class.
12226 if (Old->getNamingClass()) {
12227 CXXRecordDecl *NamingClass
12228 = cast_or_null<CXXRecordDecl>(getDerived().TransformDecl(
12229 Old->getMemberLoc(),
12230 Old->getNamingClass()));
12231 if (!NamingClass)
12232 return ExprError();
12233
12234 R.setNamingClass(NamingClass);
12235 }
12236
12237 TemplateArgumentListInfo TransArgs;
12238 if (Old->hasExplicitTemplateArgs()) {
12239 TransArgs.setLAngleLoc(Old->getLAngleLoc());
12240 TransArgs.setRAngleLoc(Old->getRAngleLoc());
12241 if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
12242 Old->getNumTemplateArgs(),
12243 TransArgs))
12244 return ExprError();
12245 }
12246
12247 // FIXME: to do this check properly, we will need to preserve the
12248 // first-qualifier-in-scope here, just in case we had a dependent
12249 // base (and therefore couldn't do the check) and a
12250 // nested-name-qualifier (and therefore could do the lookup).
12251 NamedDecl *FirstQualifierInScope = nullptr;
12252
12253 return getDerived().RebuildUnresolvedMemberExpr(Base.get(),
12254 BaseType,
12255 Old->getOperatorLoc(),
12256 Old->isArrow(),
12257 QualifierLoc,
12258 TemplateKWLoc,
12259 FirstQualifierInScope,
12260 R,
12261 (Old->hasExplicitTemplateArgs()
12262 ? &TransArgs : nullptr));
12263 }
12264
12265 template<typename Derived>
12266 ExprResult
12267 TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) {
12268 EnterExpressionEvaluationContext Unevaluated(
12269 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
12270 ExprResult SubExpr = getDerived().TransformExpr(E->getOperand());
12271 if (SubExpr.isInvalid())
12272 return ExprError();
12273
12274 if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
12275 return E;
12276
12277 return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
12278 }
12279
12280 template<typename Derived>
12281 ExprResult
12282 TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *E) {
12283 ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
12284 if (Pattern.isInvalid())
12285 return ExprError();
12286
12287 if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
12288 return E;
12289
12290 return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
12291 E->getNumExpansions());
12292 }
12293
12294 template<typename Derived>
12295 ExprResult
12296 TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
12297 // If E is not value-dependent, then nothing will change when we transform it.
12298 // Note: This is an instantiation-centric view.
12299 if (!E->isValueDependent())
12300 return E;
12301
12302 EnterExpressionEvaluationContext Unevaluated(
12303 getSema(), Sema::ExpressionEvaluationContext::Unevaluated);
12304
12305 ArrayRef<TemplateArgument> PackArgs;
12306 TemplateArgument ArgStorage;
12307
12308 // Find the argument list to transform.
12309 if (E->isPartiallySubstituted()) {
12310 PackArgs = E->getPartialArguments();
12311 } else if (E->isValueDependent()) {
12312 UnexpandedParameterPack Unexpanded(E->getPack(), E->getPackLoc());
12313 bool ShouldExpand = false;
12314 bool RetainExpansion = false;
12315 Optional<unsigned> NumExpansions;
12316 if (getDerived().TryExpandParameterPacks(E->getOperatorLoc(), E->getPackLoc(),
12317 Unexpanded,
12318 ShouldExpand, RetainExpansion,
12319 NumExpansions))
12320 return ExprError();
12321
12322 // If we need to expand the pack, build a template argument from it and
12323 // expand that.
12324 if (ShouldExpand) {
12325 auto *Pack = E->getPack();
12326 if (auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Pack)) {
12327 ArgStorage = getSema().Context.getPackExpansionType(
12328 getSema().Context.getTypeDeclType(TTPD), None);
12329 } else if (auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Pack)) {
12330 ArgStorage = TemplateArgument(TemplateName(TTPD), None);
12331 } else {
12332 auto *VD = cast<ValueDecl>(Pack);
12333 ExprResult DRE = getSema().BuildDeclRefExpr(
12334 VD, VD->getType().getNonLValueExprType(getSema().Context),
12335 VD->getType()->isReferenceType() ? VK_LValue : VK_RValue,
12336 E->getPackLoc());
12337 if (DRE.isInvalid())
12338 return ExprError();
12339 ArgStorage = new (getSema().Context) PackExpansionExpr(
12340 getSema().Context.DependentTy, DRE.get(), E->getPackLoc(), None);
12341 }
12342 PackArgs = ArgStorage;
12343 }
12344 }
12345
12346 // If we're not expanding the pack, just transform the decl.
12347 if (!PackArgs.size()) {
12348 auto *Pack = cast_or_null<NamedDecl>(
12349 getDerived().TransformDecl(E->getPackLoc(), E->getPack()));
12350 if (!Pack)
12351 return ExprError();
12352 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), Pack,
12353 E->getPackLoc(),
12354 E->getRParenLoc(), None, None);
12355 }
12356
12357 // Try to compute the result without performing a partial substitution.
12358 Optional<unsigned> Result = 0;
12359 for (const TemplateArgument &Arg : PackArgs) {
12360 if (!Arg.isPackExpansion()) {
12361 Result = *Result + 1;
12362 continue;
12363 }
12364
12365 TemplateArgumentLoc ArgLoc;
12366 InventTemplateArgumentLoc(Arg, ArgLoc);
12367
12368 // Find the pattern of the pack expansion.
12369 SourceLocation Ellipsis;
12370 Optional<unsigned> OrigNumExpansions;
12371 TemplateArgumentLoc Pattern =
12372 getSema().getTemplateArgumentPackExpansionPattern(ArgLoc, Ellipsis,
12373 OrigNumExpansions);
12374
12375 // Substitute under the pack expansion. Do not expand the pack (yet).
12376 TemplateArgumentLoc OutPattern;
12377 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
12378 if (getDerived().TransformTemplateArgument(Pattern, OutPattern,
12379 /*Uneval*/ true))
12380 return true;
12381
12382 // See if we can determine the number of arguments from the result.
12383 Optional<unsigned> NumExpansions =
12384 getSema().getFullyPackExpandedSize(OutPattern.getArgument());
12385 if (!NumExpansions) {
12386 // No: we must be in an alias template expansion, and we're going to need
12387 // to actually expand the packs.
12388 Result = None;
12389 break;
12390 }
12391
12392 Result = *Result + *NumExpansions;
12393 }
12394
12395 // Common case: we could determine the number of expansions without
12396 // substituting.
12397 if (Result)
12398 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
12399 E->getPackLoc(),
12400 E->getRParenLoc(), *Result, None);
12401
12402 TemplateArgumentListInfo TransformedPackArgs(E->getPackLoc(),
12403 E->getPackLoc());
12404 {
12405 TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity());
12406 typedef TemplateArgumentLocInventIterator<
12407 Derived, const TemplateArgument*> PackLocIterator;
12408 if (TransformTemplateArguments(PackLocIterator(*this, PackArgs.begin()),
12409 PackLocIterator(*this, PackArgs.end()),
12410 TransformedPackArgs, /*Uneval*/true))
12411 return ExprError();
12412 }
12413
12414 // Check whether we managed to fully-expand the pack.
12415 // FIXME: Is it possible for us to do so and not hit the early exit path?
12416 SmallVector<TemplateArgument, 8> Args;
12417 bool PartialSubstitution = false;
12418 for (auto &Loc : TransformedPackArgs.arguments()) {
12419 Args.push_back(Loc.getArgument());
12420 if (Loc.getArgument().isPackExpansion())
12421 PartialSubstitution = true;
12422 }
12423
12424 if (PartialSubstitution)
12425 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
12426 E->getPackLoc(),
12427 E->getRParenLoc(), None, Args);
12428
12429 return getDerived().RebuildSizeOfPackExpr(E->getOperatorLoc(), E->getPack(),
12430 E->getPackLoc(), E->getRParenLoc(),
12431 Args.size(), None);
12432 }
12433
12434 template<typename Derived>
12435 ExprResult
12436 TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
12437 SubstNonTypeTemplateParmPackExpr *E) {
12438 // Default behavior is to do nothing with this transformation.
12439 return E;
12440 }
12441
12442 template<typename Derived>
12443 ExprResult
12444 TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
12445 SubstNonTypeTemplateParmExpr *E) {
12446 // Default behavior is to do nothing with this transformation.
12447 return E;
12448 }
12449
12450 template<typename Derived>
12451 ExprResult
12452 TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) {
12453 // Default behavior is to do nothing with this transformation.
12454 return E;
12455 }
12456
12457 template<typename Derived>
12458 ExprResult
12459 TreeTransform<Derived>::TransformMaterializeTemporaryExpr(
12460 MaterializeTemporaryExpr *E) {
12461 return getDerived().TransformExpr(E->getSubExpr());
12462 }
12463
12464 template<typename Derived>
12465 ExprResult
12466 TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
12467 Expr *Pattern = E->getPattern();
12468
12469 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
12470 getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);
12471 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
12472
12473 // Determine whether the set of unexpanded parameter packs can and should
12474 // be expanded.
12475 bool Expand = true;
12476 bool RetainExpansion = false;
12477 Optional<unsigned> OrigNumExpansions = E->getNumExpansions(),
12478 NumExpansions = OrigNumExpansions;
12479 if (getDerived().TryExpandParameterPacks(E->getEllipsisLoc(),
12480 Pattern->getSourceRange(),
12481 Unexpanded,
12482 Expand, RetainExpansion,
12483 NumExpansions))
12484 return true;
12485
12486 if (!Expand) {
12487 // Do not expand any packs here, just transform and rebuild a fold
12488 // expression.
12489 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
12490
12491 ExprResult LHS =
12492 E->getLHS() ? getDerived().TransformExpr(E->getLHS()) : ExprResult();
12493 if (LHS.isInvalid())
12494 return true;
12495
12496 ExprResult RHS =
12497 E->getRHS() ? getDerived().TransformExpr(E->getRHS()) : ExprResult();
12498 if (RHS.isInvalid())
12499 return true;
12500
12501 if (!getDerived().AlwaysRebuild() &&
12502 LHS.get() == E->getLHS() && RHS.get() == E->getRHS())
12503 return E;
12504
12505 return getDerived().RebuildCXXFoldExpr(
12506 E->getBeginLoc(), LHS.get(), E->getOperator(), E->getEllipsisLoc(),
12507 RHS.get(), E->getEndLoc(), NumExpansions);
12508 }
12509
12510 // The transform has determined that we should perform an elementwise
12511 // expansion of the pattern. Do so.
12512 ExprResult Result = getDerived().TransformExpr(E->getInit());
12513 if (Result.isInvalid())
12514 return true;
12515 bool LeftFold = E->isLeftFold();
12516
12517 // If we're retaining an expansion for a right fold, it is the innermost
12518 // component and takes the init (if any).
12519 if (!LeftFold && RetainExpansion) {
12520 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
12521
12522 ExprResult Out = getDerived().TransformExpr(Pattern);
12523 if (Out.isInvalid())
12524 return true;
12525
12526 Result = getDerived().RebuildCXXFoldExpr(
12527 E->getBeginLoc(), Out.get(), E->getOperator(), E->getEllipsisLoc(),
12528 Result.get(), E->getEndLoc(), OrigNumExpansions);
12529 if (Result.isInvalid())
12530 return true;
12531 }
12532
12533 for (unsigned I = 0; I != *NumExpansions; ++I) {
12534 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(
12535 getSema(), LeftFold ? I : *NumExpansions - I - 1);
12536 ExprResult Out = getDerived().TransformExpr(Pattern);
12537 if (Out.isInvalid())
12538 return true;
12539
12540 if (Out.get()->containsUnexpandedParameterPack()) {
12541 // We still have a pack; retain a pack expansion for this slice.
12542 Result = getDerived().RebuildCXXFoldExpr(
12543 E->getBeginLoc(), LeftFold ? Result.get() : Out.get(),
12544 E->getOperator(), E->getEllipsisLoc(),
12545 LeftFold ? Out.get() : Result.get(), E->getEndLoc(),
12546 OrigNumExpansions);
12547 } else if (Result.isUsable()) {
12548 // We've got down to a single element; build a binary operator.
12549 Result = getDerived().RebuildBinaryOperator(
12550 E->getEllipsisLoc(), E->getOperator(),
12551 LeftFold ? Result.get() : Out.get(),
12552 LeftFold ? Out.get() : Result.get());
12553 } else
12554 Result = Out;
12555
12556 if (Result.isInvalid())
12557 return true;
12558 }
12559
12560 // If we're retaining an expansion for a left fold, it is the outermost
12561 // component and takes the complete expansion so far as its init (if any).
12562 if (LeftFold && RetainExpansion) {
12563 ForgetPartiallySubstitutedPackRAII Forget(getDerived());
12564
12565 ExprResult Out = getDerived().TransformExpr(Pattern);
12566 if (Out.isInvalid())
12567 return true;
12568
12569 Result = getDerived().RebuildCXXFoldExpr(
12570 E->getBeginLoc(), Result.get(), E->getOperator(), E->getEllipsisLoc(),
12571 Out.get(), E->getEndLoc(), OrigNumExpansions);
12572 if (Result.isInvalid())
12573 return true;
12574 }
12575
12576 // If we had no init and an empty pack, and we're not retaining an expansion,
12577 // then produce a fallback value or error.
12578 if (Result.isUnset())
12579 return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
12580 E->getOperator());
12581
12582 return Result;
12583 }
12584
12585 template<typename Derived>
12586 ExprResult
12587 TreeTransform<Derived>::TransformCXXStdInitializerListExpr(
12588 CXXStdInitializerListExpr *E) {
12589 return getDerived().TransformExpr(E->getSubExpr());
12590 }
12591
12592 template<typename Derived>
12593 ExprResult
12594 TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) {
12595 return SemaRef.MaybeBindToTemporary(E);
12596 }
12597
12598 template<typename Derived>
12599 ExprResult
12600 TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
12601 return E;
12602 }
12603
12604 template<typename Derived>
12605 ExprResult
12606 TreeTransform<Derived>::TransformObjCBoxedExpr(ObjCBoxedExpr *E) {
12607 ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
12608 if (SubExpr.isInvalid())
12609 return ExprError();
12610
12611 if (!getDerived().AlwaysRebuild() &&
12612 SubExpr.get() == E->getSubExpr())
12613 return E;
12614
12615 return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
12616 }
12617
12618 template<typename Derived>
12619 ExprResult
12620 TreeTransform<Derived>::TransformObjCArrayLiteral(ObjCArrayLiteral *E) {
12621 // Transform each of the elements.
12622 SmallVector<Expr *, 8> Elements;
12623 bool ArgChanged = false;
12624 if (getDerived().TransformExprs(E->getElements(), E->getNumElements(),
12625 /*IsCall=*/false, Elements, &ArgChanged))
12626 return ExprError();
12627
12628 if (!getDerived().AlwaysRebuild() && !ArgChanged)
12629 return SemaRef.MaybeBindToTemporary(E);
12630
12631 return getDerived().RebuildObjCArrayLiteral(E->getSourceRange(),
12632 Elements.data(),
12633 Elements.size());
12634 }
12635
12636 template<typename Derived>
12637 ExprResult
12638 TreeTransform<Derived>::TransformObjCDictionaryLiteral(
12639 ObjCDictionaryLiteral *E) {
12640 // Transform each of the elements.
12641 SmallVector<ObjCDictionaryElement, 8> Elements;
12642 bool ArgChanged = false;
12643 for (unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
12644 ObjCDictionaryElement OrigElement = E->getKeyValueElement(I);
12645
12646 if (OrigElement.isPackExpansion()) {
12647 // This key/value element is a pack expansion.
12648 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
12649 getSema().collectUnexpandedParameterPacks(OrigElement.Key, Unexpanded);
12650 getSema().collectUnexpandedParameterPacks(OrigElement.Value, Unexpanded);
12651 assert(!Unexpanded.empty() && "Pack expansion without parameter packs?");
12652
12653 // Determine whether the set of unexpanded parameter packs can
12654 // and should be expanded.
12655 bool Expand = true;
12656 bool RetainExpansion = false;
12657 Optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
12658 Optional<unsigned> NumExpansions = OrigNumExpansions;
12659 SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
12660 OrigElement.Value->getEndLoc());
12661 if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
12662 PatternRange, Unexpanded, Expand,
12663 RetainExpansion, NumExpansions))
12664 return ExprError();
12665
12666 if (!Expand) {
12667 // The transform has determined that we should perform a simple
12668 // transformation on the pack expansion, producing another pack
12669 // expansion.
12670 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
12671 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
12672 if (Key.isInvalid())
12673 return ExprError();
12674
12675 if (Key.get() != OrigElement.Key)
12676 ArgChanged = true;
12677
12678 ExprResult Value = getDerived().TransformExpr(OrigElement.Value);
12679 if (Value.isInvalid())
12680 return ExprError();
12681
12682 if (Value.get() != OrigElement.Value)
12683 ArgChanged = true;
12684
12685 ObjCDictionaryElement Expansion = {
12686 Key.get(), Value.get(), OrigElement.EllipsisLoc, NumExpansions
12687 };
12688 Elements.push_back(Expansion);
12689 continue;
12690 }
12691
12692 // Record right away that the argument was changed. This needs
12693 // to happen even if the array expands to nothing.
12694 ArgChanged = true;
12695
12696 // The transform has determined that we should perform an elementwise
12697 // expansion of the pattern. Do so.
12698 for (unsigned I = 0; I != *NumExpansions; ++I) {
12699 Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
12700 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
12701 if (Key.isInvalid())
12702 return ExprError();
12703
12704 ExprResult Value = getDerived().TransformExpr(OrigElement.Value);
12705 if (Value.isInvalid())
12706 return ExprError();
12707
12708 ObjCDictionaryElement Element = {
12709 Key.get(), Value.get(), SourceLocation(), NumExpansions
12710 };
12711
12712 // If any unexpanded parameter packs remain, we still have a
12713 // pack expansion.
12714 // FIXME: Can this really happen?
12715 if (Key.get()->containsUnexpandedParameterPack() ||
12716 Value.get()->containsUnexpandedParameterPack())
12717 Element.EllipsisLoc = OrigElement.EllipsisLoc;
12718
12719 Elements.push_back(Element);
12720 }
12721
12722 // FIXME: Retain a pack expansion if RetainExpansion is true.
12723
12724 // We've finished with this pack expansion.
12725 continue;
12726 }
12727
12728 // Transform and check key.
12729 ExprResult Key = getDerived().TransformExpr(OrigElement.Key);
12730 if (Key.isInvalid())
12731 return ExprError();
12732
12733 if (Key.get() != OrigElement.Key)
12734 ArgChanged = true;
12735
12736 // Transform and check value.
12737 ExprResult Value
12738 = getDerived().TransformExpr(OrigElement.Value);
12739 if (Value.isInvalid())
12740 return ExprError();
12741
12742 if (Value.get() != OrigElement.Value)
12743 ArgChanged = true;
12744
12745 ObjCDictionaryElement Element = {
12746 Key.get(), Value.get(), SourceLocation(), None
12747 };
12748 Elements.push_back(Element);
12749 }
12750
12751 if (!getDerived().AlwaysRebuild() && !ArgChanged)
12752 return SemaRef.MaybeBindToTemporary(E);
12753
12754 return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(),
12755 Elements);
12756 }
12757
12758 template<typename Derived>
12759 ExprResult
12760 TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
12761 TypeSourceInfo *EncodedTypeInfo
12762 = getDerived().TransformType(E->getEncodedTypeSourceInfo());
12763 if (!EncodedTypeInfo)
12764 return ExprError();
12765
12766 if (!getDerived().AlwaysRebuild() &&
12767 EncodedTypeInfo == E->getEncodedTypeSourceInfo())
12768 return E;
12769
12770 return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
12771 EncodedTypeInfo,
12772 E->getRParenLoc());
12773 }
12774
12775 template<typename Derived>
12776 ExprResult TreeTransform<Derived>::
12777 TransformObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
12778 // This is a kind of implicit conversion, and it needs to get dropped
12779 // and recomputed for the same general reasons that ImplicitCastExprs
12780 // do, as well a more specific one: this expression is only valid when
12781 // it appears *immediately* as an argument expression.
12782 return getDerived().TransformExpr(E->getSubExpr());
12783 }
12784
12785 template<typename Derived>
12786 ExprResult TreeTransform<Derived>::
12787 TransformObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
12788 TypeSourceInfo *TSInfo
12789 = getDerived().TransformType(E->getTypeInfoAsWritten());
12790 if (!TSInfo)
12791 return ExprError();
12792
12793 ExprResult Result = getDerived().TransformExpr(E->getSubExpr());
12794 if (Result.isInvalid())
12795 return ExprError();
12796
12797 if (!getDerived().AlwaysRebuild() &&
12798 TSInfo == E->getTypeInfoAsWritten() &&
12799 Result.get() == E->getSubExpr())
12800 return E;
12801
12802 return SemaRef.BuildObjCBridgedCast(E->getLParenLoc(), E->getBridgeKind(),
12803 E->getBridgeKeywordLoc(), TSInfo,
12804 Result.get());
12805 }
12806
12807 template <typename Derived>
12808 ExprResult TreeTransform<Derived>::TransformObjCAvailabilityCheckExpr(
12809 ObjCAvailabilityCheckExpr *E) {
12810 return E;
12811 }
12812
12813 template<typename Derived>
12814 ExprResult
12815 TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
12816 // Transform arguments.
12817 bool ArgChanged = false;
12818 SmallVector<Expr*, 8> Args;
12819 Args.reserve(E->getNumArgs());
12820 if (getDerived().TransformExprs(E->getArgs(), E->getNumArgs(), false, Args,
12821 &ArgChanged))
12822 return ExprError();
12823
12824 if (E->getReceiverKind() == ObjCMessageExpr::Class) {
12825 // Class message: transform the receiver type.
12826 TypeSourceInfo *ReceiverTypeInfo
12827 = getDerived().TransformType(E->getClassReceiverTypeInfo());
12828 if (!ReceiverTypeInfo)
12829 return ExprError();
12830
12831 // If nothing changed, just retain the existing message send.
12832 if (!getDerived().AlwaysRebuild() &&
12833 ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged)
12834 return SemaRef.MaybeBindToTemporary(E);
12835
12836 // Build a new class message send.
12837 SmallVector<SourceLocation, 16> SelLocs;
12838 E->getSelectorLocs(SelLocs);
12839 return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo,
12840 E->getSelector(),
12841 SelLocs,
12842 E->getMethodDecl(),
12843 E->getLeftLoc(),
12844 Args,
12845 E->getRightLoc());
12846 }
12847 else if (E->getReceiverKind() == ObjCMessageExpr::SuperClass ||
12848 E->getReceiverKind() == ObjCMessageExpr::SuperInstance) {
12849 if (!E->getMethodDecl())
12850 return ExprError();
12851
12852 // Build a new class message send to 'super'.
12853 SmallVector<SourceLocation, 16> SelLocs;
12854 E->getSelectorLocs(SelLocs);
12855 return getDerived().RebuildObjCMessageExpr(E->getSuperLoc(),
12856 E->getSelector(),
12857 SelLocs,
12858 E->getReceiverType(),
12859 E->getMethodDecl(),
12860 E->getLeftLoc(),
12861 Args,
12862 E->getRightLoc());
12863 }
12864
12865 // Instance message: transform the receiver
12866 assert(E->getReceiverKind() == ObjCMessageExpr::Instance &&
12867 "Only class and instance messages may be instantiated");
12868 ExprResult Receiver
12869 = getDerived().TransformExpr(E->getInstanceReceiver());
12870 if (Receiver.isInvalid())
12871 return ExprError();
12872
12873 // If nothing changed, just retain the existing message send.
12874 if (!getDerived().AlwaysRebuild() &&
12875 Receiver.get() == E->getInstanceReceiver() && !ArgChanged)
12876 return SemaRef.MaybeBindToTemporary(E);
12877
12878 // Build a new instance message send.
12879 SmallVector<SourceLocation, 16> SelLocs;
12880 E->getSelectorLocs(SelLocs);
12881 return getDerived().RebuildObjCMessageExpr(Receiver.get(),
12882 E->getSelector(),
12883 SelLocs,
12884 E->getMethodDecl(),
12885 E->getLeftLoc(),
12886 Args,
12887 E->getRightLoc());
12888 }
12889
12890 template<typename Derived>
12891 ExprResult
12892 TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
12893 return E;
12894 }
12895
12896 template<typename Derived>
12897 ExprResult
12898 TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
12899 return E;
12900 }
12901
12902 template<typename Derived>
12903 ExprResult
12904 TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
12905 // Transform the base expression.
12906 ExprResult Base = getDerived().TransformExpr(E->getBase());
12907 if (Base.isInvalid())
12908 return ExprError();
12909
12910 // We don't need to transform the ivar; it will never change.
12911
12912 // If nothing changed, just retain the existing expression.
12913 if (!getDerived().AlwaysRebuild() &&
12914 Base.get() == E->getBase())
12915 return E;
12916
12917 return getDerived().RebuildObjCIvarRefExpr(Base.get(), E->getDecl(),
12918 E->getLocation(),
12919 E->isArrow(), E->isFreeIvar());
12920 }
12921
12922 template<typename Derived>
12923 ExprResult
12924 TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
12925 // 'super' and types never change. Property never changes. Just
12926 // retain the existing expression.
12927 if (!E->isObjectReceiver())
12928 return E;
12929
12930 // Transform the base expression.
12931 ExprResult Base = getDerived().TransformExpr(E->getBase());
12932 if (Base.isInvalid())
12933 return ExprError();
12934
12935 // We don't need to transform the property; it will never change.
12936
12937 // If nothing changed, just retain the existing expression.
12938 if (!getDerived().AlwaysRebuild() &&
12939 Base.get() == E->getBase())
12940 return E;
12941
12942 if (E->isExplicitProperty())
12943 return getDerived().RebuildObjCPropertyRefExpr(Base.get(),
12944 E->getExplicitProperty(),
12945 E->getLocation());
12946
12947 return getDerived().RebuildObjCPropertyRefExpr(Base.get(),
12948 SemaRef.Context.PseudoObjectTy,
12949 E->getImplicitPropertyGetter(),
12950 E->getImplicitPropertySetter(),
12951 E->getLocation());
12952 }
12953
12954 template<typename Derived>
12955 ExprResult
12956 TreeTransform<Derived>::TransformObjCSubscriptRefExpr(ObjCSubscriptRefExpr *E) {
12957 // Transform the base expression.
12958 ExprResult Base = getDerived().TransformExpr(E->getBaseExpr());
12959 if (Base.isInvalid())
12960 return ExprError();
12961
12962 // Transform the key expression.
12963 ExprResult Key = getDerived().TransformExpr(E->getKeyExpr());
12964 if (Key.isInvalid())
12965 return ExprError();
12966
12967 // If nothing changed, just retain the existing expression.
12968 if (!getDerived().AlwaysRebuild() &&
12969 Key.get() == E->getKeyExpr() && Base.get() == E->getBaseExpr())
12970 return E;
12971
12972 return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
12973 Base.get(), Key.get(),
12974 E->getAtIndexMethodDecl(),
12975 E->setAtIndexMethodDecl());
12976 }
12977
12978 template<typename Derived>
12979 ExprResult
12980 TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
12981 // Transform the base expression.
12982 ExprResult Base = getDerived().TransformExpr(E->getBase());
12983 if (Base.isInvalid())
12984 return ExprError();
12985
12986 // If nothing changed, just retain the existing expression.
12987 if (!getDerived().AlwaysRebuild() &&
12988 Base.get() == E->getBase())
12989 return E;
12990
12991 return getDerived().RebuildObjCIsaExpr(Base.get(), E->getIsaMemberLoc(),
12992 E->getOpLoc(),
12993 E->isArrow());
12994 }
12995
12996 template<typename Derived>
12997 ExprResult
12998 TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
12999 bool ArgumentChanged = false;
13000 SmallVector<Expr*, 8> SubExprs;
13001 SubExprs.reserve(E->getNumSubExprs());
13002 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(), false,
13003 SubExprs, &ArgumentChanged))
13004 return ExprError();
13005
13006 if (!getDerived().AlwaysRebuild() &&
13007 !ArgumentChanged)
13008 return E;
13009
13010 return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
13011 SubExprs,
13012 E->getRParenLoc());
13013 }
13014
13015 template<typename Derived>
13016 ExprResult
13017 TreeTransform<Derived>::TransformConvertVectorExpr(ConvertVectorExpr *E) {
13018 ExprResult SrcExpr = getDerived().TransformExpr(E->getSrcExpr());
13019 if (SrcExpr.isInvalid())
13020 return ExprError();
13021
13022 TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
13023 if (!Type)
13024 return ExprError();
13025
13026 if (!getDerived().AlwaysRebuild() &&
13027 Type == E->getTypeSourceInfo() &&
13028 SrcExpr.get() == E->getSrcExpr())
13029 return E;
13030
13031 return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
13032 SrcExpr.get(), Type,
13033 E->getRParenLoc());
13034 }
13035
13036 template<typename Derived>
13037 ExprResult
13038 TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
13039 BlockDecl *oldBlock = E->getBlockDecl();
13040
13041 SemaRef.ActOnBlockStart(E->getCaretLocation(), /*Scope=*/nullptr);
13042 BlockScopeInfo *blockScope = SemaRef.getCurBlock();
13043
13044 blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
13045 blockScope->TheDecl->setBlockMissingReturnType(
13046 oldBlock->blockMissingReturnType());
13047
13048 SmallVector<ParmVarDecl*, 4> params;
13049 SmallVector<QualType, 4> paramTypes;
13050
13051 const FunctionProtoType *exprFunctionType = E->getFunctionType();
13052
13053 // Parameter substitution.
13054 Sema::ExtParameterInfoBuilder extParamInfos;
13055 if (getDerived().TransformFunctionTypeParams(
13056 E->getCaretLocation(), oldBlock->parameters(), nullptr,
13057 exprFunctionType->getExtParameterInfosOrNull(), paramTypes, &params,
13058 extParamInfos)) {
13059 getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
13060 return ExprError();
13061 }
13062
13063 QualType exprResultType =
13064 getDerived().TransformType(exprFunctionType->getReturnType());
13065
13066 auto epi = exprFunctionType->getExtProtoInfo();
13067 epi.ExtParameterInfos = extParamInfos.getPointerOrNull(paramTypes.size());
13068
13069 QualType functionType =
13070 getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, epi);
13071 blockScope->FunctionType = functionType;
13072
13073 // Set the parameters on the block decl.
13074 if (!params.empty())
13075 blockScope->TheDecl->setParams(params);
13076
13077 if (!oldBlock->blockMissingReturnType()) {
13078 blockScope->HasImplicitReturnType = false;
13079 blockScope->ReturnType = exprResultType;
13080 }
13081
13082 // Transform the body
13083 StmtResult body = getDerived().TransformStmt(E->getBody());
13084 if (body.isInvalid()) {
13085 getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
13086 return ExprError();
13087 }
13088
13089 #ifndef NDEBUG
13090 // In builds with assertions, make sure that we captured everything we
13091 // captured before.
13092 if (!SemaRef.getDiagnostics().hasErrorOccurred()) {
13093 for (const auto &I : oldBlock->captures()) {
13094 VarDecl *oldCapture = I.getVariable();
13095
13096 // Ignore parameter packs.
13097 if (oldCapture->isParameterPack())
13098 continue;
13099
13100 VarDecl *newCapture =
13101 cast<VarDecl>(getDerived().TransformDecl(E->getCaretLocation(),
13102 oldCapture));
13103 assert(blockScope->CaptureMap.count(newCapture));
13104 }
13105 assert(oldBlock->capturesCXXThis() == blockScope->isCXXThisCaptured());
13106 }
13107 #endif
13108
13109 return SemaRef.ActOnBlockStmtExpr(E->getCaretLocation(), body.get(),
13110 /*Scope=*/nullptr);
13111 }
13112
13113 template<typename Derived>
13114 ExprResult
13115 TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *E) {
13116 llvm_unreachable("Cannot transform asType expressions yet");
13117 }
13118
13119 template<typename Derived>
13120 ExprResult
13121 TreeTransform<Derived>::TransformAtomicExpr(AtomicExpr *E) {
13122 bool ArgumentChanged = false;
13123 SmallVector<Expr*, 8> SubExprs;
13124 SubExprs.reserve(E->getNumSubExprs());
13125 if (getDerived().TransformExprs(E->getSubExprs(), E->getNumSubExprs(), false,
13126 SubExprs, &ArgumentChanged))
13127 return ExprError();
13128
13129 if (!getDerived().AlwaysRebuild() &&
13130 !ArgumentChanged)
13131 return E;
13132
13133 return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
13134 E->getOp(), E->getRParenLoc());
13135 }
13136
13137 //===----------------------------------------------------------------------===//
13138 // Type reconstruction
13139 //===----------------------------------------------------------------------===//
13140
13141 template<typename Derived>
13142 QualType TreeTransform<Derived>::RebuildPointerType(QualType PointeeType,
13143 SourceLocation Star) {
13144 return SemaRef.BuildPointerType(PointeeType, Star,
13145 getDerived().getBaseEntity());
13146 }
13147
13148 template<typename Derived>
13149 QualType TreeTransform<Derived>::RebuildBlockPointerType(QualType PointeeType,
13150 SourceLocation Star) {
13151 return SemaRef.BuildBlockPointerType(PointeeType, Star,
13152 getDerived().getBaseEntity());
13153 }
13154
13155 template<typename Derived>
13156 QualType
13157 TreeTransform<Derived>::RebuildReferenceType(QualType ReferentType,
13158 bool WrittenAsLValue,
13159 SourceLocation Sigil) {
13160 return SemaRef.BuildReferenceType(ReferentType, WrittenAsLValue,
13161 Sigil, getDerived().getBaseEntity());
13162 }
13163
13164 template<typename Derived>
13165 QualType
13166 TreeTransform<Derived>::RebuildMemberPointerType(QualType PointeeType,
13167 QualType ClassType,
13168 SourceLocation Sigil) {
13169 return SemaRef.BuildMemberPointerType(PointeeType, ClassType, Sigil,
13170 getDerived().getBaseEntity());
13171 }
13172
13173 template<typename Derived>
13174 QualType TreeTransform<Derived>::RebuildObjCTypeParamType(
13175 const ObjCTypeParamDecl *Decl,
13176 SourceLocation ProtocolLAngleLoc,
13177 ArrayRef<ObjCProtocolDecl *> Protocols,
13178 ArrayRef<SourceLocation> ProtocolLocs,
13179 SourceLocation ProtocolRAngleLoc) {
13180 return SemaRef.BuildObjCTypeParamType(Decl,
13181 ProtocolLAngleLoc, Protocols,
13182 ProtocolLocs, ProtocolRAngleLoc,
13183 /*FailOnError=*/true);
13184 }
13185
13186 template<typename Derived>
13187 QualType TreeTransform<Derived>::RebuildObjCObjectType(
13188 QualType BaseType,
13189 SourceLocation Loc,
13190 SourceLocation TypeArgsLAngleLoc,
13191 ArrayRef<TypeSourceInfo *> TypeArgs,
13192 SourceLocation TypeArgsRAngleLoc,
13193 SourceLocation ProtocolLAngleLoc,
13194 ArrayRef<ObjCProtocolDecl *> Protocols,
13195 ArrayRef<SourceLocation> ProtocolLocs,
13196 SourceLocation ProtocolRAngleLoc) {
13197 return SemaRef.BuildObjCObjectType(BaseType, Loc, TypeArgsLAngleLoc,
13198 TypeArgs, TypeArgsRAngleLoc,
13199 ProtocolLAngleLoc, Protocols, ProtocolLocs,
13200 ProtocolRAngleLoc,
13201 /*FailOnError=*/true);
13202 }
13203
13204 template<typename Derived>
13205 QualType TreeTransform<Derived>::RebuildObjCObjectPointerType(
13206 QualType PointeeType,
13207 SourceLocation Star) {
13208 return SemaRef.Context.getObjCObjectPointerType(PointeeType);
13209 }
13210
13211 template<typename Derived>
13212 QualType
13213 TreeTransform<Derived>::RebuildArrayType(QualType ElementType,
13214 ArrayType::ArraySizeModifier SizeMod,
13215 const llvm::APInt *Size,
13216 Expr *SizeExpr,
13217 unsigned IndexTypeQuals,
13218 SourceRange BracketsRange) {
13219 if (SizeExpr || !Size)
13220 return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
13221 IndexTypeQuals, BracketsRange,
13222 getDerived().getBaseEntity());
13223
13224 QualType Types[] = {
13225 SemaRef.Context.UnsignedCharTy, SemaRef.Context.UnsignedShortTy,
13226 SemaRef.Context.UnsignedIntTy, SemaRef.Context.UnsignedLongTy,
13227 SemaRef.Context.UnsignedLongLongTy, SemaRef.Context.UnsignedInt128Ty
13228 };
13229 const unsigned NumTypes = llvm::array_lengthof(Types);
13230 QualType SizeType;
13231 for (unsigned I = 0; I != NumTypes; ++I)
13232 if (Size->getBitWidth() == SemaRef.Context.getIntWidth(Types[I])) {
13233 SizeType = Types[I];
13234 break;
13235 }
13236
13237 // Note that we can return a VariableArrayType here in the case where
13238 // the element type was a dependent VariableArrayType.
13239 IntegerLiteral *ArraySize
13240 = IntegerLiteral::Create(SemaRef.Context, *Size, SizeType,
13241 /*FIXME*/BracketsRange.getBegin());
13242 return SemaRef.BuildArrayType(ElementType, SizeMod, ArraySize,
13243 IndexTypeQuals, BracketsRange,
13244 getDerived().getBaseEntity());
13245 }
13246
13247 template<typename Derived>
13248 QualType
13249 TreeTransform<Derived>::RebuildConstantArrayType(QualType ElementType,
13250 ArrayType::ArraySizeModifier SizeMod,
13251 const llvm::APInt &Size,
13252 Expr *SizeExpr,
13253 unsigned IndexTypeQuals,
13254 SourceRange BracketsRange) {
13255 return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
13256 IndexTypeQuals, BracketsRange);
13257 }
13258
13259 template<typename Derived>
13260 QualType
13261 TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType,
13262 ArrayType::ArraySizeModifier SizeMod,
13263 unsigned IndexTypeQuals,
13264 SourceRange BracketsRange) {
13265 return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr, nullptr,
13266 IndexTypeQuals, BracketsRange);
13267 }
13268
13269 template<typename Derived>
13270 QualType
13271 TreeTransform<Derived>::RebuildVariableArrayType(QualType ElementType,
13272 ArrayType::ArraySizeModifier SizeMod,
13273 Expr *SizeExpr,
13274 unsigned IndexTypeQuals,
13275 SourceRange BracketsRange) {
13276 return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr,
13277 SizeExpr,
13278 IndexTypeQuals, BracketsRange);
13279 }
13280
13281 template<typename Derived>
13282 QualType
13283 TreeTransform<Derived>::RebuildDependentSizedArrayType(QualType ElementType,
13284 ArrayType::ArraySizeModifier SizeMod,
13285 Expr *SizeExpr,
13286 unsigned IndexTypeQuals,
13287 SourceRange BracketsRange) {
13288 return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr,
13289 SizeExpr,
13290 IndexTypeQuals, BracketsRange);
13291 }
13292
13293 template <typename Derived>
13294 QualType TreeTransform<Derived>::RebuildDependentAddressSpaceType(
13295 QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttributeLoc) {
13296 return SemaRef.BuildAddressSpaceAttr(PointeeType, AddrSpaceExpr,
13297 AttributeLoc);
13298 }
13299
13300 template <typename Derived>
13301 QualType
13302 TreeTransform<Derived>::RebuildVectorType(QualType ElementType,
13303 unsigned NumElements,
13304 VectorType::VectorKind VecKind) {
13305 // FIXME: semantic checking!
13306 return SemaRef.Context.getVectorType(ElementType, NumElements, VecKind);
13307 }
13308
13309 template <typename Derived>
13310 QualType TreeTransform<Derived>::RebuildDependentVectorType(
13311 QualType ElementType, Expr *SizeExpr, SourceLocation AttributeLoc,
13312 VectorType::VectorKind VecKind) {
13313 return SemaRef.BuildVectorType(ElementType, SizeExpr, AttributeLoc);
13314 }
13315
13316 template<typename Derived>
13317 QualType TreeTransform<Derived>::RebuildExtVectorType(QualType ElementType,
13318 unsigned NumElements,
13319 SourceLocation AttributeLoc) {
13320 llvm::APInt numElements(SemaRef.Context.getIntWidth(SemaRef.Context.IntTy),
13321 NumElements, true);
13322 IntegerLiteral *VectorSize
13323 = IntegerLiteral::Create(SemaRef.Context, numElements, SemaRef.Context.IntTy,
13324 AttributeLoc);
13325 return SemaRef.BuildExtVectorType(ElementType, VectorSize, AttributeLoc);
13326 }
13327
13328 template<typename Derived>
13329 QualType
13330 TreeTransform<Derived>::RebuildDependentSizedExtVectorType(QualType ElementType,
13331 Expr *SizeExpr,
13332 SourceLocation AttributeLoc) {
13333 return SemaRef.BuildExtVectorType(ElementType, SizeExpr, AttributeLoc);
13334 }
13335
13336 template<typename Derived>
13337 QualType TreeTransform<Derived>::RebuildFunctionProtoType(
13338 QualType T,
13339 MutableArrayRef<QualType> ParamTypes,
13340 const FunctionProtoType::ExtProtoInfo &EPI) {
13341 return SemaRef.BuildFunctionType(T, ParamTypes,
13342 getDerived().getBaseLocation(),
13343 getDerived().getBaseEntity(),
13344 EPI);
13345 }
13346
13347 template<typename Derived>
13348 QualType TreeTransform<Derived>::RebuildFunctionNoProtoType(QualType T) {
13349 return SemaRef.Context.getFunctionNoProtoType(T);
13350 }
13351
13352 template<typename Derived>
13353 QualType TreeTransform<Derived>::RebuildUnresolvedUsingType(SourceLocation Loc,
13354 Decl *D) {
13355 assert(D && "no decl found");
13356 if (D->isInvalidDecl()) return QualType();
13357
13358 // FIXME: Doesn't account for ObjCInterfaceDecl!
13359 TypeDecl *Ty;
13360 if (auto *UPD = dyn_cast<UsingPackDecl>(D)) {
13361 // A valid resolved using typename pack expansion decl can have multiple
13362 // UsingDecls, but they must each have exactly one type, and it must be
13363 // the same type in every case. But we must have at least one expansion!
13364 if (UPD->expansions().empty()) {
13365 getSema().Diag(Loc, diag::err_using_pack_expansion_empty)
13366 << UPD->isCXXClassMember() << UPD;
13367 return QualType();
13368 }
13369
13370 // We might still have some unresolved types. Try to pick a resolved type
13371 // if we can. The final instantiation will check that the remaining
13372 // unresolved types instantiate to the type we pick.
13373 QualType FallbackT;
13374 QualType T;
13375 for (auto *E : UPD->expansions()) {
13376 QualType ThisT = RebuildUnresolvedUsingType(Loc, E);
13377 if (ThisT.isNull())
13378 continue;
13379 else if (ThisT->getAs<UnresolvedUsingType>())
13380 FallbackT = ThisT;
13381 else if (T.isNull())
13382 T = ThisT;
13383 else
13384 assert(getSema().Context.hasSameType(ThisT, T) &&
13385 "mismatched resolved types in using pack expansion");
13386 }
13387 return T.isNull() ? FallbackT : T;
13388 } else if (auto *Using = dyn_cast<UsingDecl>(D)) {
13389 assert(Using->hasTypename() &&
13390 "UnresolvedUsingTypenameDecl transformed to non-typename using");
13391
13392 // A valid resolved using typename decl points to exactly one type decl.
13393 assert(++Using->shadow_begin() == Using->shadow_end());
13394 Ty = cast<TypeDecl>((*Using->shadow_begin())->getTargetDecl());
13395 } else {
13396 assert(isa<UnresolvedUsingTypenameDecl>(D) &&
13397 "UnresolvedUsingTypenameDecl transformed to non-using decl");
13398 Ty = cast<UnresolvedUsingTypenameDecl>(D);
13399 }
13400
13401 return SemaRef.Context.getTypeDeclType(Ty);
13402 }
13403
13404 template<typename Derived>
13405 QualType TreeTransform<Derived>::RebuildTypeOfExprType(Expr *E,
13406 SourceLocation Loc) {
13407 return SemaRef.BuildTypeofExprType(E, Loc);
13408 }
13409
13410 template<typename Derived>
13411 QualType TreeTransform<Derived>::RebuildTypeOfType(QualType Underlying) {
13412 return SemaRef.Context.getTypeOfType(Underlying);
13413 }
13414
13415 template<typename Derived>
13416 QualType TreeTransform<Derived>::RebuildDecltypeType(Expr *E,
13417 SourceLocation Loc) {
13418 return SemaRef.BuildDecltypeType(E, Loc);
13419 }
13420
13421 template<typename Derived>
13422 QualType TreeTransform<Derived>::RebuildUnaryTransformType(QualType BaseType,
13423 UnaryTransformType::UTTKind UKind,
13424 SourceLocation Loc) {
13425 return SemaRef.BuildUnaryTransformType(BaseType, UKind, Loc);
13426 }
13427
13428 template<typename Derived>
13429 QualType TreeTransform<Derived>::RebuildTemplateSpecializationType(
13430 TemplateName Template,
13431 SourceLocation TemplateNameLoc,
13432 TemplateArgumentListInfo &TemplateArgs) {
13433 return SemaRef.CheckTemplateIdType(Template, TemplateNameLoc, TemplateArgs);
13434 }
13435
13436 template<typename Derived>
13437 QualType TreeTransform<Derived>::RebuildAtomicType(QualType ValueType,
13438 SourceLocation KWLoc) {
13439 return SemaRef.BuildAtomicType(ValueType, KWLoc);
13440 }
13441
13442 template<typename Derived>
13443 QualType TreeTransform<Derived>::RebuildPipeType(QualType ValueType,
13444 SourceLocation KWLoc,
13445 bool isReadPipe) {
13446 return isReadPipe ? SemaRef.BuildReadPipeType(ValueType, KWLoc)
13447 : SemaRef.BuildWritePipeType(ValueType, KWLoc);
13448 }
13449
13450 template<typename Derived>
13451 TemplateName
13452 TreeTransform<Derived>::RebuildTemplateName(CXXScopeSpec &SS,
13453 bool TemplateKW,
13454 TemplateDecl *Template) {
13455 return SemaRef.Context.getQualifiedTemplateName(SS.getScopeRep(), TemplateKW,
13456 Template);
13457 }
13458
13459 template<typename Derived>
13460 TemplateName
13461 TreeTransform<Derived>::RebuildTemplateName(CXXScopeSpec &SS,
13462 SourceLocation TemplateKWLoc,
13463 const IdentifierInfo &Name,
13464 SourceLocation NameLoc,
13465 QualType ObjectType,
13466 NamedDecl *FirstQualifierInScope,
13467 bool AllowInjectedClassName) {
13468 UnqualifiedId TemplateName;
13469 TemplateName.setIdentifier(&Name, NameLoc);
13470 Sema::TemplateTy Template;
13471 getSema().ActOnDependentTemplateName(/*Scope=*/nullptr,
13472 SS, TemplateKWLoc, TemplateName,
13473 ParsedType::make(ObjectType),
13474 /*EnteringContext=*/false,
13475 Template, AllowInjectedClassName);
13476 return Template.get();
13477 }
13478
13479 template<typename Derived>
13480 TemplateName
13481 TreeTransform<Derived>::RebuildTemplateName(CXXScopeSpec &SS,
13482 SourceLocation TemplateKWLoc,
13483 OverloadedOperatorKind Operator,
13484 SourceLocation NameLoc,
13485 QualType ObjectType,
13486 bool AllowInjectedClassName) {
13487 UnqualifiedId Name;
13488 // FIXME: Bogus location information.
13489 SourceLocation SymbolLocations[3] = { NameLoc, NameLoc, NameLoc };
13490 Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
13491 Sema::TemplateTy Template;
13492 getSema().ActOnDependentTemplateName(/*Scope=*/nullptr,
13493 SS, TemplateKWLoc, Name,
13494 ParsedType::make(ObjectType),
13495 /*EnteringContext=*/false,
13496 Template, AllowInjectedClassName);
13497 return Template.get();
13498 }
13499
13500 template<typename Derived>
13501 ExprResult
13502 TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
13503 SourceLocation OpLoc,
13504 Expr *OrigCallee,
13505 Expr *First,
13506 Expr *Second) {
13507 Expr *Callee = OrigCallee->IgnoreParenCasts();
13508 bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
13509
13510 if (First->getObjectKind() == OK_ObjCProperty) {
13511 BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
13512 if (BinaryOperator::isAssignmentOp(Opc))
13513 return SemaRef.checkPseudoObjectAssignment(/*Scope=*/nullptr, OpLoc, Opc,
13514 First, Second);
13515 ExprResult Result = SemaRef.CheckPlaceholderExpr(First);
13516 if (Result.isInvalid())
13517 return ExprError();
13518 First = Result.get();
13519 }
13520
13521 if (Second && Second->getObjectKind() == OK_ObjCProperty) {
13522 ExprResult Result = SemaRef.CheckPlaceholderExpr(Second);
13523 if (Result.isInvalid())
13524 return ExprError();
13525 Second = Result.get();
13526 }
13527
13528 // Determine whether this should be a builtin operation.
13529 if (Op == OO_Subscript) {
13530 if (!First->getType()->isOverloadableType() &&
13531 !Second->getType()->isOverloadableType())
13532 return getSema().CreateBuiltinArraySubscriptExpr(
13533 First, Callee->getBeginLoc(), Second, OpLoc);
13534 } else if (Op == OO_Arrow) {
13535 // -> is never a builtin operation.
13536 return SemaRef.BuildOverloadedArrowExpr(nullptr, First, OpLoc);
13537 } else if (Second == nullptr || isPostIncDec) {
13538 if (!First->getType()->isOverloadableType() ||
13539 (Op == OO_Amp && getSema().isQualifiedMemberAccess(First))) {
13540 // The argument is not of overloadable type, or this is an expression
13541 // of the form &Class::member, so try to create a built-in unary
13542 // operation.
13543 UnaryOperatorKind Opc
13544 = UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
13545
13546 return getSema().CreateBuiltinUnaryOp(OpLoc, Opc, First);
13547 }
13548 } else {
13549 if (!First->getType()->isOverloadableType() &&
13550 !Second->getType()->isOverloadableType()) {
13551 // Neither of the arguments is an overloadable type, so try to
13552 // create a built-in binary operation.
13553 BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
13554 ExprResult Result
13555 = SemaRef.CreateBuiltinBinOp(OpLoc, Opc, First, Second);
13556 if (Result.isInvalid())
13557 return ExprError();
13558
13559 return Result;
13560 }
13561 }
13562
13563 // Compute the transformed set of functions (and function templates) to be
13564 // used during overload resolution.
13565 UnresolvedSet<16> Functions;
13566 bool RequiresADL;
13567
13568 if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Callee)) {
13569 Functions.append(ULE->decls_begin(), ULE->decls_end());
13570 // If the overload could not be resolved in the template definition
13571 // (because we had a dependent argument), ADL is performed as part of
13572 // template instantiation.
13573 RequiresADL = ULE->requiresADL();
13574 } else {
13575 // If we've resolved this to a particular non-member function, just call
13576 // that function. If we resolved it to a member function,
13577 // CreateOverloaded* will find that function for us.
13578 NamedDecl *ND = cast<DeclRefExpr>(Callee)->getDecl();
13579 if (!isa<CXXMethodDecl>(ND))
13580 Functions.addDecl(ND);
13581 RequiresADL = false;
13582 }
13583
13584 // Add any functions found via argument-dependent lookup.
13585 Expr *Args[2] = { First, Second };
13586 unsigned NumArgs = 1 + (Second != nullptr);
13587
13588 // Create the overloaded operator invocation for unary operators.
13589 if (NumArgs == 1 || isPostIncDec) {
13590 UnaryOperatorKind Opc
13591 = UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
13592 return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions, First,
13593 RequiresADL);
13594 }
13595
13596 if (Op == OO_Subscript) {
13597 SourceLocation LBrace;
13598 SourceLocation RBrace;
13599
13600 if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Callee)) {
13601 DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
13602 LBrace = SourceLocation::getFromRawEncoding(
13603 NameLoc.CXXOperatorName.BeginOpNameLoc);
13604 RBrace = SourceLocation::getFromRawEncoding(
13605 NameLoc.CXXOperatorName.EndOpNameLoc);
13606 } else {
13607 LBrace = Callee->getBeginLoc();
13608 RBrace = OpLoc;
13609 }
13610
13611 return SemaRef.CreateOverloadedArraySubscriptExpr(LBrace, RBrace,
13612 First, Second);
13613 }
13614
13615 // Create the overloaded operator invocation for binary operators.
13616 BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
13617 ExprResult Result = SemaRef.CreateOverloadedBinOp(
13618 OpLoc, Opc, Functions, Args[0], Args[1], RequiresADL);
13619 if (Result.isInvalid())
13620 return ExprError();
13621
13622 return Result;
13623 }
13624
13625 template<typename Derived>
13626 ExprResult
13627 TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(Expr *Base,
13628 SourceLocation OperatorLoc,
13629 bool isArrow,
13630 CXXScopeSpec &SS,
13631 TypeSourceInfo *ScopeType,
13632 SourceLocation CCLoc,
13633 SourceLocation TildeLoc,
13634 PseudoDestructorTypeStorage Destroyed) {
13635 QualType BaseType = Base->getType();
13636 if (Base->isTypeDependent() || Destroyed.getIdentifier() ||
13637 (!isArrow && !BaseType->getAs<RecordType>()) ||
13638 (isArrow && BaseType->getAs<PointerType>() &&
13639 !BaseType->castAs<PointerType>()->getPointeeType()
13640 ->template getAs<RecordType>())){
13641 // This pseudo-destructor expression is still a pseudo-destructor.
13642 return SemaRef.BuildPseudoDestructorExpr(
13643 Base, OperatorLoc, isArrow ? tok::arrow : tok::period, SS, ScopeType,
13644 CCLoc, TildeLoc, Destroyed);
13645 }
13646
13647 TypeSourceInfo *DestroyedType = Destroyed.getTypeSourceInfo();
13648 DeclarationName Name(SemaRef.Context.DeclarationNames.getCXXDestructorName(
13649 SemaRef.Context.getCanonicalType(DestroyedType->getType())));
13650 DeclarationNameInfo NameInfo(Name, Destroyed.getLocation());
13651 NameInfo.setNamedTypeInfo(DestroyedType);
13652
13653 // The scope type is now known to be a valid nested name specifier
13654 // component. Tack it on to the end of the nested name specifier.
13655 if (ScopeType) {
13656 if (!ScopeType->getType()->getAs<TagType>()) {
13657 getSema().Diag(ScopeType->getTypeLoc().getBeginLoc(),
13658 diag::err_expected_class_or_namespace)
13659 << ScopeType->getType() << getSema().getLangOpts().CPlusPlus;
13660 return ExprError();
13661 }
13662 SS.Extend(SemaRef.Context, SourceLocation(), ScopeType->getTypeLoc(),
13663 CCLoc);
13664 }
13665
13666 SourceLocation TemplateKWLoc; // FIXME: retrieve it from caller.
13667 return getSema().BuildMemberReferenceExpr(Base, BaseType,
13668 OperatorLoc, isArrow,
13669 SS, TemplateKWLoc,
13670 /*FIXME: FirstQualifier*/ nullptr,
13671 NameInfo,
13672 /*TemplateArgs*/ nullptr,
13673 /*S*/nullptr);
13674 }
13675
13676 template<typename Derived>
13677 StmtResult
13678 TreeTransform<Derived>::TransformCapturedStmt(CapturedStmt *S) {
13679 SourceLocation Loc = S->getBeginLoc();
13680 CapturedDecl *CD = S->getCapturedDecl();
13681 unsigned NumParams = CD->getNumParams();
13682 unsigned ContextParamPos = CD->getContextParamPosition();
13683 SmallVector<Sema::CapturedParamNameType, 4> Params;
13684 for (unsigned I = 0; I < NumParams; ++I) {
13685 if (I != ContextParamPos) {
13686 Params.push_back(
13687 std::make_pair(
13688 CD->getParam(I)->getName(),
13689 getDerived().TransformType(CD->getParam(I)->getType())));
13690 } else {
13691 Params.push_back(std::make_pair(StringRef(), QualType()));
13692 }
13693 }
13694 getSema().ActOnCapturedRegionStart(Loc, /*CurScope*/nullptr,
13695 S->getCapturedRegionKind(), Params);
13696 StmtResult Body;
13697 {
13698 Sema::CompoundScopeRAII CompoundScope(getSema());
13699 Body = getDerived().TransformStmt(S->getCapturedStmt());
13700 }
13701
13702 if (Body.isInvalid()) {
13703 getSema().ActOnCapturedRegionError();
13704 return StmtError();
13705 }
13706
13707 return getSema().ActOnCapturedRegionEnd(Body.get());
13708 }
13709
13710 } // end namespace clang
13711
13712 #endif // LLVM_CLANG_LIB_SEMA_TREETRANSFORM_H
clang::DoStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Stmt.h:2387
clang::ForStmt::getInc
Expr * getInc()
Definition: Stmt.h:2443
clang::ObjCPropertyRefExpr
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
clang::FullExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:963
clang::ObjCIndirectCopyRestoreExpr
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1577
clang::CXXOperatorCallExpr
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:78
clang::TreeTransform::TemporaryBase::TemporaryBase
TemporaryBase(TreeTransform &Self, SourceLocation Location, DeclarationName Entity)
Definition: TreeTransform.h:190
clang::DesignatedInitExpr::Designator
Represents a single C99 designator.
Definition: Expr.h:4714
clang::DeclarationNameInfo::getLoc
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
Definition: DeclarationName.h:719
clang::DeclRefExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1348
ParsedTemplate.h
clang::CompoundStmt::getRBracLoc
SourceLocation getRBracLoc() const
Definition: Stmt.h:1440
clang::BlockExpr::getBlockDecl
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5593
clang::OMPDistributeSimdDirective
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3757
clang::DeducedType::getDeducedType
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it&#39;s either not been deduced or was deduce...
Definition: Type.h:4859
clang::GCCAsmStmt::getInputIdentifier
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition: Stmt.h:2994
clang::OMPMasterDirective
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1591
clang::ElaboratedType
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
Definition: Type.h:5285
clang::ParmVarDecl::setScopeInfo
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
Definition: Decl.h:1628
clang::AtomicTypeLoc::getValueLoc
TypeLoc getValueLoc() const
Definition: TypeLoc.h:2361
clang::CXXUuidofExpr::getTypeOperandSourceInfo
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:1036
clang::GCCAsmStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Stmt.h:2901
clang::CXXNullPtrLiteralExpr
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:683
clang::OverloadExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: ExprCXX.h:2977
clang::CXXThisExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:1115
clang::LambdaExpr::explicit_capture_end
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition: ExprCXX.cpp:1261
clang::OMPTaskDirective
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:1986
clang::GCCAsmStmt
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:2878
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1783
clang::DependentCoawaitExpr
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4735
clang::DesignatedInitExpr::getArrayIndex
Expr * getArrayIndex(const Designator &D) const
Definition: Expr.cpp:4408
clang::CXXForRangeStmt::getForLoc
SourceLocation getForLoc() const
Definition: StmtCXX.h:201
clang::FunctionTypeLoc::getExceptionSpecRange
SourceRange getExceptionSpecRange() const
Definition: TypeLoc.h:1406
clang::CXXFoldExpr::getNumExpansions
Optional< unsigned > getNumExpansions() const
Definition: ExprCXX.h:4577
clang::DeclRefExpr::getFoundDecl
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1284
clang::OMPReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:2637
OMPThreadLimitClause
This represents &#39;thread_limit&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5164
clang::UnexpandedParameterPack
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:235
clang::TreeTransform::RebuildOMPSharedClause
OMPClause * RebuildOMPSharedClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;shared&#39; clause.
Definition: TreeTransform.h:1694
clang::CallExpr::getArgs
Expr ** getArgs()
Retrieve the call arguments.
Definition: Expr.h:2692
clang::ConditionalOperator::getLHS
Expr * getLHS() const
Definition: Expr.h:3780
clang::OverloadExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition: ExprCXX.h:2995
Identifier
StringRef Identifier
Definition: Format.cpp:1833
clang::GCCAsmStmt::getLabelIdentifier
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition: Stmt.h:3031
clang::AsmStmt::getNumInputs
unsigned getNumInputs() const
Definition: Stmt.h:2790
clang::ObjCIsaExpr::getOpLoc
SourceLocation getOpLoc() const
Definition: ExprObjC.h:1528
clang::CallExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:2789
clang::ObjCDictionaryLiteral::getKeyValueElement
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:360
clang::DeclRefExpr::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1340
clang::BlockExpr::getFunctionType
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
Definition: Expr.cpp:2370
clang::SEHFinallyStmt::getBlock
CompoundStmt * getBlock() const
Definition: Stmt.h:3269
clang::TemplateArgumentLocInventIterator::operator==
friend bool operator==(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
Definition: TreeTransform.h:4184
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:685
clang::TreeTransform::RebuildObjCArrayLiteral
ExprResult RebuildObjCArrayLiteral(SourceRange Range, Expr **Elements, unsigned NumElements)
Build a new Objective-C array literal.
Definition: TreeTransform.h:3141
clang::TemplateArgumentLocContainerIterator::reference
TemplateArgumentLoc reference
Definition: TreeTransform.h:6041
clang::ForStmt::getForLoc
SourceLocation getForLoc() const
Definition: Stmt.h:2456
OMPCopyinClause
This represents clause &#39;copyin&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3541
clang::InheritingConcreteTypeLoc::getTypePtr
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:502
clang::OpaquePtr::get
PtrTy get() const
Definition: Ownership.h:80
clang::PointerType
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2614
clang::TreeTransform::RebuildCaseStmt
StmtResult RebuildCaseStmt(SourceLocation CaseLoc, Expr *LHS, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation ColonLoc)
Build a new case statement.
Definition: TreeTransform.h:1235
clang::PointerType::getPointeeType
QualType getPointeeType() const
Definition: Type.h:2627
clang::TreeTransform::RebuildObjCDictionaryLiteral
ExprResult RebuildObjCDictionaryLiteral(SourceRange Range, MutableArrayRef< ObjCDictionaryElement > Elements)
Build a new Objective-C dictionary literal.
Definition: TreeTransform.h:3159
clang::CXXScopeSpec::MakeSuper
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into &#39;__super&#39; nested-name-specifier.
Definition: DeclSpec.cpp:106
clang::CXXDefaultArgExpr::getUsedLocation
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Definition: ExprCXX.h:1248
clang::UnresolvedUsingType
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4210
clang::PseudoDestructorTypeStorage
Stores the type being destroyed by a pseudo-destructor expression.
Definition: ExprCXX.h:2428
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
clang::Sema::NestedNameSpecInfo
Keeps information about an identifier in a nested-name-spec.
Definition: Sema.h:5895
clang::CXXDefaultInitExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:1323
clang::TreeTransform::RebuildCXXUuidofExpr
ExprResult RebuildCXXUuidofExpr(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a new C++ __uuidof(type) expression.
Definition: TreeTransform.h:2737
clang::NestedNameSpecifierLocBuilder::MakeTrivial
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
Definition: NestedNameSpecifier.cpp:639
clang::MemberExpr::getMemberDecl
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2919
clang::ObjCObjectPointerTypeLoc::setStarLoc
void setStarLoc(SourceLocation Loc)
Definition: TypeLoc.h:1302
clang::AtomicTypeLoc
Definition: TypeLoc.h:2358
clang::TreeTransform::getDerived
Derived & getDerived()
Retrieves a reference to the derived class.
Definition: TreeTransform.h:130
clang::OMPExecutableDirective::clauses
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:325
clang::ChooseExpr::getCond
Expr * getCond() const
Definition: Expr.h:4175
clang::OMPProcBindClause::getProcBindKind
llvm::omp::ProcBindKind getProcBindKind() const
Returns kind of the clause.
Definition: OpenMPClause.h:990
clang::TreeTransform::TransformType
QualType TransformType(QualType T)
Transforms the given type into another type.
Definition: TreeTransform.h:4320
clang::CallExpr::getArg
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2702
clang::ObjCSubscriptRefExpr::getAtIndexMethodDecl
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:896
clang::ObjCMessageExpr::getSelector
Selector getSelector() const
Definition: ExprObjC.cpp:337
clang::CXXNoexceptExpr::getSourceRange
SourceRange getSourceRange() const
Definition: ExprCXX.h:3982
clang::CaseStmt::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition: Stmt.h:1575
clang::ParenExpr::getLParen
SourceLocation getLParen() const
Get the location of the left parentheses &#39;(&#39;.
Definition: Expr.h:2018
clang::CXXThrowExpr::getSubExpr
const Expr * getSubExpr() const
Definition: ExprCXX.h:1162
clang::VariableArrayTypeLoc
Definition: TypeLoc.h:1557
clang::LambdaExpr::capture_end
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
Definition: ExprCXX.cpp:1249
clang::OMPScheduleClause::getCommaLoc
SourceLocation getCommaLoc()
Get location of &#39;,&#39;.
Definition: OpenMPClause.h:1437
clang::ConcreteTypeLoc::getTypePtr
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:409
clang::concepts::ExprRequirement
A requires-expression requirement which queries the validity and properties of an expression (&#39;simple...
Definition: ExprConcepts.h:240
clang::WhileStmt::getCond
Expr * getCond()
Definition: Stmt.h:2275
clang::sema::LambdaScopeInfo::GLTemplateParameterList
TemplateParameterList * GLTemplateParameterList
If this is a generic lambda, and the template parameter list has been created (from the TemplateParam...
Definition: ScopeInfo.h:834
clang::NestedNameSpecifierLoc::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Definition: NestedNameSpecifier.cpp:421
clang::TreeTransform::RebuildRequiresExpr
ExprResult RebuildRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl *> LocalParameters, ArrayRef< concepts::Requirement *> Requirements, SourceLocation ClosingBraceLoc)
Build a new requires expression.
Definition: TreeTransform.h:3084
clang::ShuffleVectorExpr::getNumSubExprs
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:4033
clang::TreeTransform::RebuildObjCMessageExpr
ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, SourceLocation RBracLoc)
Build a new Objective-C class message.
Definition: TreeTransform.h:3175
clang::TypeTraitExpr
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2627
clang::RequiresExpr::getLocalParameters
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:494
clang::AutoTypeLoc::getNumArgs
unsigned getNumArgs() const
Definition: TypeLoc.h:2014
clang::StmtExpr::getSubStmt
CompoundStmt * getSubStmt()
Definition: Expr.h:3970
clang::OpenMPDefaultmapClauseKind
OpenMPDefaultmapClauseKind
OpenMP attributes for &#39;defaultmap&#39; clause.
Definition: OpenMPKinds.h:158
clang::OMPAtomicDefaultMemOrderClause
This represents &#39;atomic_default_mem_order&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1192
clang::CXXRewrittenBinaryOperator::DecomposedForm::Opcode
BinaryOperatorKind Opcode
The original opcode, prior to rewriting.
Definition: ExprCXX.h:298
clang::TemplateArgumentLocContainerIterator::operator*
TemplateArgumentLoc operator*() const
Definition: TreeTransform.h:6074
clang::CXXUnresolvedConstructExpr::isListInitialization
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3444
clang::SourceLocExpr::getParentContext
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value...
Definition: Expr.h:4335
clang::PipeTypeLoc::getKWLoc
SourceLocation getKWLoc() const
Definition: TypeLoc.h:2424
clang::TemplateArgumentLoc::getTemplateQualifierLoc
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Definition: TemplateBase.h:531
clang::TreeTransform::RebuildCXXTryStmt
StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt *> Handlers)
Build a new C++ try statement.
Definition: TreeTransform.h:2096
clang::concepts::ExprRequirement::getExpr
Expr * getExpr() const
Definition: ExprConcepts.h:375
clang::TreeTransform::RebuildSwitchStmtBody
StmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Attach the body to the switch statement.
Definition: TreeTransform.h:1307
clang::MSAsmStmt::getNumAsmToks
unsigned getNumAsmToks()
Definition: Stmt.h:3131
clang::TreeTransform::RebuildCXXFoldExpr
ExprResult RebuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, Optional< unsigned > NumExpansions)
Build a new C++1z fold-expression.
Definition: TreeTransform.h:3401
clang::GenericSelectionExpr::getControllingExpr
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
Definition: Expr.h:5417
clang::AutoType::getTypeConstraintArguments
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
Definition: Type.h:4904
clang::DecltypeType::getUnderlyingExpr
Expr * getUnderlyingExpr() const
Definition: Type.h:4380
clang::TreeTransform::RebuildObjCIsaExpr
ExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc, SourceLocation OpLoc, bool IsArrow)
Build a new Objective-C "isa" expression.
Definition: TreeTransform.h:3286
clang::TreeTransform::RebuildDoStmt
StmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation LParenLoc, Expr *Cond, SourceLocation RParenLoc)
Build a new do-while statement.
Definition: TreeTransform.h:1325
clang::PipeTypeLoc::setKWLoc
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:2425
clang::TemplateArgumentLocInventIterator::pointer::operator->
const TemplateArgumentLoc * operator->() const
Definition: TreeTransform.h:4156
clang::FunctionTypeLoc::setRParenLoc
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1398
clang::ObjCAtCatchStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: StmtObjC.h:107
clang::LambdaExpr::hasExplicitResultType
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
Definition: ExprCXX.h:2028
clang::TreeTransform::FinishCXXForRangeStmt
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
Attach body to a C++0x range-based for statement.
Definition: TreeTransform.h:2158
clang::CXXThrowExpr::isThrownVariableInScope
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Definition: ExprCXX.h:1172
clang::AutoTypeKeyword
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
Definition: Type.h:1413
clang::CXXFoldExpr::isLeftFold
bool isLeftFold() const
Does this produce a left-associated sequence of operators?
Definition: ExprCXX.h:4566
clang::CoreturnStmt
Represents a &#39;co_return&#39; statement in the C++ Coroutines TS.
Definition: StmtCXX.h:456
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::CallExpr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2689
clang::OMPInReductionClause
This represents clause &#39;in_reduction&#39; in the &#39;#pragma omp task&#39; directives.
Definition: OpenMPClause.h:2910
clang::ArrayTypeTraitExpr::getDimensionExpression
Expr * getDimensionExpression() const
Definition: ExprCXX.h:2762
clang::ObjCAtTryStmt::getFinallyStmt
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
Definition: StmtObjC.h:235
clang::TemplateSpecializationTypeLoc::setLAngleLoc
void setLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1592
clang::FunctionTypeLoc::setExceptionSpecRange
void setExceptionSpecRange(SourceRange R)
Definition: TypeLoc.h:1412
clang::TreeTransform::RebuildExpressionTrait
ExprResult RebuildExpressionTrait(ExpressionTrait Trait, SourceLocation StartLoc, Expr *Queried, SourceLocation RParenLoc)
Build a new expression trait expression.
Definition: TreeTransform.h:2875
clang::CXXTryStmt::getHandler
CXXCatchStmt * getHandler(unsigned i)
Definition: StmtCXX.h:107
clang::TreeTransform::RebuildArraySubscriptExpr
ExprResult RebuildArraySubscriptExpr(Expr *LHS, SourceLocation LBracketLoc, Expr *RHS, SourceLocation RBracketLoc)
Build a new array subscript expression.
Definition: TreeTransform.h:2287
clang::IfStmt
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1834
clang::TreeTransform::RebuildOffsetOfExpr
ExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc, TypeSourceInfo *Type, ArrayRef< Sema::OffsetOfComponent > Components, SourceLocation RParenLoc)
Build a new builtin offsetof expression.
Definition: TreeTransform.h:2247
clang::DependentScopeDeclRefExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: ExprCXX.h:3225
clang::OffsetOfExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2302
clang::ShuffleVectorExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4020
clang::FunctionNoProtoTypeLoc
Definition: TypeLoc.h:1472
clang::Type::getPointeeType
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Definition: Type.cpp:557
clang::DependentScopeDeclRefExpr::getTemplateArgs
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:3253
clang::PipeTypeLoc::getValueLoc
TypeLoc getValueLoc() const
Definition: TypeLoc.h:2420
clang::AutoTypeLoc::setConceptNameLoc
void setConceptNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1976
clang::ObjCSubscriptRefExpr::setAtIndexMethodDecl
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:900
clang::TreeTransform::RebuildObjCEncodeExpr
ExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc, TypeSourceInfo *EncodeTypeInfo, SourceLocation RParenLoc)
Build a new Objective-C @encode expression.
Definition: TreeTransform.h:3168
clang::sema::CapturingScopeInfo::ReturnType
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
Definition: ScopeInfo.h:659
clang::TreeTransform::RebuildEnumType
QualType RebuildEnumType(EnumDecl *Enum)
Build a new Enum type.
Definition: TreeTransform.h:925
clang::VarDecl::getStorageClass
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1029
clang::ElaboratedTypeLoc
Definition: TypeLoc.h:2087
Base
clang::TemplateArgumentLocContainerIterator::difference_type
int difference_type
Definition: TreeTransform.h:6042
clang::AsmStmt::getNumOutputs
unsigned getNumOutputs() const
Definition: Stmt.h:2768
clang::TreeTransform::RebuildForStmt
StmtResult RebuildForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *Init, Sema::ConditionResult Cond, Sema::FullExprArg Inc, SourceLocation RParenLoc, Stmt *Body)
Build a new for statement.
Definition: TreeTransform.h:1336
clang::TreeTransform::RebuildObjCSubscriptRefExpr
ExprResult RebuildObjCSubscriptRefExpr(SourceLocation RB, Expr *Base, Expr *Key, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Definition: TreeTransform.h:3147
clang::DependentNameType
Represents a qualified type name for which the type name is dependent.
Definition: Type.h:5368
clang::CXXTypeidExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:832
clang::OMPForSimdDirective
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1337
clang::CoroutineStmtBuilder
Definition: CoroutineStmtBuilder.h:24
clang::OMPSimdlenClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:766
clang::OMPAllocatorClause::getAllocator
Expr * getAllocator() const
Returns allocator.
Definition: OpenMPClause.h:301
clang::Type::isRecordType
bool isRecordType() const
Definition: Type.h:6594
clang::TemplateArgumentLocInventIterator::reference
TemplateArgumentLoc reference
Definition: TreeTransform.h:4145
clang::MemberExpr::getBase
Expr * getBase() const
Definition: Expr.h:2913
clang::GCCAsmStmt::getAsmString
const StringLiteral * getAsmString() const
Definition: Stmt.h:2906
clang::CompoundLiteralExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:3113
clang::Sema::Diag
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Definition: Sema.h:1411
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
OMPGrainsizeClause
This represents &#39;grainsize&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5314
clang::TreeTransform::TransformTemplateParameterList
TemplateParameterList * TransformTemplateParameterList(TemplateParameterList *TPL)
Definition: TreeTransform.h:686
clang::OMPTeamsDistributeParallelForDirective
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:4171
clang::CXXCatchStmt::getHandlerBlock
Stmt * getHandlerBlock() const
Definition: StmtCXX.h:51
clang::OMPExecutableDirective::getBeginLoc
SourceLocation getBeginLoc() const
Returns starting location of directive kind.
Definition: StmtOpenMP.h:225
clang::Decl::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:421
clang::ObjCPropertyRefExpr::getImplicitPropertySetter
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:717
clang::TreeTransform::TransformDefinition
Decl * TransformDefinition(SourceLocation Loc, Decl *D)
Transform the definition of the given declaration.
Definition: TreeTransform.h:472
clang::TreeTransform::TreeTransform
TreeTransform(Sema &SemaRef)
Initializes a new tree transformer.
Definition: TreeTransform.h:127
clang::ArrayInitIndexExpr
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5082
clang::CXXNewExpr::getOperatorNew
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2218
clang::BuiltinTypeLoc::getWrittenBuiltinSpecs
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
Definition: TypeLoc.h:575
clang::UnresolvedLookupExpr
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3037
clang::TreeTransform::RebuildOMPInReductionClause
OMPClause * RebuildOMPInReductionClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr *> UnresolvedReductions)
Build a new OpenMP &#39;in_reduction&#39; clause.
Definition: TreeTransform.h:1739
clang::OMPIfClause
This represents &#39;if&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:425
clang::ASTContext::getDeducedTemplateSpecializationType
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
Definition: ASTContext.cpp:5176
clang::VAArgExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:4262
clang::MSDependentExistsStmt::getNameInfo
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we&#39;re testing for, along with location information.
Definition: StmtCXX.h:288
DeclTemplate.h
Defines the C++ template declaration subclasses.
clang::DecltypeTypeLoc
Definition: TypeLoc.h:1877
clang::BinaryOperator::getOpcode
Opcode getOpcode() const
Definition: Expr.h:3469
P
StringRef P
Definition: ASTMatchersInternal.cpp:485
clang::OMPParallelMasterDirective
This represents &#39;#pragma omp parallel master&#39; directive.
Definition: StmtOpenMP.h:1863
clang::OMPExecutableDirective::getInnermostCapturedStmt
CapturedStmt * getInnermostCapturedStmt()
Get innermost captured statement for the construct.
Definition: StmtOpenMP.h:283
clang::AutoType
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:4874
clang::TemplateArgumentLocContainerIterator::pointer
Definition: TreeTransform.h:6045
clang::LabelStmt::getIdentLoc
SourceLocation getIdentLoc() const
Definition: Stmt.h:1746
clang::AttributedStmt
Represents an attribute applied to a statement.
Definition: Stmt.h:1776
clang::ParenExpr
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1994
clang::ast_matchers::functionType
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
Definition: ASTMatchersInternal.cpp:867
clang::ObjCForCollectionStmt::getCollection
Expr * getCollection()
Definition: StmtObjC.h:35
clang::TreeTransform::RebuildCXXRewrittenBinaryOperator
ExprResult RebuildCXXRewrittenBinaryOperator(SourceLocation OpLoc, BinaryOperatorKind Opcode, const UnresolvedSetImpl &UnqualLookups, Expr *LHS, Expr *RHS)
Build a new rewritten operator expression.
Definition: TreeTransform.h:2392
clang::RValueReferenceTypeLoc
Definition: TypeLoc.h:1329
clang::MemberExpr::hasQualifier
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
Definition: Expr.h:2933
clang::MSDependentExistsStmt::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:284
clang::OMPArraySectionExpr::getLowerBound
Expr * getLowerBound()
Get lower bound of array section.
Definition: ExprOpenMP.h:90
clang::IntegerLiteral
Definition: Expr.h:1446
OMPPriorityClause
This represents &#39;priority&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5240
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1450
clang::OMPTargetTeamsDistributeDirective
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:4310
clang::ObjCAtThrowStmt
Represents Objective-C&#39;s @throw statement.
Definition: StmtObjC.h:332
clang::CXXConstructExpr::requiresZeroInitialization
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1533
clang::BlockDecl::setParams
void setParams(ArrayRef< ParmVarDecl *> NewParamInfo)
Definition: Decl.cpp:4546
clang::TemplateArgumentLocInventIterator::operator*
reference operator*() const
Definition: TreeTransform.h:4176
clang::DeclRefExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Definition: Expr.h:1328
clang::AutoTypeLoc::setLAngleLoc
void setLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2002
clang::DependentTemplateSpecializationTypeLoc::setTemplateKeywordLoc
void setTemplateKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:2244
clang::ArrayType
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2889
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:497
clang::DependentCoawaitExpr::getKeywordLoc
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:4766
clang::CXXConstructExpr
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
clang::DeclStmt::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1251
clang::ObjCSubscriptRefExpr
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
clang::TypedefTypeLoc
Wrapper for source info for typedefs.
Definition: TypeLoc.h:670
clang::ExplicitCastExpr::getTypeInfoAsWritten
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
Definition: Expr.h:3355
clang::BinaryOperator::getFPFeatures
FPOptions getFPFeatures() const
Definition: Expr.h:3611
clang::ArrayTypeTraitExpr
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2715
clang::AdjustedTypeLoc::getOriginalLoc
TypeLoc getOriginalLoc() const
Definition: TypeLoc.h:1162
clang::Decl::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:425
clang::SEHTryStmt::getIsCXXTry
bool getIsCXXTry() const
Definition: Stmt.h:3311
clang::CStyleCastExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:3397
clang::OMPFinalClause::getCondition
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:567
DeclObjC.h
clang::TemplateArgumentLocInventIterator::iterator_category
std::input_iterator_tag iterator_category
Definition: TreeTransform.h:4148
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6227
clang::OMPUpdateClause
This represents &#39;update&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1765
clang::CXXFoldExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:4583
clang::CXXRewrittenBinaryOperator::DecomposedForm::RHS
const Expr * RHS
The original right-hand side.
Definition: ExprCXX.h:302
clang::OpaquePtr
Wrapper for void* pointer.
Definition: Ownership.h:50
clang::Sema::FunctionScopeRAII::disable
void disable()
Definition: Sema.h:4137
clang::XRayInstrKind::Function
constexpr XRayInstrMask Function
Definition: XRayInstr.h:38
clang::TreeTransform::RebuildCXXConstCastExpr
ExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, SourceLocation LParenLoc, Expr *SubExpr, SourceLocation RParenLoc)
Build a new C++ const_cast expression.
Definition: TreeTransform.h:2671
clang::OMPIfClause::getCondition
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:493
clang::DependentVectorType::getAttributeLoc
SourceLocation getAttributeLoc() const
Definition: Type.h:3327
clang::OMPParallelForDirective
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1715
clang::MSPropertySubscriptExpr
MS property subscript expression.
Definition: ExprCXX.h:937
clang::PredefinedExpr::getIdentKind
IdentKind getIdentKind() const
Definition: Expr.h:1951
clang::TreeTransform::RebuildOMPPriorityClause
OMPClause * RebuildOMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;priority&#39; clause.
Definition: TreeTransform.h:1896
clang::TypeTraitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:2690
clang::IndirectGotoStmt::getGotoLoc
SourceLocation getGotoLoc() const
Definition: Stmt.h:2536
clang::CXXScopeSpec::location_size
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
Definition: DeclSpec.h:221
clang::concepts::TypeRequirement::isSubstitutionFailure
bool isSubstitutionFailure() const
Definition: ExprConcepts.h:216
clang::SizeOfPackExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Determine the location of the &#39;sizeof&#39; keyword.
Definition: ExprCXX.h:4153
clang::CXXScalarValueInitExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:2077
clang::OMPTargetTeamsDistributeParallelForDirective
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:4379
clang::DecayedTypeLoc
Wrapper for source info for pointers decayed from arrays and functions.
Definition: TypeLoc.h:1187
clang::LambdaCapture
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:25
clang::TreeTransform::RebuildOMPSafelenClause
OMPClause * RebuildOMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;safelen&#39; clause.
Definition: TreeTransform.h:1564
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2383
clang::LookupResult::clear
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
Definition: Lookup.h:554
clang::MaterializeTemporaryExpr
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4419
clang::OpenMPDefaultmapClauseModifier
OpenMPDefaultmapClauseModifier
OpenMP modifiers for &#39;defaultmap&#39; clause.
Definition: OpenMPKinds.h:166
clang::ExtVectorElementExpr::getAccessorLoc
SourceLocation getAccessorLoc() const
Definition: Expr.h:5543
clang::concepts::TypeRequirement::getSubstitutionDiagnostic
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:220
OMPAlignedClause::getAlignment
Expr * getAlignment()
Returns alignment.
Definition: OpenMPClause.h:3507
clang::NestedNameSpecifierLoc::getLocalBeginLoc
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Definition: NestedNameSpecifier.h:304
clang::OMPOrderedClause::getNumForLoops
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:1532
clang::ConvertVectorExpr::getRParenLoc
SourceLocation getRParenLoc() const
getRParenLoc - Return the location of final right parenthesis.
Definition: Expr.h:4105
clang::TypeLoc::getEndLoc
SourceLocation getEndLoc() const
Get the end source location.
Definition: TypeLoc.cpp:228
clang::OMPScheduleClause::getSecondScheduleModifierLoc
SourceLocation getSecondScheduleModifierLoc() const
Get the second modifier location.
Definition: OpenMPClause.h:1432
clang::ArrayType::getElementType
QualType getElementType() const
Definition: Type.h:2910
clang::TreeTransform::RebuildTypeRequirement
concepts::TypeRequirement * RebuildTypeRequirement(concepts::Requirement::SubstitutionDiagnostic *SubstDiag)
Definition: TreeTransform.h:3094
Value
Value
Definition: UninitializedValues.cpp:101
clang::DeducedTemplateSpecializationType::getTemplateName
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
Definition: Type.h:4958
clang::CXXForRangeStmt::getCoawaitLoc
SourceLocation getCoawaitLoc() const
Definition: StmtCXX.h:202
clang::OffsetOfExpr::getIndexExpr
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2330
clang::CoroutineBodyStmt::getExceptionHandler
Stmt * getExceptionHandler() const
Definition: StmtCXX.h:396
clang::OMPExecutableDirective::getEndLoc
SourceLocation getEndLoc() const
Returns ending location of directive.
Definition: StmtOpenMP.h:227
clang::TypeofLikeTypeLoc::getRParenLoc
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1816
clang::CoroutineBodyStmt::getDeallocate
Expr * getDeallocate() const
Definition: StmtCXX.h:406
clang::OMPTargetExitDataDirective
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2690
clang::DefaultStmt::getSubStmt
Stmt * getSubStmt()
Definition: Stmt.h:1667
clang::CXXScopeSpec::Adopt
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Definition: DeclSpec.cpp:124
OMPDependClause::getDependencyLoc
SourceLocation getDependencyLoc() const
Get dependency type location.
Definition: OpenMPClause.h:4043
clang::concepts::ExprRequirement::getExprSubstitutionDiagnostic
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
Definition: ExprConcepts.h:368
clang::TemplateArgumentListInfo::setRAngleLoc
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:574
clang::OMPReadClause
This represents &#39;read&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1687
clang::ArrayTypeTraitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:2751
clang::CXXConstructExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.cpp:587
clang::EnterExpressionEvaluationContext
RAII object that enters a new expression evaluation context.
Definition: Sema.h:12029
clang::MacroQualifiedTypeLoc::getExpansionLoc
SourceLocation getExpansionLoc() const
Definition: TypeLoc.h:1093
clang::TreeTransform::RebuildOMPDeviceClause
OMPClause * RebuildOMPDeviceClause(Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;device&#39; clause.
Definition: TreeTransform.h:1832
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:820
clang::StmtResult
ActionResult< Stmt * > StmtResult
Definition: Ownership.h:264
clang::TreeTransform::getDerived
const Derived & getDerived() const
Retrieves a reference to the derived class.
Definition: TreeTransform.h:133
clang::OMPPrivateClause
This represents clause &#39;private&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:1885
clang::ForStmt::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Stmt.h:2458
clang::CXXDependentScopeMemberExpr::getBaseType
QualType getBaseType() const
Definition: ExprCXX.h:3614
clang::TreeTransform::RebuildOMPExecutableDirective
StmtResult RebuildOMPExecutableDirective(OpenMPDirectiveKind Kind, DeclarationNameInfo DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Build a new OpenMP executable directive.
Definition: TreeTransform.h:1512
clang::ObjCIsaExpr
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1492
clang::Declarator
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1792
clang::TreeTransform::RebuildOMPToClause
OMPClause * RebuildOMPToClause(ArrayRef< Expr *> VarList, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, const OMPVarListLocTy &Locs, ArrayRef< Expr *> UnresolvedMappers)
Build a new OpenMP &#39;to&#39; clause.
Definition: TreeTransform.h:1952
clang::Qualifiers::removeObjCLifetime
void removeObjCLifetime()
Definition: Type.h:339
clang::TreeTransform::RebuildConditionalOperator
ExprResult RebuildConditionalOperator(Expr *Cond, SourceLocation QuestionLoc, Expr *LHS, SourceLocation ColonLoc, Expr *RHS)
Build a new conditional operator expression.
Definition: TreeTransform.h:2403
clang::CompoundLiteralExpr
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3077
clang::OMPNumThreadsClause
This represents &#39;num_threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:594
clang::MemberPointerTypeLoc
Wrapper for source info for member pointers.
Definition: TypeLoc.h:1256
clang::TreeTransform::RebuildCXXNamedCastExpr
ExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc, Stmt::StmtClass Class, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, SourceLocation LParenLoc, Expr *SubExpr, SourceLocation RParenLoc)
Build a new C++ "named" cast expression, such as static_cast or reinterpret_cast. ...
Definition: TreeTransform.h:2581
clang::Type::isEnumeralType
bool isEnumeralType() const
Definition: Type.h:6598
clang::CXXPseudoDestructorExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Retrieve the location of the &#39;.&#39; or &#39;->&#39; operator.
Definition: ExprCXX.h:2545
clang::QualifiedTypeLoc
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
Definition: TypeLoc.h:277
clang::PseudoDestructorTypeStorage::getIdentifier
IdentifierInfo * getIdentifier() const
Definition: ExprCXX.h:2448
clang::DependentCoawaitExpr::getOperatorCoawaitLookup
UnresolvedLookupExpr * getOperatorCoawaitLookup() const
Definition: ExprCXX.h:4762
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:7002
clang::Type::isOverloadableType
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
Definition: Type.h:6907
clang::OMPVarListClause::varlists
varlist_range varlists()
Definition: OpenMPClause.h:232
clang::interp::This
bool This(InterpState &S, CodePtr OpPC)
Definition: Interp.h:827
clang::ImplicitValueInitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Expr.h:5131
clang::Sema::FPContractStateRAII
Records and restores the FP_CONTRACT state on entry/exit of compound statements.
Definition: Sema.h:1300
clang::Sema::computeDeclContext
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Definition: SemaCXXScopeSpec.cpp:53
clang::TypeTraitExpr::getNumArgs
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2676
clang::EST_Dynamic
throw(T1, T2)
Definition: ExceptionSpecificationType.h:23
clang::FunctionProtoType::ExtProtoInfo
Extra information about a function prototype.
Definition: Type.h:3837
OMPDefaultmapClause
This represents &#39;defaultmap&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5668
clang::CXXRewrittenBinaryOperator::getDecomposedForm
DecomposedForm getDecomposedForm() const LLVM_READONLY
Decompose this operator into its syntactic form.
Definition: ExprCXX.cpp:63
clang::CoroutineBodyStmt::getResultDecl
Stmt * getResultDecl() const
Definition: StmtCXX.h:412
clang::TreeTransform::TransformDependentScopeDeclRefExpr
ExprResult TransformDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI)
Definition: TreeTransform.h:11489
clang::PointerTypeLoc::getStarLoc
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1229
OMPMappableExprListClause
This represents clauses with a list of expressions that are mappable.
Definition: OpenMPClause.h:4313
clang::DeducedTemplateSpecializationType
Represents a C++17 deduced template specialization type.
Definition: Type.h:4940
clang::TreeTransform::InventTypeSourceInfo
TypeSourceInfo * InventTypeSourceInfo(QualType T)
Fakes up a TypeSourceInfo for a type.
Definition: TreeTransform.h:612
clang::AbstractConditionalOperator::getColonLoc
SourceLocation getColonLoc() const
Definition: Expr.h:3722
clang::TemplateName::getAsQualifiedTemplateName
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Definition: TemplateName.cpp:146
clang::TemplateSpecializationTypeLoc
Definition: TypeLoc.h:1574
clang::TreeTransform::RebuildObjCAtSynchronizedOperand
ExprResult RebuildObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *object)
Rebuild the operand to an Objective-C @synchronized statement.
Definition: TreeTransform.h:2023
clang::TreeTransform::RebuildOMPAlignedClause
OMPClause * RebuildOMPAlignedClause(ArrayRef< Expr *> VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;aligned&#39; clause.
Definition: TreeTransform.h:1770
clang::ObjCIsaExpr::isArrow
bool isArrow() const
Definition: ExprObjC.h:1520
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
clang::ObjCMessageExpr::getLeftLoc
SourceLocation getLeftLoc() const
Definition: ExprObjC.h:1416
clang::TreeTransform::RebuildOMPThreadLimitClause
OMPClause * RebuildOMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;thread_limit&#39; clause.
Definition: TreeTransform.h:1884
clang::ObjCObjectTypeLoc::getProtocolLocs
ArrayRef< SourceLocation > getProtocolLocs() const
Definition: TypeLoc.h:990
clang::Sema::CXXThisScopeRAII
RAII object used to temporarily allow the C++ &#39;this&#39; expression to be used, with the given qualifiers...
Definition: Sema.h:5616
clang::ASTTemplateArgumentListInfo
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:603
clang::OMPIfClause::getColonLoc
SourceLocation getColonLoc() const
Return the location of &#39;:&#39;.
Definition: OpenMPClause.h:490
clang::OverloadExpr::getName
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2953
clang::DeclContextLookupResult::front
reference front() const
Definition: DeclBase.h:1242
clang::CXXStdInitializerListExpr
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:715
clang::ElaboratedTypeLoc::getNamedTypeLoc
TypeLoc getNamedTypeLoc() const
Definition: TypeLoc.h:2125
clang::Decl::isInvalidDecl
bool isInvalidDecl() const
Definition: DeclBase.h:553
clang::IfStmt::getThen
Stmt * getThen()
Definition: Stmt.h:1921
clang::IfStmt::getIfLoc
SourceLocation getIfLoc() const
Definition: Stmt.h:1993
clang::DependentAddressSpaceTypeLoc::setAttrOperandParensRange
void setAttrOperandParensRange(SourceRange range)
Definition: TypeLoc.h:1714
clang::ObjCTypeParamTypeLoc::setProtocolRAngleLoc
void setProtocolRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:784
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
clang::CapturedDecl::getContextParamPosition
unsigned getContextParamPosition() const
Definition: Decl.h:4300
clang::CXXNewExpr::getNumPlacementArgs
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2236
clang::UnaryExprOrTypeTraitExpr::getArgumentTypeInfo
TypeSourceInfo * getArgumentTypeInfo() const
Definition: Expr.h:2412
clang::UnresolvedLookupExpr::requiresADL
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:3105
OMPFlushClause
This represents implicit clause &#39;flush&#39; for the &#39;#pragma omp flush&#39; directive.
Definition: OpenMPClause.h:3885
StmtObjC.h
Defines the Objective-C statement AST node classes.
clang::OffsetOfNode::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range that covers this offsetof node.
Definition: Expr.h:2248
clang::OMPReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:2602
clang::Sema::BuildTypeRequirement
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
Definition: SemaExprCXX.cpp:8472
SemaInternal.h
clang::NestedNameSpecifier::getKind
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Definition: NestedNameSpecifier.cpp:142
clang::CXXInheritedCtorInitExpr::getConstructor
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition: ExprCXX.h:1648
clang::tooling::fixit::internal::getSourceRange
CharSourceRange getSourceRange(const SourceRange &Range)
Returns the token CharSourceRange corresponding to Range.
Definition: FixIt.h:32
clang::AdjustedTypeLoc
Definition: TypeLoc.h:1159
clang::CXXThrowExpr
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1140
clang::CXXTypeidExpr::getExprOperand
Expr * getExprOperand() const
Definition: ExprCXX.h:821
clang::ExprWithCleanups
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3306
clang::OMPReverseOffloadClause
This represents &#39;reverse_offload&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
Definition: OpenMPClause.h:1107
clang::TreeTransform::TransformTemplateArguments
bool TransformTemplateArguments(const TemplateArgumentLoc *Inputs, unsigned NumInputs, TemplateArgumentListInfo &Outputs, bool Uneval=false)
Transform the given set of template arguments.
Definition: TreeTransform.h:579
clang::TypeTraitExpr::getArg
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2679
clang::TreeTransform::RebuildParenListExpr
ExprResult RebuildParenListExpr(SourceLocation LParenLoc, MultiExprArg SubExprs, SourceLocation RParenLoc)
Build a new expression list in parentheses.
Definition: TreeTransform.h:2509
clang::MultiVersionKind::Target
clang::DependentAddressSpaceTypeLoc::getAttrExprOperand
Expr * getAttrExprOperand() const
The attribute&#39;s expression operand, if it has one.
Definition: TypeLoc.h:1700
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1595
clang::ObjCBoxedExpr::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:160
clang::SubstTemplateTypeParmType
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:4728
clang::TemplateArgumentLocContainerIterator::operator++
TemplateArgumentLocContainerIterator operator++(int)
Definition: TreeTransform.h:6068
clang::DependentVectorTypeLoc
Definition: TypeLoc.h:1758
clang::GenericSelectionExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:5487
ExprCXX.h
Defines the clang::Expr interface and subclasses for C++ expressions.
clang::ActionResult::isUnset
bool isUnset() const
Definition: Ownership.h:168
OMPPriorityClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5281
clang::ElaboratedTypeLoc::setQualifierLoc
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:2105
clang::TreeTransform::RebuildDesignatedInitExpr
ExprResult RebuildDesignatedInitExpr(Designation &Desig, MultiExprArg ArrayExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
Build a new designated initializer expression.
Definition: TreeTransform.h:2470
OMPGrainsizeClause::getGrainsize
Expr * getGrainsize() const
Return safe iteration space distance.
Definition: OpenMPClause.h:5355
OMPNogroupClause
This represents &#39;nogroup&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5380
clang::TypeSpecTypeLoc
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
Definition: TypeLoc.h:513
clang::Qualifiers
The collection of all-type qualifiers we support.
Definition: Type.h:143
clang::CXXInheritedCtorInitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:1665
clang::LambdaExpr::getLambdaClass
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Definition: ExprCXX.cpp:1283
clang::ObjCObjectTypeLoc::setTypeArgTInfo
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
Definition: TypeLoc.h:949
clang::OMPAllocatorClause
This represents &#39;allocator&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:266
clang::ChooseExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4182
clang::OMPSafelenClause
This represents &#39;safelen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:670
clang::ObjCPropertyRefExpr::getExplicitProperty
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:707
clang::PipeType
PipeType - OpenCL20.
Definition: Type.h:6159
clang::BuiltinTypeLoc::needsExtraLocalData
bool needsExtraLocalData() const
Definition: TypeLoc.h:582
clang::CXXStaticCastExpr
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:409
clang::OMPProcBindClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:987
clang::TreeTransform::RebuildCXXNoexceptExpr
ExprResult RebuildCXXNoexceptExpr(SourceRange Range, Expr *Arg)
Build a new noexcept expression.
Definition: TreeTransform.h:3034
clang::CXXUuidofExpr::getExprOperand
Expr * getExprOperand() const
Definition: ExprCXX.h:1046
clang::Type::canHaveNullability
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type.
Definition: Type.cpp:3841
clang::CXXUuidofExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:1060
clang::ObjCAutoreleasePoolStmt::getSubStmt
const Stmt * getSubStmt() const
Definition: StmtObjC.h:379
clang::DependentSizedExtVectorType::getAttributeLoc
SourceLocation getAttributeLoc() const
Definition: Type.h:3212
clang::NamedDecl::getIdentifier
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:244
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::CXXNamedCastExpr::getRParenLoc
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
Definition: ExprCXX.h:386
clang::LabelStmt
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1732
clang::AtomicExpr::AtomicOp
AtomicOp
Definition: Expr.h:5851
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3748
clang::TreeTransform
A semantic tree transformation that allows one to transform one abstract syntax tree into another...
Definition: TreeTransform.h:99
clang::DesignatedInitExpr
Represents a C99 designated initializer expression.
Definition: Expr.h:4639
clang::OMPVarListClause::varlist_size
unsigned varlist_size() const
Definition: OpenMPClause.h:229
clang::ConceptReference::getFoundDecl
NamedDecl * getFoundDecl() const
Definition: ASTConcept.h:150
clang::TreeTransform::RebuildDependentNameType
QualType RebuildDependentNameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo *Id, SourceLocation IdLoc, bool DeducedTSTContext)
Build a new typename type that refers to an identifier.
Definition: TreeTransform.h:1055
clang::NamedDecl::getDeclName
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:272
clang::ObjCEncodeExpr::getEncodedTypeSourceInfo
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition: ExprObjC.h:430
clang::CXXRewrittenBinaryOperator::getSemanticForm
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition: ExprCXX.h:293
clang::TypeOfTypeLoc
Definition: TypeLoc.h:1858
clang::CXXPseudoDestructorExpr::getScopeTypeInfo
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2556
clang::CoreturnStmt::getKeywordLoc
SourceLocation getKeywordLoc() const
Definition: StmtCXX.h:476
OMPNumTeamsClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5130
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:57
clang::DoStmt::getBody
Stmt * getBody()
Definition: Stmt.h:2379
clang::FunctionTypeLoc::setLocalRangeEnd
void setLocalRangeEnd(SourceLocation L)
Definition: TypeLoc.h:1382
clang::CXXPseudoDestructorExpr::getTildeLoc
SourceLocation getTildeLoc() const
Retrieve the location of the &#39;~&#39;.
Definition: ExprCXX.h:2563
clang::AtomicExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:5940
Step
Step
Definition: OpenMPClause.h:151
clang::SourceLocExpr
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
Definition: Expr.h:4295
clang::ObjCDictionaryElement
An element in an Objective-C dictionary literal.
Definition: ExprObjC.h:261
clang::RequiresExpr
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:457
clang::OMPParallelDirective
This represents &#39;#pragma omp parallel&#39; directive.
Definition: StmtOpenMP.h:357
clang::CharSourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:280
clang::ShuffleVectorExpr
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3999
clang::OMPTaskReductionClause::getColonLoc
SourceLocation getColonLoc() const
Gets location of &#39;:&#39; symbol in clause.
Definition: OpenMPClause.h:2833
clang::TreeTransform::RebuildCStyleCastExpr
ExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *SubExpr)
Build a new C-style cast expression.
Definition: TreeTransform.h:2416
clang::ObjCObjectType
Represents a class type in Objective C.
Definition: Type.h:5694
clang::ParenExpr::getRParen
SourceLocation getRParen() const
Get the location of the right parentheses &#39;)&#39;.
Definition: Expr.h:2022
clang::TemplateArgument::getAsExpr
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:329
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:236
clang::DesignatedInitExpr::getInit
Expr * getInit() const
Retrieve the initializer value.
Definition: Expr.h:4877
clang::TreeTransform::RebuildObjCAtThrowStmt
StmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Operand)
Build a new Objective-C @throw statement.
Definition: TreeTransform.h:1503
clang::TreeTransform::TransformDecl
Decl * TransformDecl(SourceLocation Loc, Decl *D)
Transform the given declaration, which is referenced from a type or expression.
Definition: TreeTransform.h:431
clang::DependentTemplateName
Represents a dependent template name that cannot be resolved prior to template instantiation.
Definition: TemplateName.h:446
clang::ExprEmpty
ExprResult ExprEmpty()
Definition: Ownership.h:285
llvm::Optional< unsigned >
clang::FunctionProtoType::getParamTypes
ArrayRef< QualType > getParamTypes() const
Definition: Type.h:3971
clang::DeclContextLookupResult
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1195
OMPSIMDClause
This represents &#39;simd&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4200
clang::Type::isObjCLifetimeType
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
Definition: Type.cpp:4080
clang::TemplateArgumentLoc::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: TemplateBase.h:506
clang::ParenTypeLoc::getInnerLoc
TypeLoc getInnerLoc() const
Definition: TypeLoc.h:1142
clang::FunctionDecl::getConstexprKind
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2206
clang::Sema::BuildParenType
QualType BuildParenType(QualType T)
Build a paren type including T.
Definition: SemaType.cpp:1892
clang::BuiltinTypeLoc::setBuiltinLoc
void setBuiltinLoc(SourceLocation Loc)
Definition: TypeLoc.h:559
clang::CXXPseudoDestructorExpr::getBase
Expr * getBase() const
Definition: ExprCXX.h:2522
clang::TreeTransform::transformAttrs
void transformAttrs(Decl *Old, Decl *New)
Transform the attributes associated with the given declaration and place them on the new declaration...
Definition: TreeTransform.h:453
clang::TemplateSpecializationTypeLoc::setArgLocInfo
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
Definition: TypeLoc.h:1608
clang::TreeTransform::RebuildInitList
ExprResult RebuildInitList(SourceLocation LBraceLoc, MultiExprArg Inits, SourceLocation RBraceLoc)
Build a new initializer list expression.
Definition: TreeTransform.h:2460
clang::TemplateName::getAsTemplateDecl
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Definition: TemplateName.cpp:99
clang::TemplateArgumentLocInventIterator::value_type
TemplateArgumentLoc value_type
Definition: TreeTransform.h:4144
clang::TypeOfTypeLoc::getUnderlyingTInfo
TypeSourceInfo * getUnderlyingTInfo() const
Definition: TypeLoc.h:1865
clang::ObjCPropertyRefExpr::isExplicitProperty
bool isExplicitProperty() const
Definition: ExprObjC.h:705
clang::ReferenceType::isSpelledAsLValue
bool isSpelledAsLValue() const
Definition: Type.h:2766
clang::AddrLabelExpr::getAmpAmpLoc
SourceLocation getAmpAmpLoc() const
Definition: Expr.h:3924
clang::ArrayTypeLoc::setRBracketLoc
void setRBracketLoc(SourceLocation Loc)
Definition: TypeLoc.h:1501
clang::TypeLocBuilder::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Definition: TypeLocBuilder.h:101
clang::ASTContext::getDependentNameType
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
Definition: ASTContext.cpp:4505
clang::Stmt::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:275
clang::DeclarationName::getNameKind
NameKind getNameKind() const
Determine what kind of name this is.
Definition: DeclarationName.h:384
clang::OpenMPLinearClauseKind
OpenMPLinearClauseKind
OpenMP attributes for &#39;linear&#39; clause.
Definition: OpenMPKinds.h:110
clang::DeclStmt::getEndLoc
SourceLocation getEndLoc() const
Definition: Stmt.h:1248
clang::Sema::isAcceptableTagRedeclaration
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
Definition: SemaDecl.cpp:14654
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2729
clang::TemplateSpecializationType::getTemplateName
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:5059
clang::OMPLastprivateClause
This represents clause &#39;lastprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2132
clang::TreeTransform::RebuildGCCAsmStmt
StmtResult RebuildGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
Build a new inline asm statement.
Definition: TreeTransform.h:1385
clang::TreeTransform::RebuildObjCAtFinallyStmt
StmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Build a new Objective-C @finally statement.
Definition: TreeTransform.h:1494
clang::TemplateName::getAsSubstTemplateTemplateParmPack
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Definition: TemplateName.cpp:138
clang::UnresolvedMemberExpr::getBase
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3848
clang::OMPAllocateClause
This represents clause &#39;allocate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:328
clang::NoInitExpr
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4937
clang::SEHFinallyStmt
Definition: Stmt.h:3249
clang::TreeTransform::RebuildAutoType
QualType RebuildAutoType(QualType Deduced, AutoTypeKeyword Keyword, ConceptDecl *TypeConstraintConcept, ArrayRef< TemplateArgument > TypeConstraintArgs)
Build a new C++11 auto type.
Definition: TreeTransform.h:954
clang::ParenTypeLoc
Definition: TypeLoc.h:1113
clang::UserDefinedLiteral::getBeginLoc
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:622
clang::CXXTemporaryObjectExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.cpp:1064
clang::CoroutineBodyStmt::getPromiseDecl
VarDecl * getPromiseDecl() const
Definition: StmtCXX.h:385
clang::MSAsmStmt::getAllExprs
ArrayRef< Expr * > getAllExprs() const
Definition: Stmt.h:3177
clang::TemplateArgumentListInfo::size
unsigned size() const
Definition: TemplateBase.h:576
clang::ParmVarDecl::getFunctionScopeIndex
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1652
clang::OMPCollapseClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:832
clang::CompoundStmt::getStmtExprResult
Stmt * getStmtExprResult()
Definition: Stmt.h:1424
clang::UnaryExprOrTypeTrait
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:96
clang::LambdaExpr::getBody
CompoundStmt * getBody() const
Retrieve the body of the lambda.
Definition: ExprCXX.cpp:1307
clang::ObjCObjectTypeLoc::getProtocolLAngleLoc
SourceLocation getProtocolLAngleLoc() const
Definition: TypeLoc.h:954
clang::Sema::ActOnDesignatedInitializer
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:3126
clang::OffsetOfNode::getArrayExprIndex
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2221
clang::AddrLabelExpr::getLabelLoc
SourceLocation getLabelLoc() const
Definition: Expr.h:3926
clang::DependentNameTypeLoc::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:2159
clang::MemberExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
Definition: Expr.h:2980
clang::Sema::StartOpenMPDSABlock
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
Definition: SemaOpenMP.cpp:2215
OMPDistScheduleClause::getChunkSize
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:5634
clang::InitListExpr::getRBraceLoc
SourceLocation getRBraceLoc() const
Definition: Expr.h:4552
clang::UnaryExprOrTypeTraitExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Definition: Expr.h:2439
clang::TreeTransform::RebuildParenType
QualType RebuildParenType(QualType InnerType)
Build a new parenthesized type.
Definition: TreeTransform.h:987
clang::DeclarationNameInfo::setName
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
Definition: DeclarationName.h:716
clang::GNUNullExpr
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4210
clang::Type::isReferenceType
bool isReferenceType() const
Definition: Type.h:6516
OMPMapClause
This represents clause &#39;map&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:4833
clang::TreeTransform::RebuildAttributedStmt
StmtResult RebuildAttributedStmt(SourceLocation AttrLoc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
Build a new label statement.
Definition: TreeTransform.h:1277
clang::CStyleCastExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:3400
clang::OMPDefaultClause::getDefaultKindKwLoc
SourceLocation getDefaultKindKwLoc() const
Returns location of clause kind.
Definition: OpenMPClause.h:912
clang::DependentNameTypeLoc::setElaboratedKeywordLoc
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:2155
OMPToClause
This represents clause &#39;to&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:5781
clang::concepts::ExprRequirement::ReturnTypeRequirement
Definition: ExprConcepts.h:250
clang::TreeTransform::TransformExpr
ExprResult TransformExpr(Expr *E)
Transform the given expression.
Definition: TreeTransform.h:3508
clang::ObjCObjectTypeLoc::getProtocolRAngleLoc
SourceLocation getProtocolRAngleLoc() const
Definition: TypeLoc.h:962
clang::FixedPointLiteral
Definition: Expr.h:1489
ScopeInfo.h
clang::OMPTargetSimdDirective
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:3895
clang::OpaqueValueExpr::getSourceExpr
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1133
clang::Sema::ConditionResult::isInvalid
bool isInvalid() const
Definition: Sema.h:11013
TypeLocBuilder.h
clang::UnresolvedMemberExpr
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3771
clang::UnresolvedUsingTypeLoc
Wrapper for source info for unresolved typename using decls.
Definition: TypeLoc.h:692
clang::ObjCProtocolQualifiers::qual_begin
qual_iterator qual_begin() const
Definition: Type.h:5595
clang::FunctionTypeLoc::getRParenLoc
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1394
clang::TreeTransform::RebuildCXXThrowExpr
ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub, bool IsThrownVariableInScope)
Build a new C++ throw expression.
Definition: TreeTransform.h:2772
clang::Sema::ConditionResult::get
std::pair< VarDecl *, Expr * > get() const
Definition: Sema.h:11014
clang::ExtVectorElementExpr
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5518
clang::ObjCTypeParamTypeLoc::getProtocolLocs
ArrayRef< SourceLocation > getProtocolLocs() const
Definition: TypeLoc.h:807
clang::LookupResult::getResultKind
LookupResultKind getResultKind() const
Definition: Lookup.h:321
clang::OMPExecutableDirective::getDirectiveKind
OpenMPDirectiveKind getDirectiveKind() const
Definition: StmtOpenMP.h:301
clang::OMPSafelenClause::getSafelen
Expr * getSafelen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:704
clang::TreeTransform::RebuildOMPCollapseClause
OMPClause * RebuildOMPCollapseClause(Expr *Num, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;collapse&#39; clause.
Definition: TreeTransform.h:1594
clang::CastExpr::getSubExpr
Expr * getSubExpr()
Definition: Expr.h:3202
clang::UnaryTransformTypeLoc::setUnderlyingTInfo
void setUnderlyingTInfo(TypeSourceInfo *TInfo)
Definition: TypeLoc.h:1909
clang::OMPBarrierDirective
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:2101
clang::AbstractConditionalOperator::getQuestionLoc
SourceLocation getQuestionLoc() const
Definition: Expr.h:3721
clang::ObjCArrayLiteral
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:188
clang::TreeTransform::ExpandingFunctionParameterPack
void ExpandingFunctionParameterPack(ParmVarDecl *Pack)
Note to the derived class when a function parameter pack is being expanded.
Definition: TreeTransform.h:290
clang::TemplateArgumentLoc::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: TemplateBase.cpp:469
OMPNumTeamsClause::getNumTeams
Expr * getNumTeams()
Return NumTeams number.
Definition: OpenMPClause.h:5133
clang::SubstNonTypeTemplateParmPackExpr
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4269
clang::ArraySubscriptExpr::getRHS
Expr * getRHS()
Definition: Expr.h:2501
clang::SEHTryStmt
Definition: Stmt.h:3284
clang::TreeTransform::RebuildObjCBoxedExpr
ExprResult RebuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
Build a new Objective-C boxed expression.
Definition: TreeTransform.h:3133
clang::OMPCriticalDirective
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1640
clang::concepts::ExprRequirement::isSimple
bool isSimple() const
Definition: ExprConcepts.h:346
clang::LambdaExpr::getCaptureDefault
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
Definition: ExprCXX.h:1889
clang::CXXRecordDecl::hasKnownLambdaInternalLinkage
bool hasKnownLambdaInternalLinkage() const
The lambda is known to has internal linkage no matter whether it has name mangling number...
Definition: DeclCXX.h:1712
llvm::SmallVectorImpl
Definition: LLVM.h:36
clang::TreeTransform::RebuildObjCAtSynchronizedStmt
StmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *Object, Stmt *Body)
Build a new Objective-C @synchronized statement.
Definition: TreeTransform.h:2032
clang::DependentScopeDeclRefExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition: ExprCXX.h:3243
clang::TreeTransform::RebuildObjCAutoreleasePoolStmt
StmtResult RebuildObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Build a new Objective-C @autoreleasepool statement.
Definition: TreeTransform.h:2041
clang::TypeofLikeTypeLoc::getLParenLoc
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1808
clang::ASTContext::Idents
IdentifierTable & Idents
Definition: ASTContext.h:580
clang::QualType::getLocalQualifiers
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Definition: Type.h:6275
clang::CXXCatchStmt::getCatchLoc
SourceLocation getCatchLoc() const
Definition: StmtCXX.h:48
clang::VK_RValue
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:125
clang::TreeTransform::RebuildOMPFlushClause
OMPClause * RebuildOMPFlushClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;flush&#39; pseudo clause.
Definition: TreeTransform.h:1807
StmtCXX.h
clang::TreeTransform::TryExpandParameterPacks
bool TryExpandParameterPacks(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we should expand a pack expansion with the given set of parameter packs into separa...
Definition: TreeTransform.h:262
clang::Sema::ActOnAttributedStmt
StmtResult ActOnAttributedStmt(SourceLocation AttrLoc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
Definition: SemaStmt.cpp:540
clang::ObjCAtCatchStmt
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
clang::CXXFoldExpr::getLHS
Expr * getLHS() const
Definition: ExprCXX.h:4557
clang::LookupResult::getAsSingle
DeclClass * getAsSingle() const
Definition: Lookup.h:507
clang::MSPropertySubscriptExpr::getIdx
Expr * getIdx()
Definition: ExprCXX.h:966
OMPCopyprivateClause
This represents clause &#39;copyprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3718
clang::OpenMPDistScheduleClauseKind
OpenMPDistScheduleClauseKind
OpenMP attributes for &#39;dist_schedule&#39; clause.
Definition: OpenMPKinds.h:151
clang::TypeLocBuilder
Definition: TypeLocBuilder.h:22
clang::IndirectGotoStmt
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2520
clang::CXXConstructExpr::getArgs
Expr ** getArgs()
Definition: ExprCXX.h:1564
clang::InitListExpr
Describes an C or C++ initializer list.
Definition: Expr.h:4403
clang::TemplateSpecializationTypeLoc::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: TypeLoc.h:1588
clang::CXXTypeidExpr
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:764
OMPMapClause::getMapTypeModifiersLoc
ArrayRef< SourceLocation > getMapTypeModifiersLoc() const LLVM_READONLY
Fetches ArrayRef of location of map-type-modifiers.
Definition: OpenMPClause.h:5043
clang::OMPDistributeParallelForDirective
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3606
clang::TreeTransform::TemporaryBase::~TemporaryBase
~TemporaryBase()
Definition: TreeTransform.h:199
clang::TreeTransform::RebuildExceptionDecl
VarDecl * RebuildExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *Declarator, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Build a new C++ exception declaration.
Definition: TreeTransform.h:2069
clang::ObjCIvarRefExpr::isArrow
bool isArrow() const
Definition: ExprObjC.h:584
clang::ObjCTypeParamTypeLoc::setProtocolLoc
void setProtocolLoc(unsigned i, SourceLocation Loc)
Definition: TypeLoc.h:797
clang::ObjCSubscriptRefExpr::getKeyExpr
Expr * getKeyExpr() const
Definition: ExprObjC.h:893
clang::OMPTeamsDistributeParallelForSimdDirective
This represents &#39;#pragma omp teams distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:4100
clang::BinaryOperatorKind
BinaryOperatorKind
Definition: OperationKinds.h:25
clang::UnqualifiedId
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:960
clang::NestedNameSpecifier::getAsRecordDecl
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
Definition: NestedNameSpecifier.cpp:184
clang::UnresolvedUsingType::getDecl
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4221
clang::CXXNewExpr::getArraySize
Optional< Expr * > getArraySize()
Definition: ExprCXX.h:2225
clang::NestedNameSpecifier::getAsIdentifier
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
Definition: NestedNameSpecifier.h:174
clang::AtomicTypeLoc::setLParenLoc
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:2381
clang::ForStmt
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:2410
clang::LookupResult::resolveKind
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
Definition: SemaLookup.cpp:475
clang::AttributedTypeLoc::setAttr
void setAttr(const Attr *A)
Definition: TypeLoc.h:876
clang::TypeSpecTypeLoc::setNameLoc
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:527
clang::LookupResult
Represents the results of name lookup.
Definition: Lookup.h:46
clang::ActionResult::get
PtrTy get() const
Definition: Ownership.h:170
clang::OMPInReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:3084
clang::TreeTransform::RebuildMemberExpr
ExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc, bool isArrow, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, ValueDecl *Member, NamedDecl *FoundDecl, const TemplateArgumentListInfo *ExplicitTemplateArgs, NamedDecl *FirstQualifierInScope)
Build a new member access expression.
Definition: TreeTransform.h:2324
clang::TreeTransform::RebuildUnaryExprOrTypeTrait
ExprResult RebuildUnaryExprOrTypeTrait(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a new sizeof, alignof or vec_step expression with a type argument.
Definition: TreeTransform.h:2260
clang::AtomicTypeLoc::getLParenLoc
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:2377
clang::TreeTransform::RebuildOMPDefaultClause
OMPClause * RebuildOMPDefaultClause(OpenMPDefaultClauseKind Kind, SourceLocation KindKwLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;default&#39; clause.
Definition: TreeTransform.h:1605
clang::CXXDeleteExpr::getOperatorDelete
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2399
clang::MacroQualifiedTypeLoc::setExpansionLoc
void setExpansionLoc(SourceLocation Loc)
Definition: TypeLoc.h:1097
clang::TemplateArgumentLocInventIterator::operator!=
friend bool operator!=(const TemplateArgumentLocInventIterator &X, const TemplateArgumentLocInventIterator &Y)
Definition: TreeTransform.h:4189
clang::ObjCSubscriptRefExpr::getBaseExpr
Expr * getBaseExpr() const
Definition: ExprObjC.h:890
clang::TreeTransform::RebuildOMPScheduleClause
OMPClause * RebuildOMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;schedule&#39; clause.
Definition: TreeTransform.h:1631
clang::CXXConstructExpr::isElidable
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1500
clang::DependentTemplateSpecializationTypeLoc::setRAngleLoc
void setRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2268
clang::CXXNoexceptExpr::getOperand
Expr * getOperand() const
Definition: ExprCXX.h:3978
clang::ObjCAtThrowStmt::getThrowExpr
const Expr * getThrowExpr() const
Definition: StmtObjC.h:344
clang::InjectedClassNameTypeLoc
Wrapper for source info for injected class names of class templates.
Definition: TypeLoc.h:681
clang::LCK_ByCopy
< Capturing the *this object by copy
Definition: Lambda.h:36
OMPDefaultmapClause::getDefaultmapKindLoc
SourceLocation getDefaultmapKindLoc()
Get kind location.
Definition: OpenMPClause.h:5746
clang::CXXNewExpr::isGlobalNew
bool isGlobalNew() const
Definition: ExprCXX.h:2259
clang::ObjCTypeParamTypeLoc::getNumProtocols
unsigned getNumProtocols() const
Definition: TypeLoc.h:788
clang::DeclarationNameLoc::CXXOpName::BeginOpNameLoc
unsigned BeginOpNameLoc
Definition: DeclarationName.h:663
clang::ObjCObjectTypeLoc::getProtocolLoc
SourceLocation getProtocolLoc(unsigned i) const
Definition: TypeLoc.h:974
clang::PointerLikeTypeLoc::getSigilLoc
SourceLocation getSigilLoc() const
Definition: TypeLoc.h:1200
clang::TemplateArgumentListInfo
A convenient class for passing around template argument information.
Definition: TemplateBase.h:554
clang::RequiresExpr::getRequiresKWLoc
SourceLocation getRequiresKWLoc() const
Definition: ExprConcepts.h:512
clang::PseudoDestructorTypeStorage::getLocation
SourceLocation getLocation() const
Definition: ExprCXX.h:2452
clang::TreeTransform::RebuildOMPPrivateClause
OMPClause * RebuildOMPPrivateClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;private&#39; clause.
Definition: TreeTransform.h:1655
clang::concepts::NestedRequirement::getConstraintExpr
Expr * getConstraintExpr() const
Definition: ExprConcepts.h:430
clang::LabelStmt::getDecl
LabelDecl * getDecl() const
Definition: Stmt.h:1749
clang::TreeTransform::RebuildBuiltinBitCastExpr
ExprResult RebuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Sub, SourceLocation RParenLoc)
Build a new C++ __builtin_bit_cast expression.
Definition: TreeTransform.h:2702
clang::CXXFoldExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:4585
clang::CompoundStmt::getLBracLoc
SourceLocation getLBracLoc() const
Definition: Stmt.h:1439
clang::TreeTransform::RebuildRecordType
QualType RebuildRecordType(RecordDecl *Record)
Build a new class/struct/union type.
Definition: TreeTransform.h:920
clang::CXXForRangeStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: StmtCXX.h:204
clang::CXXNewExpr::getInitializer
Expr * getInitializer()
The initializer of this new-expression.
Definition: ExprCXX.h:2275
clang::ComparisonCategoryType::First
clang::TreeTransform::RebuildArrayType
QualType RebuildArrayType(QualType ElementType, ArrayType::ArraySizeModifier SizeMod, const llvm::APInt *Size, Expr *SizeExpr, unsigned IndexTypeQuals, SourceRange BracketsRange)
Build a new array type given the element type, size modifier, size of the array (if known)...
Definition: TreeTransform.h:13213
clang::ObjCIsaExpr::getIsaMemberLoc
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of &#39;F&#39;...
Definition: ExprObjC.h:1525
clang::TreeTransform::SemaRef
Sema & SemaRef
Definition: TreeTransform.h:118
clang::OverloadExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition: ExprCXX.h:2969
clang::ForStmt::getBody
Stmt * getBody()
Definition: Stmt.h:2444
clang::DependentNameTypeLoc::getElaboratedKeywordLoc
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:2151
clang::NestedNameSpecifier::getAsNamespaceAlias
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Definition: NestedNameSpecifier.cpp:176
clang::TreeTransform::RebuildCXXDefaultArgExpr
ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, ParmVarDecl *Param)
Build a new C++ default-argument expression.
Definition: TreeTransform.h:2782
clang::SubstTemplateTypeParmPackTypeLoc
Wrapper for substituted template type parameters.
Definition: TypeLoc.h:840
clang::AutoType::isConstrained
bool isConstrained() const
Definition: Type.h:4912
clang::Sema::BuildNestedRequirement
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
Definition: SemaExprCXX.cpp:8487
clang::StmtError
StmtResult StmtError()
Definition: Ownership.h:280
clang::Type::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1896
clang::sema::BlockScopeInfo::FunctionType
QualType FunctionType
BlockType - The function type of the block, if one was given.
Definition: ScopeInfo.h:726
clang::CXXDependentScopeMemberExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3713
clang::TypeDecl
Represents a declaration of a type.
Definition: Decl.h:3029
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3434
clang::SubstTemplateTypeParmTypeLoc
Wrapper for substituted template type parameters.
Definition: TypeLoc.h:833
clang::ASTTemplateArgumentListInfo::RAngleLoc
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:617
clang::OMPReductionClause::getColonLoc
SourceLocation getColonLoc() const
Gets location of &#39;:&#39; symbol in clause.
Definition: OpenMPClause.h:2599
clang::CXXInheritedCtorInitExpr::constructsVBase
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1652
clang::Qualifiers::getAddressSpace
LangAS getAddressSpace() const
Definition: Type.h:359
clang::ForStmt::getInit
Stmt * getInit()
Definition: Stmt.h:2423
clang::UnresolvedSetImpl
A set of unresolved declarations.
Definition: UnresolvedSet.h:61
clang::GCCAsmStmt::getOutputExpr
Expr * getOutputExpr(unsigned i)
Definition: Stmt.cpp:440
clang::FunctionTypeLoc::getLParenLoc
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1386
clang::TypeofLikeTypeLoc::setRParenLoc
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1820
clang::TreeTransform::RebuildAtomicExpr
ExprResult RebuildAtomicExpr(SourceLocation BuiltinLoc, MultiExprArg SubExprs, AtomicExpr::AtomicOp Op, SourceLocation RParenLoc)
Build a new atomic operation expression.
Definition: TreeTransform.h:3423
clang::CXXThrowExpr::getThrowLoc
SourceLocation getThrowLoc() const
Definition: ExprCXX.h:1165
clang::GCCAsmStmt::getInputConstraintLiteral
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:3007
clang::TemplateArgumentLocContainerIterator::operator++
TemplateArgumentLocContainerIterator & operator++()
Definition: TreeTransform.h:6063
clang::MemberPointerType::getClass
const Type * getClass() const
Definition: Type.h:2867
clang::CXXForRangeStmt
CXXForRangeStmt - This represents C++0x [stmt.ranged]&#39;s ranged for statement, represented as &#39;for (ra...
Definition: StmtCXX.h:134
ExprObjC.h
clang::InjectedClassNameType::getDecl
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3386
clang::TreeTransform::RebuildOMPNumTasksClause
OMPClause * RebuildOMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;num_tasks&#39; clause.
Definition: TreeTransform.h:1918
clang::MemberExpr::isArrow
bool isArrow() const
Definition: Expr.h:3020
clang::ConceptReference::getNamedConcept
ConceptDecl * getNamedConcept() const
Definition: ASTConcept.h:154
clang::TreeTransform::RebuildPackExpansionType
QualType RebuildPackExpansionType(QualType Pattern, SourceRange PatternRange, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Build a new pack expansion type.
Definition: TreeTransform.h:1152
clang::OMPCancellationPointDirective
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:2946
clang::TreeTransform::setBase
void setBase(SourceLocation Loc, DeclarationName Entity)
Sets the "base" location and entity when that information is known based on another transformation...
Definition: TreeTransform.h:180
clang::OMPDefaultClause
This represents &#39;default&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:862
clang::Expr::IgnoreParenCasts
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
Definition: Expr.cpp:2995
clang::ObjCStringLiteral
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:50
clang::TemplateArgumentLocContainerIterator::iterator_category
std::input_iterator_tag iterator_category
Definition: TreeTransform.h:6043
clang::DesignatedInitExpr::getEqualOrColonLoc
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the &#39;=&#39; that precedes the initializer value itself, if present.
Definition: Expr.h:4864
clang::DependentTemplateSpecializationTypeLoc::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Definition: TypeLoc.h:2240
clang::CXXDependentScopeMemberExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: ExprCXX.h:3681
clang::CXXFoldExpr::getRHS
Expr * getRHS() const
Definition: ExprCXX.h:4558
clang::VariableArrayType::getSizeExpr
Expr * getSizeExpr() const
Definition: Type.h:3058
clang::CUDAKernelCallExpr::getConfig
const CallExpr * getConfig() const
Definition: ExprCXX.h:247
clang::MSPropertyRefExpr::isArrow
bool isArrow() const
Definition: ExprCXX.h:921
clang::ObjCInterfaceTypeLoc
Wrapper for source info for ObjC interfaces.
Definition: TypeLoc.h:1040
clang::CXXOperatorCallExpr::getFPFeatures
FPOptions getFPFeatures() const
Definition: ExprCXX.h:152
clang::TreeTransform::RebuildDeclStmt
StmtResult RebuildDeclStmt(MutableArrayRef< Decl *> Decls, SourceLocation StartLoc, SourceLocation EndLoc)
Build a new declaration statement.
Definition: TreeTransform.h:1375
clang::NestedNameSpecifierLoc::getLocalEndLoc
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
Definition: NestedNameSpecifier.h:310
clang::FunctionProtoType::param_type_begin
param_type_iterator param_type_begin() const
Definition: Type.h:4123
clang::CaseStmt
CaseStmt - Represent a case statement.
Definition: Stmt.h:1500
clang::Sema::NonTagKind
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition: Sema.h:2516
clang::TypoExpr
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5978
clang::OMPFinalClause
This represents &#39;final&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:525
clang::OMPMergeableClause
This represents &#39;mergeable&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1648
clang::BlockExpr::getCaretLocation
SourceLocation getCaretLocation() const
Definition: Expr.cpp:2376
clang::ForStmt::getCond
Expr * getCond()
Definition: Stmt.h:2442
clang::SourceLocExpr::getIdentKind
IdentKind getIdentKind() const
Definition: Expr.h:4316
clang::concepts::NestedRequirement::getSubstitutionDiagnostic
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:423
clang::OMPTeamsDirective
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:2888
clang::ParenListExpr
Definition: Expr.h:5143
OMPDependClause::getDependencyKind
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
Definition: OpenMPClause.h:4040
clang::UnresolvedSetImpl::append
void append(iterator I, iterator E)
Definition: UnresolvedSet.h:129
clang::SourceLocExpr::getEndLoc
SourceLocation getEndLoc() const
Definition: Expr.h:4340
clang::TreeTransform::RebuildSEHFinallyStmt
StmtResult RebuildSEHFinallyStmt(SourceLocation Loc, Stmt *Block)
Definition: TreeTransform.h:2172
clang::CXXScopeSpec
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:63
clang::OMPReductionClause
This represents clause &#39;reduction&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2443
clang::CXXDefaultInitExpr::getField
FieldDecl * getField()
Get the field whose initializer will be used.
Definition: ExprCXX.h:1303
clang::OffsetOfNode
Helper class for OffsetOfExpr.
Definition: Expr.h:2163
clang::DependentCoawaitExpr::getOperand
Expr * getOperand() const
Definition: ExprCXX.h:4760
clang::OMPTeamsDistributeSimdDirective
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4029
clang::GenericSelectionExpr::Association
AssociationTy< false > Association
Definition: Expr.h:5393
clang::CXXBindTemporaryExpr
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1373
clang::GCCAsmStmt::getClobberStringLiteral
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:3087
clang::ArrayTypeTrait
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:90
clang::ObjCDictionaryElement::Key
Expr * Key
The key for the dictionary element.
Definition: ExprObjC.h:263
clang::TreeTransform::RebuildExprRequirement
concepts::ExprRequirement * RebuildExprRequirement(Expr *E, bool IsSimple, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement Ret)
Definition: TreeTransform.h:3113
clang::VAArgExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4273
clang::ObjCObjectTypeLoc::setProtocolLoc
void setProtocolLoc(unsigned i, SourceLocation Loc)
Definition: TypeLoc.h:979
clang::LambdaExpr
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1818
OMPDefaultmapClause::getDefaultmapModifierLoc
SourceLocation getDefaultmapModifierLoc() const
Get the modifier location.
Definition: OpenMPClause.h:5749
clang::UnresolvedLookupExpr::getNamingClass
CXXRecordDecl * getNamingClass()
Gets the &#39;naming class&#39; (in the sense of C++0x [class.access.base]p5) of the lookup.
Definition: ExprCXX.h:3113
clang::DeclRefExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
Definition: Expr.h:1266
clang::Expr::isTypeDependent
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Definition: Expr.h:176
clang::CXXDefaultArgExpr::getBeginLoc
SourceLocation getBeginLoc() const
Default argument expressions have no representation in the source, so they have an empty source range...
Definition: ExprCXX.h:1252
clang::DependentScopeDeclRefExpr::getDeclName
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:3198
clang::SEHTryStmt::getTryLoc
SourceLocation getTryLoc() const
Definition: Stmt.h:3308
clang::TreeTransform::RebuildCXXUnresolvedConstructExpr
ExprResult RebuildCXXUnresolvedConstructExpr(TypeSourceInfo *TSInfo, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, bool ListInitialization)
Build a new object-construction expression.
Definition: TreeTransform.h:2975
clang::CXXDependentScopeMemberExpr
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
clang::FloatingLiteral
Definition: Expr.h:1583
OMPIsDevicePtrClause
This represents clause &#39;is_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6179
clang::FunctionTypeLoc::setLocalRangeBegin
void setLocalRangeBegin(SourceLocation L)
Definition: TypeLoc.h:1374
clang::CapturedDecl
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4226
clang::ForStmt::getConditionVariable
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
Definition: Stmt.cpp:931
clang::Sema::BuildMemberReferenceExpr
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
Definition: SemaExprMember.cpp:744
clang::UnaryOperator::getOperatorLoc
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Definition: Expr.h:2080
clang::LookupResult::addDecl
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
Definition: Lookup.h:426
llvm::ArrayRef
Definition: LLVM.h:31
clang::LambdaExpr::isInitCapture
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda&#39;s captures is an init-capture.
Definition: ExprCXX.cpp:1240
clang::Stmt::StmtClass
StmtClass
Definition: Stmt.h:68
clang::OpenMPDirectiveKind
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:62
clang::BlockExpr::getBody
const Stmt * getBody() const
Definition: Expr.cpp:2379
clang::TemplateSpecializationTypeLoc::getNumArgs
unsigned getNumArgs() const
Definition: TypeLoc.h:1604
clang::CXXScalarValueInitExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:2073
clang::ObjCTypeParamTypeLoc::getProtocolRAngleLoc
SourceLocation getProtocolRAngleLoc() const
Definition: TypeLoc.h:778
clang::CXXScopeSpec::getWithLocInContext
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Definition: DeclSpec.cpp:142
clang::SwitchStmt::getBody
Stmt * getBody()
Definition: Stmt.h:2115
clang::DependentTemplateSpecializationTypeLoc::getElaboratedKeywordLoc
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:2208
clang::DependentSizedArrayType::getSizeExpr
Expr * getSizeExpr() const
Definition: Type.h:3115
clang::CXXDefaultArgExpr
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1202
clang::IfStmt::getInit
Stmt * getInit()
Definition: Stmt.h:1977
clang::LabelDecl::setStmt
void setStmt(LabelStmt *T)
Definition: Decl.h:476
clang::DependentAddressSpaceTypeLoc::setAttrNameLoc
void setAttrNameLoc(SourceLocation loc)
Definition: TypeLoc.h:1693
clang::ReferenceType::getPointeeTypeAsWritten
QualType getPointeeTypeAsWritten() const
Definition: Type.h:2769
clang::CXXUuidofExpr::isTypeOperand
bool isTypeOperand() const
Definition: ExprCXX.h:1029
clang::DependentVectorType::getSizeExpr
Expr * getSizeExpr() const
Definition: Type.h:3325
clang::CoroutineBodyStmt::getReturnStmt
Stmt * getReturnStmt() const
Definition: StmtCXX.h:413
clang::DependentSizedExtVectorType::getElementType
QualType getElementType() const
Definition: Type.h:3211
clang::UnaryTransformTypeLoc::setKWLoc
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:1897
clang::UnresolvedMemberExpr::getMemberLoc
SourceLocation getMemberLoc() const
Retrieve the location of the name of the member that this expression refers to.
Definition: ExprCXX.h:3887
clang::Sema::ArgumentPackSubstitutionIndexRAII
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:8206
clang::CXXConstructExpr::ConstructionKind
ConstructionKind
Definition: ExprCXX.h:1426
clang::TypeLocBuilder::pushTypeSpec
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
Definition: TypeLocBuilder.h:68
clang::DependentSizedExtVectorType
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3195
clang::CXXDependentScopeMemberExpr::getFirstQualifierFoundInScope
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Definition: ExprCXX.h:3645
OMPFromClause
This represents clause &#39;from&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:5898
clang::TreeTransform::RebuildObjCPropertyRefExpr
ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg, ObjCPropertyDecl *Property, SourceLocation PropertyLoc)
Build a new Objective-C property reference expression.
Definition: TreeTransform.h:3251
clang::CXXThisExpr
Represents the this expression in C++.
Definition: ExprCXX.h:1097
clang::LambdaExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:2034
clang::TypeLocBuilder::push
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
Definition: TypeLocBuilder.h:93
clang::ObjCIvarRefExpr::getDecl
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:576
clang::OMPVarListClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:248
clang::CXXUnresolvedConstructExpr::getRParenLoc
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (&#39;)&#39;) that follows the argument list.
Definition: ExprCXX.h:3438
clang::Sema::ExtParameterInfoBuilder
A helper class for building up ExtParameterInfos.
Definition: Sema.h:8617
clang::CXXNewExpr::getAllocatedTypeSourceInfo
TypeSourceInfo * getAllocatedTypeSourceInfo() const
Definition: ExprCXX.h:2197
clang::TreeTransform::RebuildExtVectorElementExpr
ExprResult RebuildExtVectorElementExpr(Expr *Base, SourceLocation OpLoc, SourceLocation AccessorLoc, IdentifierInfo &Accessor)
Build a new extended vector element access expression.
Definition: TreeTransform.h:2440
clang::DeclContext::lookup
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
Definition: DeclBase.cpp:1612
clang::MemberExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:2938
clang::NestedNameSpecifierLocBuilder
Class that aids in the construction of nested-name-specifiers along with source-location information ...
Definition: NestedNameSpecifier.h:349
clang::TreeTransform::RebuildSourceLocExpr
ExprResult RebuildSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
Build a new expression representing a call to a source location builtin.
Definition: TreeTransform.h:3054
clang::TypeTrait
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:20
clang::ArrayTypeTraitExpr::getQueriedTypeSourceInfo
TypeSourceInfo * getQueriedTypeSourceInfo() const
Definition: ExprCXX.h:2758
clang::TreeTransform::RebuildCXXTemporaryObjectExpr
ExprResult RebuildCXXTemporaryObjectExpr(TypeSourceInfo *TSInfo, SourceLocation LParenOrBraceLoc, MultiExprArg Args, SourceLocation RParenOrBraceLoc, bool ListInitialization)
Build a new object-construction expression.
Definition: TreeTransform.h:2962
clang::TemplateSpecializationTypeLoc::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Definition: TypeLoc.h:1580
clang::CXXDeleteExpr::isArrayForm
bool isArrayForm() const
Definition: ExprCXX.h:2386
clang::CXXRewrittenBinaryOperator::DecomposedForm::InnerBinOp
const Expr * InnerBinOp
The inner == or <=> operator expression.
Definition: ExprCXX.h:304
clang::ShuffleVectorExpr::getSubExprs
Expr ** getSubExprs()
Retrieve the array of expressions.
Definition: Expr.h:4036
clang::MacroQualifiedTypeLoc
Definition: TypeLoc.h:1079
clang::ObjCAtTryStmt::getCatchStmt
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
Definition: StmtObjC.h:217
clang::FunctionNoProtoType
Represents a K&R-style &#39;int foo()&#39; function, which has no information available about its arguments...
Definition: Type.h:3717
clang::DependentAddressSpaceType::getAddrSpaceExpr
Expr * getAddrSpaceExpr() const
Definition: Type.h:3166
clang::OMPTaskReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:2871
clang::OMPTargetParallelForSimdDirective
This represents &#39;#pragma omp target parallel for simd&#39; directive.
Definition: StmtOpenMP.h:3825
clang::Sema::ConditionResult::getKnownValue
llvm::Optional< bool > getKnownValue() const
Definition: Sema.h:11018
clang::OMPArraySectionExpr
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:44
clang::ObjCForCollectionStmt::getBody
Stmt * getBody()
Definition: StmtObjC.h:38
clang::OMPDynamicAllocatorsClause
This represents &#39;dynamic_allocators&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1149
clang::CXXRecordDecl::getLambdaManglingNumber
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
Definition: DeclCXX.h:1705
clang::ConditionalOperator
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3732
clang::BuiltinTypeLoc::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: TypeLoc.h:555
clang::CXXTemporaryObjectExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:1779
clang::TreeTransform::SDK_Discarded
Definition: TreeTransform.h:332
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:336
clang::CXXConstructExpr::isStdInitListInitialization
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1524
clang::CXXPseudoDestructorExpr
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2479
clang::CXXUuidofExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:1059
clang::CompoundStmt
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1332
clang::OMPDefaultClause::getDefaultKind
OpenMPDefaultClauseKind getDefaultKind() const
Returns kind of the clause.
Definition: OpenMPClause.h:909
clang::concepts::TypeRequirement
A requires-expression requirement which queries the existence of a type name or type template special...
Definition: ExprConcepts.h:185
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3754
clang::ObjCSubscriptRefExpr::getRBracket
SourceLocation getRBracket() const
Definition: ExprObjC.h:881
clang::UnaryTransformTypeLoc::setParensRange
void setParensRange(SourceRange Range)
Definition: TypeLoc.h:1921
clang::TreeTransform::TransformFirstQualifierInScope
NamedDecl * TransformFirstQualifierInScope(NamedDecl *D, SourceLocation Loc)
Transform the given declaration, which was the first part of a nested-name-specifier in a member acce...
Definition: TreeTransform.h:485
OMPThreadsClause
This represents &#39;threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4161
OMPMappableExprListClause::getMapperQualifierLoc
NestedNameSpecifierLoc getMapperQualifierLoc() const
Gets the nested name specifier for associated user-defined mapper.
Definition: OpenMPClause.h:4592
clang::TreeTransform::RebuildCXXConstructExpr
ExprResult RebuildCXXConstructExpr(QualType T, SourceLocation Loc, CXXConstructorDecl *Constructor, bool IsElidable, MultiExprArg Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool RequiresZeroInit, CXXConstructExpr::ConstructionKind ConstructKind, SourceRange ParenRange)
Build a new object-construction expression.
Definition: TreeTransform.h:2922
clang::AtomicExpr::getSubExprs
Expr ** getSubExprs()
Definition: Expr.h:5916
clang::MSDependentExistsStmt::getSubStmt
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
Definition: StmtCXX.h:292
clang::OMPTaskgroupDirective
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:2193
clang::OMPSimdlenClause::getSimdlen
Expr * getSimdlen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:769
clang::CXXConstructExpr::getConstructor
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1494
clang::TypeLocBuilder::TypeWasModifiedSafely
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn&#39;t a...
Definition: TypeLocBuilder.h:85
clang::Sema::CompoundScopeRAII
A RAII object to enter scope of a compound statement.
Definition: Sema.h:4114
clang::CXXOperatorCallExpr::getEndLoc
SourceLocation getEndLoc() const
Definition: ExprCXX.h:140
clang::TreeTransform::RebuildOMPDependClause
OMPClause * RebuildOMPDependClause(OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;depend&#39; pseudo clause.
Definition: TreeTransform.h:1820
clang::TreeTransform::ForgetPartiallySubstitutedPack
TemplateArgument ForgetPartiallySubstitutedPack()
"Forget" about the partially-substituted pack template argument, when performing an instantiation tha...
Definition: TreeTransform.h:277
OMPAlignedClause
This represents clause &#39;aligned&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3443
clang::CXXDependentScopeMemberExpr::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: ExprCXX.h:3704
clang::OMPClause::getClauseKind
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
Definition: OpenMPClause.h:79
clang::ObjCArrayLiteral::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:216
clang::DependentNameTypeLoc::getNameLoc
SourceLocation getNameLoc() const
Definition: TypeLoc.h:2171
clang::TreeTransform::RebuildDefaultStmt
StmtResult RebuildDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt)
Build a new default statement.
Definition: TreeTransform.h:1257
clang::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2372
clang::ArrayType::ArraySizeModifier
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:2895
clang::CXXTryStmt::getTryLoc
SourceLocation getTryLoc() const
Definition: StmtCXX.h:94
clang::IfStmt::isConstexpr
bool isConstexpr() const
Definition: Stmt.h:2007
clang::TreeTransform::RebuildArrayTypeTrait
ExprResult RebuildArrayTypeTrait(ArrayTypeTrait Trait, SourceLocation StartLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParenLoc)
Build a new array type trait expression.
Definition: TreeTransform.h:2863
clang::TreeTransform::RebuildOMPLastprivateClause
OMPClause * RebuildOMPLastprivateClause(ArrayRef< Expr *> VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;lastprivate&#39; clause.
Definition: TreeTransform.h:1679
clang::MSPropertySubscriptExpr::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: ExprCXX.h:975
clang::OMPTaskReductionClause
This represents clause &#39;task_reduction&#39; in the &#39;#pragma omp taskgroup&#39; directives.
Definition: OpenMPClause.h:2679
clang::DeclRefExpr::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1255
clang::ArrayTypeLoc::setSizeExpr
void setSizeExpr(Expr *Size)
Definition: TypeLoc.h:1513
clang::CXXScopeSpec::getRange
SourceRange getRange() const
Definition: DeclSpec.h:68
OMPHintClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5519
clang::ConstantExpr
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:978
clang::ObjCTypeParamType::getDecl
ObjCTypeParamDecl * getDecl() const
Definition: Type.h:5663
clang::SourceLocExpr::IdentKind
IdentKind
Definition: Expr.h:4300
clang::VAArgExpr
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4244
clang::DependentTemplateSpecializationTypeLoc::setArgLocInfo
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
Definition: TypeLoc.h:2276
clang::TemplateArgumentLocContainerIterator::operator->
pointer operator->() const
Definition: TreeTransform.h:6078
clang::ASTContext::getTrivialTypeSourceInfo
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
Definition: ASTContext.cpp:2816
clang::GotoStmt::getLabelLoc
SourceLocation getLabelLoc() const
Definition: Stmt.h:2499
clang::TreeTransform::RebuildOMPNumThreadsClause
OMPClause * RebuildOMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;num_threads&#39; clause.
Definition: TreeTransform.h:1552
clang::CXXDependentScopeMemberExpr::isImplicitAccess
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.h:3601
clang::ObjCAtThrowStmt::getThrowLoc
SourceLocation getThrowLoc() const LLVM_READONLY
Definition: StmtObjC.h:348
clang::AtomicExpr::getNumSubExprs
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
Definition: Expr.cpp:4635
clang::DependentTemplateSpecializationTypeLoc::setTemplateNameLoc
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:2252
clang::OMPDistributeDirective
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:3480
OMPDependClause
This represents implicit clause &#39;depend&#39; for the &#39;#pragma omp task&#39; directive.
Definition: OpenMPClause.h:3958
clang::OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Definition: Specifiers.h:151
clang::TreeTransform::RebuildCXXScalarValueInitExpr
ExprResult RebuildCXXScalarValueInitExpr(TypeSourceInfo *TSInfo, SourceLocation LParenLoc, SourceLocation RParenLoc)
Build a new C++ zero-initialization expression.
Definition: TreeTransform.h:2802
clang::DependentSizedArrayType
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3093
clang::CXXPseudoDestructorExpr::getDestroyedTypeLoc
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
Definition: ExprCXX.h:2587
clang::TypeLoc::getBeginLoc
SourceLocation getBeginLoc() const
Get the begin source location.
Definition: TypeLoc.cpp:191
clang::SEHFinallyStmt::getFinallyLoc
SourceLocation getFinallyLoc() const
Definition: Stmt.h:3266
clang::OpenMPLastprivateModifier
OpenMPLastprivateModifier
OpenMP &#39;lastprivate&#39; clause modifier.
Definition: OpenMPKinds.h:191
clang::UnaryTransformTypeLoc::getUnderlyingTInfo
TypeSourceInfo * getUnderlyingTInfo() const
Definition: TypeLoc.h:1905
clang::DependentTemplateSpecializationTypeLoc::getTemplateNameLoc
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:2248
clang::CXXScalarValueInitExpr
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:2053
clang::sema::BlockScopeInfo
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:716
clang::TreeTransform::RebuildTypeTrait
ExprResult RebuildTypeTrait(TypeTrait Trait, SourceLocation StartLoc, ArrayRef< TypeSourceInfo *> Args, SourceLocation RParenLoc)
Build a new type trait expression.
Definition: TreeTransform.h:2852
clang::TemplateArgumentLocContainerIterator::pointer::pointer
pointer(TemplateArgumentLoc Arg)
Definition: TreeTransform.h:6049
Designator.h
clang::UnresolvedMemberExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Retrieve the location of the &#39;->&#39; or &#39;.&#39; operator.
Definition: ExprCXX.h:3870
clang::OMPExecutableDirective::getAssociatedStmt
const Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
Definition: StmtOpenMP.h:253
clang::sema::LambdaScopeInfo::CallOperator
CXXMethodDecl * CallOperator
The lambda&#39;s compiler-generated operator().
Definition: ScopeInfo.h:800
clang::ConditionalOperator::getCond
Expr * getCond() const
Definition: Expr.h:3769
clang::OMPLastprivateClause::getKind
OpenMPLastprivateModifier getKind() const
Lastprivate kind.
Definition: OpenMPClause.h:2286
clang::AttributedTypeLoc
Type source information for an attributed type.
Definition: TypeLoc.h:851
clang::DeclarationName::getCXXNameType
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function)...
Definition: DeclarationName.h:439
clang::CXXTemporaryObjectExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.cpp:1060
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
clang::ParmVarDecl::getFunctionScopeDepth
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1642
clang::DependentTemplateSpecializationTypeLoc::setQualifierLoc
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:2224
clang::DesignatedInitExpr::designators
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:4842
clang::NestedNameSpecifier::getAsNamespace
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
Definition: NestedNameSpecifier.cpp:168
clang::OMPProcBindClause
This represents &#39;proc_bind&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:942
clang::OMPCaptureClause
This represents &#39;capture&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1805
clang::MemberExpr::getFoundDecl
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Definition: Expr.h:2923
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:619
clang::TreeTransform::RebuildCoyieldExpr
ExprResult RebuildCoyieldExpr(SourceLocation CoyieldLoc, Expr *Result)
Build a new co_yield expression.
Definition: TreeTransform.h:1446
clang::Expr
This represents one expression.
Definition: Expr.h:108
clang::TreeTransform::RebuildOMPAllocateClause
OMPClause * RebuildOMPAllocateClause(Expr *Allocate, ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;allocate&#39; clause.
Definition: TreeTransform.h:1860
clang::FunctionTypeLoc::getLocalRangeEnd
SourceLocation getLocalRangeEnd() const
Definition: TypeLoc.h:1378
clang::IfStmt::getElseLoc
SourceLocation getElseLoc() const
Definition: Stmt.h:1996
clang::CXXForRangeStmt::getEndStmt
DeclStmt * getEndStmt()
Definition: StmtCXX.h:165
End
SourceLocation End
Definition: USRLocFinder.cpp:166
clang::TreeTransform::RebuildDeclarationNameExpr
ExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool RequiresADL)
Build a new expression that references a declaration.
Definition: TreeTransform.h:2189
clang::TreeTransform::RebuildMacroQualifiedType
QualType RebuildMacroQualifiedType(QualType T, const IdentifierInfo *MacroII)
Build a new MacroDefined type.
Definition: TreeTransform.h:914
clang::ETK_Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
Definition: Type.h:5224
clang::RequiresExprBodyDecl
Represents the body of a requires-expression.
Definition: DeclCXX.h:1909
llvm::MutableArrayRef
Definition: LLVM.h:32
clang::LambdaExpr::getCaptureDefaultLoc
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda&#39;s capture-default, if any.
Definition: ExprCXX.h:1894
clang::OverloadExpr::getTemplateArgs
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2997
clang::MSAsmStmt::getClobbers
ArrayRef< StringRef > getClobbers() const
Definition: Stmt.h:3173
clang::TreeTransform::RebuildObjCMessageExpr
ExprResult RebuildObjCMessageExpr(SourceLocation SuperLoc, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, QualType SuperType, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, SourceLocation RBracLoc)
Build a new Objective-C instance/class message to &#39;super&#39;.
Definition: TreeTransform.h:3205
Label
std::string Label
Definition: UsingDeclarationsSorter.cpp:69
clang::OffsetOfNode::getFieldName
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1596
OMPMapClause::getMapLoc
SourceLocation getMapLoc() const LLVM_READONLY
Fetches location of clause mapping kind.
Definition: OpenMPClause.h:5048
clang::IncompleteArrayTypeLoc
Definition: TypeLoc.h:1540
clang::TreeTransform::RebuildOMPNontemporalClause
OMPClause * RebuildOMPNontemporalClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;nontemporal&#39; clause.
Definition: TreeTransform.h:2011
clang::TreeTransform::RebuildCXXNewExpr
ExprResult RebuildCXXNewExpr(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocatedType, TypeSourceInfo *AllocatedTypeInfo, Optional< Expr *> ArraySize, SourceRange DirectInitRange, Expr *Initializer)
Build a new C++ "new" expression.
Definition: TreeTransform.h:2813
clang::UnresolvedMemberExpr::isArrow
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3867
Id
int Id
Definition: ASTDiff.cpp:190
clang::OMPSimdlenClause
This represents &#39;simdlen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:735
OMPNumTasksClause::getNumTasks
Expr * getNumTasks() const
Return safe iteration space distance.
Definition: OpenMPClause.h:5462
clang::DefaultStmt::getDefaultLoc
SourceLocation getDefaultLoc() const
Definition: Stmt.h:1671
clang::TreeTransform::TransformCompoundStmt
StmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr)
Definition: TreeTransform.h:6765
clang::OMPScheduleClause::getScheduleKindLoc
SourceLocation getScheduleKindLoc()
Get kind location.
Definition: OpenMPClause.h:1424
clang::TemplateArgumentLocInventIterator::TemplateArgumentLocInventIterator
TemplateArgumentLocInventIterator(TreeTransform< Derived > &Self, InputIterator Iter)
Definition: TreeTransform.h:4161
clang::UnresolvedMemberExpr::isImplicitAccess
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Definition: ExprCXX.cpp:1531
clang::WhileStmt::getWhileLoc
SourceLocation getWhileLoc() const
Definition: Stmt.h:2327
clang::OMPMasterTaskLoopDirective
This represents &#39;#pragma omp master taskloop&#39; directive.
Definition: StmtOpenMP.h:3204
clang::ASTTemplateArgumentListInfo::NumTemplateArgs
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:620
clang::TypeLoc::getUnqualifiedLoc
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
Definition: TypeLoc.h:326
clang::ArrayTypeLoc::getBracketsRange
SourceRange getBracketsRange() const
Definition: TypeLoc.h:1505
clang::AutoTypeLoc::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: TypeLoc.h:1998
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7067
clang::CXXTemporaryObjectExpr
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1750
clang::ElaboratedTypeKeyword
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:5206
clang::DesignatedInitUpdateExpr
Definition: Expr.h:4973
clang::NestedNameSpecifierLoc::getBeginLoc
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
Definition: NestedNameSpecifier.h:292
clang::TreeTransform::RebuildCXXDeleteExpr
ExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc, bool IsGlobalDelete, bool IsArrayForm, Expr *Operand)
Build a new C++ "delete" expression.
Definition: TreeTransform.h:2840
Inits
Inits[]
Definition: OpenMPClause.h:150
OMPGrainsizeClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5352
clang::CXXConstCastExpr
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:527
clang::DependentAddressSpaceTypeLoc
Definition: TypeLoc.h:1681
clang::CapturedDecl::getNumParams
unsigned getNumParams() const
Definition: Decl.h:4271
clang::AutoTypeLoc::setFoundDecl
void setFoundDecl(NamedDecl *D)
Definition: TypeLoc.h:1984
clang::BlockExpr
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5579
clang::TypeLoc::getAs
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Definition: TypeLoc.h:88
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2649
clang::TreeTransform::RebuildNestedRequirement
concepts::NestedRequirement * RebuildNestedRequirement(Expr *Constraint)
Definition: TreeTransform.h:3125
clang::CXXCatchStmt::getExceptionDecl
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:49
clang::CXXPseudoDestructorExpr::getDestroyedTypeIdentifier
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2579
clang::CallExpr::getCallee
Expr * getCallee()
Definition: Expr.h:2663
clang::InitListExpr::getNumInits
unsigned getNumInits() const
Definition: Expr.h:4433
Lookup.h
clang::TemplateArgumentLocInventIterator::operator++
TemplateArgumentLocInventIterator & operator++()
Definition: TreeTransform.h:4165
clang::TreeTransform::RebuildOMPIsDevicePtrClause
OMPClause * RebuildOMPIsDevicePtrClause(ArrayRef< Expr *> VarList, const OMPVarListLocTy &Locs)
Build a new OpenMP &#39;is_device_ptr&#39; clause.
Definition: TreeTransform.h:1987
clang::OMPTargetTeamsDistributeParallelForSimdDirective
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:4463
clang::MSDependentExistsStmt::isIfNotExists
bool isIfNotExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:280
clang::OMPAllocatorClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:298
clang::concepts::NestedRequirement::isSubstitutionFailure
bool isSubstitutionFailure() const
Definition: ExprConcepts.h:419
clang::TreeTransform::TemporaryBase
RAII object that temporarily sets the base location and entity used for reporting diagnostics in type...
Definition: TreeTransform.h:184
clang::CXXPseudoDestructorExpr::isArrow
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an &#39;->&#39; (otherwise, it used a &#39;.
Definition: ExprCXX.h:2542
clang::WhileStmt::getBody
Stmt * getBody()
Definition: Stmt.h:2287
clang::OMPAllocateClause::getAllocator
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
Definition: OpenMPClause.h:385
clang::TreeTransform::RebuildMSAsmStmt
StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr *> Exprs, SourceLocation EndLoc)
Build a new MS style inline asm statement.
Definition: TreeTransform.h:1401
clang::OverloadExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:3003
clang::ObjCDictionaryLiteral
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:304
clang::TreeTransform::RebuildOMPNumTeamsClause
OMPClause * RebuildOMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;num_teams&#39; clause.
Definition: TreeTransform.h:1873
clang::ObjCAtSynchronizedStmt::getSynchBody
const CompoundStmt * getSynchBody() const
Definition: StmtObjC.h:297
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:438
clang::ParenListExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:5188
clang::CaseStmt::getRHS
Expr * getRHS()
Definition: Stmt.h:1601
clang::DependentNameType::getIdentifier
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
Definition: Type.h:5394
clang::ObjCAtSynchronizedStmt
Represents Objective-C&#39;s @synchronized statement.
Definition: StmtObjC.h:277
clang::TreeTransform::RebuildOMPArraySectionExpr
ExprResult RebuildOMPArraySectionExpr(Expr *Base, SourceLocation LBracketLoc, Expr *LowerBound, SourceLocation ColonLoc, Expr *Length, SourceLocation RBracketLoc)
Build a new array section expression.
Definition: TreeTransform.h:2300
clang::ObjCSelectorExpr
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
clang::ObjCMessageExpr::getArgs
Expr ** getArgs()
Retrieve the arguments to this message, not including the receiver.
Definition: ExprObjC.h:1386
Begin
SourceLocation Begin
Definition: USRLocFinder.cpp:164
clang::PackExpansionTypeLoc::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: TypeLoc.h:2329
clang::DeclarationNameInfo::getNamedTypeInfo
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
Definition: DeclarationName.h:730
clang::TreeTransform::RebuildSizeOfPackExpr
ExprResult RebuildSizeOfPackExpr(SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, Optional< unsigned > Length, ArrayRef< TemplateArgument > PartialArgs)
Build a new expression to compute the length of a parameter pack.
Definition: TreeTransform.h:3039
clang::OffsetOfExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2309
clang::NestedNameSpecifierLoc::getPrefix
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
Definition: NestedNameSpecifier.h:320
clang::SizeOfPackExpr
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4091
clang::OMPArraySectionExpr::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: ExprOpenMP.h:111
clang::CXXTryStmt
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:68
clang::AsTypeExpr
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:5642
OMPDistScheduleClause::getDistScheduleKind
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
Definition: OpenMPClause.h:5622
clang::ObjCAtTryStmt::getAtTryLoc
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
Definition: StmtObjC.h:204
clang::TreeTransform::RebuildTemplateName
TemplateName RebuildTemplateName(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack)
Build a new template name given a template template parameter pack and the.
Definition: TreeTransform.h:1214
clang::AtomicTypeLoc::setRParenLoc
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:2389
clang::CallExpr::getDirectCallee
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
Definition: Expr.h:2681
clang::AutoTypeLoc::setTemplateKWLoc
void setTemplateKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:1968
clang::ExtVectorElementExpr::getAccessor
IdentifierInfo & getAccessor() const
Definition: Expr.h:5540
clang::TemplateName
Represents a C++ template name within the type system.
Definition: TemplateName.h:191
clang::DecltypeType
Represents the type decltype(expr) (C++11).
Definition: Type.h:4370
clang::OMPTargetTeamsDistributeSimdDirective
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4536
clang::ArrayTypeTraitExpr::getTrait
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2754
clang::Sema::FullExprArg
Definition: Sema.h:4063
clang::TreeTransform::RebuildEmptyCXXFoldExpr
ExprResult RebuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
Build an empty C++1z fold-expression with the given operator.
Definition: TreeTransform.h:3414
clang::OMPOrderedClause
This represents &#39;ordered&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1474
clang::Type::getContainedAutoType
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
Definition: Type.h:2251
clang::CXXNamedCastExpr::getAngleBrackets
SourceRange getAngleBrackets() const LLVM_READONLY
Definition: ExprCXX.h:390
clang::TreeTransform::RebuildGotoStmt
StmtResult RebuildGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *Label)
Build a new goto statement.
Definition: TreeTransform.h:1348
clang::TreeTransform::RebuildOMPProcBindClause
OMPClause * RebuildOMPProcBindClause(ProcBindKind Kind, SourceLocation KindKwLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;proc_bind&#39; clause.
Definition: TreeTransform.h:1618
clang::OffsetOfNode::getKind
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2217
clang::TypeofLikeTypeLoc::setLParenLoc
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1812
clang::TreeTransform::TransformedLocalDecls
llvm::DenseMap< Decl *, Decl * > TransformedLocalDecls
The set of local declarations that have been transformed, for cases where we are forced to build new ...
Definition: TreeTransform.h:123
clang::MemberExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: Expr.h:2961
clang::CXXRewrittenBinaryOperator::getOperatorLoc
SourceLocation getOperatorLoc() const LLVM_READONLY
Definition: ExprCXX.h:317
clang::SourceRange::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:223
clang::Expr::getType
QualType getType() const
Definition: Expr.h:137
OMPMapClause::getColonLoc
SourceLocation getColonLoc() const
Get colon location.
Definition: OpenMPClause.h:5051
clang::Sema::FunctionScopeRAII
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:4129
clang::concepts::TypeRequirement::getType
TypeSourceInfo * getType() const
Definition: ExprConcepts.h:227
clang::FunctionTypeLoc::getLocalRangeBegin
SourceLocation getLocalRangeBegin() const
Definition: TypeLoc.h:1370
clang::MSDependentExistsStmt::getKeywordLoc
SourceLocation getKeywordLoc() const
Retrieve the location of the __if_exists or __if_not_exists keyword.
Definition: StmtCXX.h:274
clang::EnumTypeLoc
Wrapper for source info for enum types.
Definition: TypeLoc.h:726
clang::TreeTransform::RebuildCXXForRangeStmt
StmtResult RebuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *Init, SourceLocation ColonLoc, Stmt *Range, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVar, SourceLocation RParenLoc)
Build a new C++0x range-based for statement.
Definition: TreeTransform.h:2105
clang::OMPForDirective
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1259
clang::UnaryTransformType
A unary type transform, which is a type constructed from another.
Definition: Type.h:4413
clang::ConceptReference::getConceptNameInfo
const DeclarationNameInfo & getConceptNameInfo() const
Definition: ASTConcept.h:142
Stmt.h
clang::TransformTypeSpecType
static QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T)
Definition: TreeTransform.h:4605
clang::TreeTransform::RebuildOMPAllocatorClause
OMPClause * RebuildOMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;allocator&#39; clause.
Definition: TreeTransform.h:1584
clang::ObjCTypeParamTypeLoc::getProtocolLAngleLoc
SourceLocation getProtocolLAngleLoc() const
Definition: TypeLoc.h:768
clang::CXXFoldExpr::getPattern
Expr * getPattern() const
Get the pattern, that is, the operand that contains an unexpanded pack.
Definition: ExprCXX.h:4569
clang::ObjCDictionaryElement::NumExpansions
Optional< unsigned > NumExpansions
The number of elements this pack expansion will expand to, if this is a pack expansion and is known...
Definition: ExprObjC.h:273
clang::SwitchStmt::getSwitchLoc
SourceLocation getSwitchLoc() const
Definition: Stmt.h:2176
clang::PackExpansionTypeLoc::setEllipsisLoc
void setEllipsisLoc(SourceLocation Loc)
Definition: TypeLoc.h:2333
clang::DependentAddressSpaceTypeLoc::setAttrExprOperand
void setAttrExprOperand(Expr *e)
Definition: TypeLoc.h:1703
clang::TreeTransform::AlreadyTransformed
bool AlreadyTransformed(QualType T)
Determine whether the given type T has already been transformed.
Definition: TreeTransform.h:211
clang::TypeAliasTemplateDecl
Declaration of an alias template.
Definition: DeclTemplate.h:2511
clang::GotoStmt::getLabel
LabelDecl * getLabel() const
Definition: Stmt.h:2494
clang::concepts::Requirement::SubstitutionDiagnostic
Definition: ExprConcepts.h:143
clang::ObjCAtTryStmt::getTryBody
const Stmt * getTryBody() const
Retrieve the @try body.
Definition: StmtObjC.h:208
clang::CXXFoldExpr
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4529
clang::ObjCTypeParamTypeLoc
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
Definition: TypeLoc.h:748
clang::ReturnStmt
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2636
clang::AutoTypeLoc::setNestedNameSpecifierLoc
void setNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Definition: TypeLoc.h:1960
clang::OMPTargetTeamsDirective
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:4251
clang::ObjCObjectTypeLoc::setHasBaseTypeAsWritten
void setHasBaseTypeAsWritten(bool HasBaseType)
Definition: TypeLoc.h:998
clang::TreeTransform::RebuildGenericSelectionExpr
ExprResult RebuildGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo *> Types, ArrayRef< Expr *> Exprs)
Build a new generic selection expression.
Definition: TreeTransform.h:2551
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
clang::MSAsmStmt
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3101
clang::DoStmt::getDoLoc
SourceLocation getDoLoc() const
Definition: Stmt.h:2383
clang::ObjCAutoreleasePoolStmt::getAtLoc
SourceLocation getAtLoc() const
Definition: StmtObjC.h:388
clang::ObjCPropertyRefExpr::getImplicitPropertyGetter
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:712
clang::Sema::ConditionKind
ConditionKind
Definition: Sema.h:11026
clang::ActionResult::isInvalid
bool isInvalid() const
Definition: Ownership.h:166
clang::CastExpr::getSubExprAsWritten
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
Definition: Expr.cpp:1916
clang::Sema::OffsetOfComponent
Definition: Sema.h:4933
clang::ArraySubscriptExpr::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: Expr.h:2516
clang::NUM_OVERLOADED_OPERATORS
Definition: OperatorKinds.h:26
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:217
clang::UnaryOperator
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2046
clang::ObjCMethodDecl::isInstanceMethod
bool isInstanceMethod() const
Definition: DeclObjC.h:423
clang::MemberExpr::getMemberLoc
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of &#39;F&#39;...
Definition: Expr.h:3025
clang::VectorType
Represents a GCC generic vector type.
Definition: Type.h:3235
clang::ObjCMessageExpr::getReceiverKind
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1234
clang::ArrayType::getSizeModifier
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2912
clang::DesignatedInitExpr::usesGNUSyntax
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:4873
clang::DeclarationNameLoc::CXXOperatorName
struct CXXOpName CXXOperatorName
Definition: DeclarationName.h:678
clang::ExpressionTraitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:2820
clang::Sema::ActOnChooseExpr
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:14165
clang::DeclarationNameLoc::CXXOpName::EndOpNameLoc
unsigned EndOpNameLoc
Definition: DeclarationName.h:664
clang::AtomicExpr::getOp
AtomicOp getOp() const
Definition: Expr.h:5913
clang::MSPropertyRefExpr
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:863
clang::TemplateTemplateParmDecl
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Definition: DeclTemplate.h:1600
clang::UnaryTransformType::getUTTKind
UTTKind getUTTKind() const
Definition: Type.h:4441
clang::SubstNonTypeTemplateParmExpr
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4209
clang::OffsetOfExpr::getComponent
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2316
clang::DefaultStmt
Definition: Stmt.h:1656
OMPDeviceClause::getDevice
Expr * getDevice()
Return device number.
Definition: OpenMPClause.h:4132
clang::Sema::ExtParameterInfoBuilder::getPointerOrNull
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we&#39;ve built ...
Definition: Sema.h:8636
clang::OMPCancelDirective
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:3005
clang::OMPCollapseClause
This represents &#39;collapse&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:800
clang::OMPFirstprivateClause
This represents clause &#39;firstprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:1991
clang::MacroQualifiedTypeLoc::getInnerLoc
TypeLoc getInnerLoc() const
Definition: TypeLoc.h:1087
clang::TemplateArgument::isPackExpansion
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
Definition: TemplateBase.cpp:194
OMPDistScheduleClause::getCommaLoc
SourceLocation getCommaLoc()
Get location of &#39;,&#39;.
Definition: OpenMPClause.h:5631
clang::IfStmt::getCond
Expr * getCond()
Definition: Stmt.h:1909
clang::DeclRefExpr::getDecl
ValueDecl * getDecl()
Definition: Expr.h:1247
clang::AutoTypeLoc::getNestedNameSpecifierLoc
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
Definition: TypeLoc.h:1956
clang::UnaryTransformTypeLoc::getKWLoc
SourceLocation getKWLoc() const
Definition: TypeLoc.h:1896
clang::PredefinedExpr::getLocation
SourceLocation getLocation() const
Definition: Expr.h:1955
clang::ActionResult::isUsable
bool isUsable() const
Definition: Ownership.h:167
clang::VAArgExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4276
clang::ASTContext::getTypeDeclType
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Definition: ASTContext.h:1417
clang::ComparisonCategoryType::Last
clang::TreeTransform::RebuildObjCMessageExpr
ExprResult RebuildObjCMessageExpr(Expr *Receiver, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, SourceLocation RBracLoc)
Build a new Objective-C instance message.
Definition: TreeTransform.h:3190
clang::ObjCForCollectionStmt::getForLoc
SourceLocation getForLoc() const
Definition: StmtObjC.h:52
clang::PredefinedExpr::IdentKind
IdentKind
Definition: Expr.h:1914
clang::CXXDeleteExpr::getDestroyedType
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:301
clang::ParenExpr::getSubExpr
const Expr * getSubExpr() const
Definition: Expr.h:2010
clang::ObjCBridgedCastExpr::getBridgeKind
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1665
clang::CXXBindTemporaryExpr::getSubExpr
const Expr * getSubExpr() const
Definition: ExprCXX.h:1396
clang::DependentNameTypeLoc::setQualifierLoc
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:2164
clang::LCK_StarThis
Definition: Lambda.h:35
clang::CStyleCastExpr
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
Definition: Expr.h:3371
clang::SizeOfPackExpr::getPackLoc
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
Definition: ExprCXX.h:4156
clang::LambdaExpr::getCallOperator
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Definition: ExprCXX.cpp:1287
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:719
clang::VarDecl::getInitStyle
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1309
clang::CXXDefaultArgExpr::getUsedContext
const DeclContext * getUsedContext() const
Definition: ExprCXX.h:1244
clang::ArraySubscriptExpr::getLHS
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2497
clang::Sema::BuildExprRequirement
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
Definition: SemaExprCXX.cpp:8418
clang::ConceptReference::getTemplateArgsAsWritten
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: ASTConcept.h:158
clang::TreeTransform::SDK_StmtExprResult
Definition: TreeTransform.h:334
clang::FunctionTypeLoc::getReturnLoc
TypeLoc getReturnLoc() const
Definition: TypeLoc.h:1435
clang::TreeTransform::RebuildOMPReductionClause
OMPClause * RebuildOMPReductionClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr *> UnresolvedReductions)
Build a new OpenMP &#39;reduction&#39; clause.
Definition: TreeTransform.h:1706
OpenMPClause.h
This file defines OpenMP AST classes for clauses.
clang::TreeTransform::getBaseEntity
DeclarationName getBaseEntity()
Returns the name of the entity being transformed, if that information was not available elsewhere in ...
Definition: TreeTransform.h:173
clang::ImaginaryLiteral
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1662
clang::Sema::BuildInitList
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:6340
clang::TreeTransform::RebuildCXXDynamicCastExpr
ExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, SourceLocation LParenLoc, Expr *SubExpr, SourceLocation RParenLoc)
Build a new C++ dynamic_cast expression.
Definition: TreeTransform.h:2637
clang::OMPFlushDirective
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:2267
clang::RequiresExpr::getRequirements
ArrayRef< concepts::Requirement * > getRequirements() const
Definition: ExprConcepts.h:500
clang::VectorTypeLoc
Definition: TypeLoc.h:1751
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:288
clang::OMPParallelForSimdDirective
This represents &#39;#pragma omp parallel for simd&#39; directive.
Definition: StmtOpenMP.h:1796
clang::Expr::getObjectKind
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Definition: Expr.h:421
clang::DoStmt
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:2354
clang::OMPSeqCstClause
This represents &#39;seq_cst&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1845
clang::CXXDependentScopeMemberExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Retrieve the location of the &#39;->&#39; or &#39;.&#39; operator.
Definition: ExprCXX.h:3621
clang::OMPUntiedClause
This represents &#39;untied&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1608
clang::TemplateArgumentLocInventIterator::operator++
TemplateArgumentLocInventIterator operator++(int)
Definition: TreeTransform.h:4170
clang::TreeTransform::RebuildOMPFinalClause
OMPClause * RebuildOMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;final&#39; clause.
Definition: TreeTransform.h:1541
OMPMappableExprListClause::mapperlists
mapperlist_range mapperlists()
Definition: OpenMPClause.h:4817
clang::TreeTransform::RebuildOMPSimdlenClause
OMPClause * RebuildOMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;simdlen&#39; clause.
Definition: TreeTransform.h:1574
clang::Sema::BuildCXXNoexceptExpr
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
Definition: SemaExprCXX.cpp:7485
clang::CXXUnresolvedConstructExpr::getLParenLoc
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses (&#39;(&#39;) that precedes the argument list.
Definition: ExprCXX.h:3433
clang::FunctionProtoType::hasTrailingReturn
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
Definition: Type.h:4102
clang::RecordType::getDecl
RecordDecl * getDecl() const
Definition: Type.h:4505
clang::CXXDependentScopeMemberExpr::getQualifier
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3626
clang::CXXOperatorCallExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
Definition: ExprCXX.h:129
clang::BlockDecl::setIsVariadic
void setIsVariadic(bool value)
Definition: Decl.h:4113
clang::CXXScopeSpec::getScopeRep
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
Definition: DeclSpec.h:76
clang::OMPParallelMasterTaskLoopDirective
This represents &#39;#pragma omp parallel master taskloop&#39; directive.
Definition: StmtOpenMP.h:3340
clang::TypeofLikeTypeLoc::setTypeofLoc
void setTypeofLoc(SourceLocation Loc)
Definition: TypeLoc.h:1804
clang::OMPUnifiedAddressClause
This represents &#39;unified_address&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
Definition: OpenMPClause.h:1023
clang::DependentTemplateSpecializationTypeLoc
Definition: TypeLoc.h:2202
clang::DependentScopeDeclRefExpr::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:3195
clang::CXXDeleteExpr::getArgument
Expr * getArgument()
Definition: ExprCXX.h:2401
clang::OMPTargetEnterDataDirective
This represents &#39;#pragma omp target enter data&#39; directive.
Definition: StmtOpenMP.h:2631
clang::TemplateArgumentLocContainerIterator
Simple iterator that traverses the template arguments in a container that provides a getArgLoc() memb...
Definition: TreeTransform.h:6035
clang::OMPScheduleClause::getLParenLoc
SourceLocation getLParenLoc()
Get location of &#39;(&#39;.
Definition: OpenMPClause.h:1421
clang::DeclaratorDecl::getTrailingRequiresClause
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
Definition: Decl.h:747
clang::CXXScopeSpec::location_data
char * location_data() const
Retrieve the data associated with the source-location information.
Definition: DeclSpec.h:217
clang::CXXStdInitializerListExpr::getSubExpr
Expr * getSubExpr()
Definition: ExprCXX.h:732
clang::TreeTransform::RebuildObjCForCollectionStmt
StmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc, Stmt *Element, Expr *Collection, SourceLocation RParenLoc, Stmt *Body)
Build a new Objective-C fast enumeration statement.
Definition: TreeTransform.h:2050
clang::TemplateArgumentLocContainerIterator::operator==
friend bool operator==(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
Definition: TreeTransform.h:6082
clang::TreeTransform::RebuildExprRequirement
concepts::ExprRequirement * RebuildExprRequirement(concepts::Requirement::SubstitutionDiagnostic *SubstDiag, bool IsSimple, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement Ret)
Definition: TreeTransform.h:3104
clang::ArrayTypeLoc
Wrapper for source info for arrays.
Definition: TypeLoc.h:1484
clang::isComputedNoexcept
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
Definition: ExceptionSpecificationType.h:39
OMPAlignedClause::getColonLoc
SourceLocation getColonLoc() const
Returns the location of &#39;:&#39;.
Definition: OpenMPClause.h:3504
clang::OMPMasterTaskLoopSimdDirective
This represents &#39;#pragma omp master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3272
clang::TreeTransform::RebuildMSDependentExistsStmt
StmtResult RebuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Build a new C++0x range-based for statement.
Definition: TreeTransform.h:2145
clang::TreeTransform::RebuildCXXCatchStmt
StmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc, VarDecl *ExceptionDecl, Stmt *Handler)
Build a new C++ catch statement.
Definition: TreeTransform.h:2085
OMPNumTeamsClause
This represents &#39;num_teams&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5089
clang::TreeTransform::InventTemplateArgumentLoc
void InventTemplateArgumentLoc(const TemplateArgument &Arg, TemplateArgumentLoc &ArgLoc)
Fakes up a TemplateArgumentLoc for a given TemplateArgument.
Definition: TreeTransform.h:4014
clang::CXXDynamicCastExpr
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:445
clang::OpaqueValueExpr
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:1075
clang::DeducedTemplateSpecializationTypeLoc::getTemplateNameLoc
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:2071
clang::ConvertVectorExpr
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4067
clang::ObjCMessageExpr::getNumArgs
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1382
clang::TreeTransform::RebuildObjCExceptionDecl
VarDecl * RebuildObjCExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *TInfo, QualType T)
Rebuild an Objective-C exception declaration.
Definition: TreeTransform.h:1470
clang::ASTContext::BuiltinFnTy
CanQualType BuiltinFnTy
Definition: ASTContext.h:1046
clang::CompoundLiteralExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:3110
Kind
Kind
Definition: ChrootChecker.cpp:29
clang::PackExpansionTypeLoc::getPatternLoc
TypeLoc getPatternLoc() const
Definition: TypeLoc.h:2345
clang::OverloadExpr
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2844
clang::CapturedStmt
This captures a statement into a function.
Definition: Stmt.h:3376
clang::CXXFoldExpr::getInit
Expr * getInit() const
Get the operand that doesn&#39;t contain a pack, for a binary fold.
Definition: ExprCXX.h:4572
clang::QualType::getCanonicalType
QualType getCanonicalType() const
Definition: Type.h:6295
clang::CXXInheritedCtorInitExpr
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1613
clang::ExpressionTraitExpr::getTrait
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2822
clang::MSAsmStmt::getAsmToks
Token * getAsmToks()
Definition: Stmt.h:3132
clang::ActionResult
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Definition: Ownership.h:153
clang::FunctionProtoType::ExceptionSpecInfo::Type
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3813
clang::CXXNewExpr::getPlacementArgs
Expr ** getPlacementArgs()
Definition: ExprCXX.h:2240
OMPDistScheduleClause::getLParenLoc
SourceLocation getLParenLoc()
Get location of &#39;(&#39;.
Definition: OpenMPClause.h:5625
clang::PseudoObjectExpr
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5715
clang::ASTContext::getElaboratedType
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Definition: ASTContext.cpp:4439
clang::DependentTemplateSpecializationTypeLoc::setLAngleLoc
void setLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2260
clang::TreeTransform::RebuildObjCIvarRefExpr
ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar, SourceLocation IvarLoc, bool IsArrow, bool IsFreeIvar)
Build a new Objective-C ivar reference expression.
Definition: TreeTransform.h:3231
clang::DeclRefExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: Expr.h:1316
clang::TypeWithKeyword::getKeyword
ElaboratedTypeKeyword getKeyword() const
Definition: Type.h:5246
clang::FunctionProtoType::getExtProtoInfo
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3975
clang::AttributedTypeLoc::getAttr
const Attr * getAttr() const
The type attribute.
Definition: TypeLoc.h:873
clang::TemplateArgumentLocInventIterator::TemplateArgumentLocInventIterator
TemplateArgumentLocInventIterator()
Definition: TreeTransform.h:4159
clang::TemplateArgumentLocContainerIterator::operator!=
friend bool operator!=(const TemplateArgumentLocContainerIterator &X, const TemplateArgumentLocContainerIterator &Y)
Definition: TreeTransform.h:6087
clang::TreeTransform::RememberPartiallySubstitutedPack
void RememberPartiallySubstitutedPack(TemplateArgument Arg)
"Remember" the partially-substituted pack template argument after performing an instantiation that mu...
Definition: TreeTransform.h:286
clang::OverloadExpr::getNameLoc
SourceLocation getNameLoc() const
Gets the location of the name.
Definition: ExprCXX.h:2956
clang::FunctionProtoType::ExtProtoInfo::ExtParameterInfos
const ExtParameterInfo * ExtParameterInfos
Definition: Type.h:3844
clang::CXXInheritedCtorInitExpr::inheritedFromVBase
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
Definition: ExprCXX.h:1662
clang::MemberExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: Expr.h:2969
clang::ParenListExpr::getNumExprs
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition: Expr.h:5169
omp
clang::OMPSingleDirective
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1535
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::CXXRewrittenBinaryOperator::DecomposedForm::LHS
const Expr * LHS
The original left-hand side.
Definition: ExprCXX.h:300
clang::ObjCObjectPointerTypeLoc::getStarLoc
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1298
clang::CompoundStmt::body
body_range body()
Definition: Stmt.h:1365
clang::ArrayTypeTraitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:2752
clang::LambdaExpr::explicit_capture_begin
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition: ExprCXX.cpp:1257
clang::FunctionType::getReturnType
QualType getReturnType() const
Definition: Type.h:3680
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition: IdentifierTable.h:529
OMPHintClause
This represents &#39;hint&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5488
clang::ReturnStmt::getRetValue
Expr * getRetValue()
Definition: Stmt.h:2669
clang::OpenMPDependClauseKind
OpenMPDependClauseKind
OpenMP attributes for &#39;depend&#39; clause.
Definition: OpenMPKinds.h:102
clang::EnumType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Definition: Type.h:4521
clang::BinaryOperator::getOperatorLoc
SourceLocation getOperatorLoc() const
Definition: Expr.h:3466
clang::TreeTransform::StmtDiscardKind
StmtDiscardKind
The reason why the value of a statement is not discarded, if any.
Definition: TreeTransform.h:331
clang::TreeTransform::RebuildLabelStmt
StmtResult RebuildLabelStmt(SourceLocation IdentLoc, LabelDecl *L, SourceLocation ColonLoc, Stmt *SubStmt)
Build a new label statement.
Definition: TreeTransform.h:1268
clang::ObjCAtCatchStmt::getCatchBody
const Stmt * getCatchBody() const
Definition: StmtObjC.h:93
clang::QualType::getAddressSpace
LangAS getAddressSpace() const
Return the address space of this type.
Definition: Type.h:6377
clang::CXXTryStmt::getNumHandlers
unsigned getNumHandlers() const
Definition: StmtCXX.h:106
clang::UnaryOperator::getSubExpr
Expr * getSubExpr() const
Definition: Expr.h:2076
clang::CXXDependentScopeMemberExpr::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3692
clang::DependentScopeDeclRefExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: ExprCXX.h:3233
clang::TreeTransform::RebuildSEHTryStmt
StmtResult RebuildSEHTryStmt(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: TreeTransform.h:2162
clang::DeclRefExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: Expr.h:1308
clang::DiagNullabilityKind
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword...
Definition: Diagnostic.h:1295
clang::CXXPseudoDestructorExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information...
Definition: ExprCXX.h:2531
clang::OMPExecutableDirective
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
Ret
static bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
Definition: Interp.cpp:34
clang::SubstTemplateTemplateParmPackStorage
A structure for storing an already-substituted template template parameter pack.
Definition: TemplateName.h:134
clang::CXXNamedCastExpr::getOperatorLoc
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Definition: ExprCXX.h:383
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2100
clang::CXXUnresolvedConstructExpr::arg_begin
arg_iterator arg_begin()
Definition: ExprCXX.h:3452
clang::CXXNewExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:2339
clang::ObjCDictionaryLiteral::getNumElements
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:358
clang::ObjCTypeParamTypeLoc::setProtocolLAngleLoc
void setProtocolLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:774
clang::CaseStmt::getLHS
Expr * getLHS()
Definition: Stmt.h:1589
clang::Sema::ActOnLabelStmt
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition: SemaStmt.cpp:517
clang::UserDefinedLiteral
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:564
clang::DeclarationNameInfo::getName
DeclarationName getName() const
getName - Returns the embedded declaration name.
Definition: DeclarationName.h:713
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3219
clang::BuiltinBitCastExpr
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:4812
clang::MultiExprArg
MutableArrayRef< Expr * > MultiExprArg
Definition: Ownership.h:273
clang::OMPScheduleClause
This represents &#39;schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1281
clang::PackExpansionExpr::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
Definition: ExprCXX.h:4051
clang::CXXMemberCallExpr
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:171
clang::AutoTypeLoc::getFoundDecl
NamedDecl * getFoundDecl() const
Definition: TypeLoc.h:1980
clang::SEHExceptStmt::getExceptLoc
SourceLocation getExceptLoc() const
Definition: Stmt.h:3225
clang::ObjCDictionaryLiteral::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:380
clang::SEHExceptStmt
Definition: Stmt.h:3205
clang::IfStmt::getElse
Stmt * getElse()
Definition: Stmt.h:1930
clang::VectorType::getElementType
QualType getElementType() const
Definition: Type.h:3270
clang::DeclStmt
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1225
clang::transformOMPMappableExprListClause
bool transformOMPMappableExprListClause(TreeTransform< Derived > &TT, OMPMappableExprListClause< T > *C, llvm::SmallVectorImpl< Expr *> &Vars, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperIdInfo, llvm::SmallVectorImpl< Expr *> &UnresolvedMappers)
Definition: TreeTransform.h:9154
clang::LabelDecl
Represents the declaration of a label.
Definition: Decl.h:451
OMPDeviceClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:4129
clang::CoroutineBodyStmt::CtorArgs
Definition: StmtCXX.h:347
clang::OMPSharedClause
This represents clause &#39;shared&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2370
clang::DependentVectorType
Represents a vector type where either the type or size is dependent.
Definition: Type.h:3312
clang::ObjCObjectTypeLoc::setProtocolRAngleLoc
void setProtocolRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:966
clang::TypeTraitExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:2691
clang::OMPProcBindClause::getProcBindKindKwLoc
SourceLocation getProcBindKindKwLoc() const
Returns location of clause kind.
Definition: OpenMPClause.h:993
clang::TreeTransform::RebuildPredefinedExpr
ExprResult RebuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentKind IK)
Build a new predefined expression.
Definition: TreeTransform.h:2180
clang::OMPCriticalDirective::getDirectiveName
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1699
clang::MSAsmStmt::getLBraceLoc
SourceLocation getLBraceLoc() const
Definition: Stmt.h:3124
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1931
clang::TreeTransform::RebuildAddrLabelExpr
ExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc, SourceLocation LabelLoc, LabelDecl *Label)
Build a new address-of-label expression.
Definition: TreeTransform.h:2520
clang::SwitchStmt::getCond
Expr * getCond()
Definition: Stmt.h:2103
OMPPriorityClause::getPriority
Expr * getPriority()
Return Priority number.
Definition: OpenMPClause.h:5284
clang::TreeTransform::RebuildCXXReinterpretCastExpr
ExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, SourceLocation LParenLoc, Expr *SubExpr, SourceLocation RParenLoc)
Build a new C++ reinterpret_cast expression.
Definition: TreeTransform.h:2654
clang::Sema::SemaBuiltinShuffleVector
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
Definition: SemaChecking.cpp:5989
clang::OMPArraySectionExpr::getColonLoc
SourceLocation getColonLoc() const
Definition: ExprOpenMP.h:108
clang::StmtExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:3979
Modifier
OpenMPLinearClauseKind Modifier
Modifier of &#39;linear&#39; clause.
Definition: OpenMPClause.h:101
clang::EST_Uninstantiated
not instantiated yet
Definition: ExceptionSpecificationType.h:31
clang::TreeTransform::RebuildUnaryExprOrTypeTrait
ExprResult RebuildUnaryExprOrTypeTrait(Expr *SubExpr, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a new sizeof, alignof or vec step expression with an expression argument.
Definition: TreeTransform.h:2272
clang::ObjCEncodeExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:425
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:48
clang::TemplateArgumentLocInventIterator::operator->
pointer operator->() const
Definition: TreeTransform.h:4182
clang::ObjCMessageExpr::getSuperLoc
SourceLocation getSuperLoc() const
Retrieve the location of the &#39;super&#39; keyword for a class or instance message to &#39;super&#39;, otherwise an invalid source location.
Definition: ExprObjC.h:1301
clang::ObjCObjectTypeLoc
Definition: TypeLoc.h:908
clang::ObjCEncodeExpr::getAtLoc
SourceLocation getAtLoc() const
Definition: ExprObjC.h:423
clang::OMPTaskwaitDirective
This represents &#39;#pragma omp taskwait&#39; directive.
Definition: StmtOpenMP.h:2147
clang::CXXNewExpr::getAllocatedType
QualType getAllocatedType() const
Definition: ExprCXX.h:2193
OMPMapClause::getMapType
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
Definition: OpenMPClause.h:5009
clang::TreeTransform::RebuildDeclRefExpr
ExprResult RebuildDeclRefExpr(NestedNameSpecifierLoc QualifierLoc, ValueDecl *VD, const DeclarationNameInfo &NameInfo, NamedDecl *Found, TemplateArgumentListInfo *TemplateArgs)
Build a new expression that references a declaration.
Definition: TreeTransform.h:2200
clang::ParenTypeLoc::getRParenLoc
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1121
clang::FunctionDecl::getParamDecl
const ParmVarDecl * getParamDecl(unsigned i) const
Definition: Decl.h:2422
SemaDiagnostic.h
clang::Attr::getLocation
SourceLocation getLocation() const
Definition: Attr.h:92
clang::concepts::ExprRequirement::getNoexceptLoc
SourceLocation getNoexceptLoc() const
Definition: ExprConcepts.h:350
clang::TypeLocBuilder::reserve
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
Definition: TypeLocBuilder.h:56
clang::TreeTransform::RebuildUnresolvedMemberExpr
ExprResult RebuildUnresolvedMemberExpr(Expr *BaseE, QualType BaseType, SourceLocation OperatorLoc, bool IsArrow, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs)
Build a new member reference expression.
Definition: TreeTransform.h:3012
clang::OMPLastprivateClause::getKindLoc
SourceLocation getKindLoc() const
Returns the location of the lastprivate kind.
Definition: OpenMPClause.h:2288
clang::OMPClause
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
clang::AttributedType::getEquivalentType
QualType getEquivalentType() const
Definition: Type.h:4576
clang::CanQual< Type >
clang::AtomicExpr
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:5849
clang::UnaryExprOrTypeTraitExpr::getKind
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2403
clang::OMPAllocateClause::getColonLoc
SourceLocation getColonLoc() const
Returns the location of the &#39;:&#39; delimiter.
Definition: OpenMPClause.h:388
clang::CXXNewExpr::isArray
bool isArray() const
Definition: ExprCXX.h:2223
clang::AutoTypeLoc::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: TypeLoc.h:2006
Ownership.h
clang::TreeTransform::AlwaysRebuild
bool AlwaysRebuild()
Whether the transformation should always rebuild AST nodes, even if none of the children have changed...
Definition: TreeTransform.h:153
clang::UnresolvedSetImpl::addDecl
void addDecl(NamedDecl *D)
Definition: UnresolvedSet.h:91
clang::ObjCProtocolExpr
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:503
clang::MemberPointerTypeLoc::getStarLoc
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1260
clang::Qualifiers::hasRestrict
bool hasRestrict() const
Definition: Type.h:270
clang::Expr::isValueDependent
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:158
clang::ObjCMessageExpr::getReceiverType
QualType getReceiverType() const
Retrieve the receiver type to which this message is being directed.
Definition: ExprObjC.cpp:344
clang::StmtExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: Expr.h:3977
clang::GotoStmt::getGotoLoc
SourceLocation getGotoLoc() const
Definition: Stmt.h:2497
clang::ObjCAtFinallyStmt::getAtFinallyLoc
SourceLocation getAtFinallyLoc() const
Definition: StmtObjC.h:148
llvm::SmallVector
Definition: LLVM.h:35
clang::Type::isObjCObjectPointerType
bool isObjCObjectPointerType() const
Definition: Type.h:6618
clang::RequiresExpr::getRBraceLoc
SourceLocation getRBraceLoc() const
Definition: ExprConcepts.h:516
clang::OMPIfClause::getNameModifierLoc
SourceLocation getNameModifierLoc() const
Return the location of directive name modifier.
Definition: OpenMPClause.h:499
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::GCCAsmStmt::getOutputConstraintLiteral
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:2979
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:741
clang::DependentTemplateSpecializationTypeLoc::setElaboratedKeywordLoc
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:2212
clang::ImplicitCastExpr
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3274
clang::CapturedStmt::getCapturedStmt
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:3477
clang::FunctionProtoTypeLoc
Definition: TypeLoc.h:1466
clang::ObjCAtCatchStmt::getAtCatchLoc
SourceLocation getAtCatchLoc() const
Definition: StmtObjC.h:105
clang::InitListExpr::getInits
Expr ** getInits()
Retrieve the set of initializers.
Definition: Expr.h:4436
clang::OMPTargetDirective
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2514
clang::GCCAsmStmt::getInputExpr
Expr * getInputExpr(unsigned i)
Definition: Stmt.cpp:451
clang::TreeTransform::RebuildCXXDefaultInitExpr
ExprResult RebuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Build a new C++11 default-initialization expression.
Definition: TreeTransform.h:2792
clang::TreeTransform::RebuildCXXTypeidExpr
ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a new C++ typeid(type) expression.
Definition: TreeTransform.h:2712
clang::Sema::BuildClassMessage
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
Definition: SemaExprObjC.cpp:2479
clang::OMPLastprivateClause::getColonLoc
SourceLocation getColonLoc() const
Returns the location of the &#39;:&#39; symbol, if any.
Definition: OpenMPClause.h:2290
clang::CXXForRangeStmt::getInit
Stmt * getInit()
Definition: StmtCXX.h:152
clang::OMPCollapseClause::getNumForLoops
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:835
clang::ArrayTypeLoc::setLBracketLoc
void setLBracketLoc(SourceLocation Loc)
Definition: TypeLoc.h:1493
clang::AutoType::getKeyword
AutoTypeKeyword getKeyword() const
Definition: Type.h:4920
clang::MSAsmStmt::getEndLoc
SourceLocation getEndLoc() const
Definition: Stmt.h:3126
clang::DesignatedInitExpr::getArrayRangeStart
Expr * getArrayRangeStart(const Designator &D) const
Definition: Expr.cpp:4413
clang::TemplateSpecializationTypeLoc::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: TypeLoc.h:1596
clang::ObjCBoxedExpr::getSubExpr
Expr * getSubExpr()
Definition: ExprObjC.h:142
clang::CharacterLiteral
Definition: Expr.h:1530
clang::ExpressionTraitExpr
An expression trait intrinsic.
Definition: ExprCXX.h:2785
clang::CXXTypeidExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:831
clang::EnumType::getDecl
EnumDecl * getDecl() const
Definition: Type.h:4528
clang::ParenListExpr::getExprs
Expr ** getExprs()
Definition: Expr.h:5180
clang::UnaryExprOrTypeTraitExpr::getArgumentExpr
Expr * getArgumentExpr()
Definition: Expr.h:2416
clang::ObjCMessageExpr::getMethodDecl
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1356
ExprOpenMP.h
clang::concepts::Requirement
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:132
clang::SwitchStmt::getConditionVariable
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Definition: Stmt.cpp:994
clang::OMPOrderedDirective
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2323
clang::StmtExpr
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3954
clang::Sema::ExtParameterInfoBuilder::set
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition: Sema.h:8624
clang::FunctionTypeLoc::getParams
ArrayRef< ParmVarDecl * > getParams() const
Definition: TypeLoc.h:1417
clang::OMPTargetUpdateDirective
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:3547
clang::Sema::RequireCompleteDeclContext
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
Definition: SemaCXXScopeSpec.cpp:199
clang::ObjCBoxedExpr
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
clang::UnaryExprOrTypeTraitExpr::isArgumentType
bool isArgumentType() const
Definition: Expr.h:2408
clang::TypeLoc::getFullDataSize
unsigned getFullDataSize() const
Returns the size of the type source info data block.
Definition: TypeLoc.h:163
clang::UnresolvedMemberExpr::getNamingClass
CXXRecordDecl * getNamingClass()
Retrieve the naming class of this lookup.
Definition: ExprCXX.cpp:1569
clang::PackExpansionType::getNumExpansions
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:5536
clang::TreeTransform::RebuildOMPHintClause
OMPClause * RebuildOMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;hint&#39; clause.
Definition: TreeTransform.h:1929
clang::IndirectGotoStmt::getStarLoc
SourceLocation getStarLoc() const
Definition: Stmt.h:2538
clang::OMPNumThreadsClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:635
clang::TemplateArgumentListInfo::setLAngleLoc
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:573
clang::LValueReferenceTypeLoc
Definition: TypeLoc.h:1315
clang::EST_DynamicNone
throw()
Definition: ExceptionSpecificationType.h:22
clang::TemplateArgumentListInfo::addArgument
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:594
clang::TemplateName::getAsDependentTemplateName
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Definition: TemplateName.cpp:150
clang::CXXNewExpr::getOperatorDelete
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2220
clang::OMPParallelMasterTaskLoopSimdDirective
This represents &#39;#pragma omp parallel master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3411
clang::ExpressionTraitExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:2819
clang::DependentScopeDeclRefExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Definition: ExprCXX.h:3217
clang::MSDependentExistsStmt
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:252
clang::Expr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:224
clang::TreeTransform::getBaseLocation
SourceLocation getBaseLocation()
Returns the location of the entity being transformed, if that information was not available elsewhere...
Definition: TreeTransform.h:166
clang::TreeTransform::RebuildParenExpr
ExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen, SourceLocation RParen)
Build a new expression in parentheses.
Definition: TreeTransform.h:2215
clang::DependentScopeDeclRefExpr
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3155
clang::ObjCForCollectionStmt::getElement
Stmt * getElement()
Definition: StmtObjC.h:34
clang::ArrayTypeLoc::getElementLoc
TypeLoc getElementLoc() const
Definition: TypeLoc.h:1517
clang::ObjCDictionaryElement::Value
Expr * Value
The value of the dictionary element.
Definition: ExprObjC.h:266
clang::CompoundLiteralExpr::getInitializer
const Expr * getInitializer() const
Definition: Expr.h:3103
clang::DependentAddressSpaceType::getPointeeType
QualType getPointeeType() const
Definition: Type.h:3167
clang::PackExpansionType
Represents a pack expansion of types.
Definition: Type.h:5511
clang::BinaryOperator::getLHS
Expr * getLHS() const
Definition: Expr.h:3474
clang::CompoundAssignOperator
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3654
clang::CXXInheritedCtorInitExpr::getLocation
SourceLocation getLocation() const LLVM_READONLY
Definition: ExprCXX.h:1664
clang::ObjCArrayLiteral::getElements
Expr ** getElements()
Retrieve elements of array of literals.
Definition: ExprObjC.h:219
clang::TreeTransform::RebuildUnaryOperator
ExprResult RebuildUnaryOperator(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *SubExpr)
Build a new unary operator expression.
Definition: TreeTransform.h:2237
clang::DeclarationNameLoc
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
Definition: DeclarationName.h:650
clang::FunctionTypeLoc::setLParenLoc
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1390
clang::TemplateSpecializationTypeLoc::setTemplateKeywordLoc
void setTemplateKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:1584
clang::GenericSelectionExpr
Represents a C11 generic selection.
Definition: Expr.h:5234
clang::SizeOfPackExpr::getPartialArguments
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:4184
clang::ASTTemplateArgumentListInfo::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
Definition: TemplateBase.h:626
clang::ObjCObjectTypeLoc::setTypeArgsLAngleLoc
void setTypeArgsLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:928
clang::ExtVectorElementExpr::getBase
const Expr * getBase() const
Definition: Expr.h:5536
clang::ObjCMessageExpr::getInstanceReceiver
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1260
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3910
clang::ObjCBridgedCastExpr
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1638
clang::TypedefNameDecl
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3071
clang::TypeofLikeTypeLoc::getTypeofLoc
SourceLocation getTypeofLoc() const
Definition: TypeLoc.h:1800
clang::FunctionParmPackExpr
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4337
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:50
OMPMapClause::getMapTypeModifiers
ArrayRef< OpenMPMapModifierKind > getMapTypeModifiers() const LLVM_READONLY
Fetches ArrayRef of map-type-modifiers.
Definition: OpenMPClause.h:5038
clang::DeducedType::isDeduced
bool isDeduced() const
Definition: Type.h:4862
clang::MSPropertyRefExpr::getMemberLoc
SourceLocation getMemberLoc() const
Definition: ExprCXX.h:922
clang::CXXPseudoDestructorExpr::getDestroyedTypeInfo
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition: ExprCXX.h:2572
clang::MemberPointerTypeLoc::getClassTInfo
TypeSourceInfo * getClassTInfo() const
Definition: TypeLoc.h:1272
clang::Sema::getNonTagTypeDeclKind
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
Definition: SemaDecl.cpp:14625
clang::MSPropertySubscriptExpr::getBase
Expr * getBase()
Definition: ExprCXX.h:963
clang::BinaryConditionalOperator::getFalseExpr
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:3867
clang::QualifiedTemplateName
Represents a template name that was expressed as a qualified name.
Definition: TemplateName.h:390
Type
Optional< types::ID > Type
Definition: InterpolatingCompilationDatabase.cpp:127
clang::TagTypeKind
TagTypeKind
The kind of a tag type.
Definition: Type.h:5187
clang::NullStmt
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1297
clang::LambdaExpr::isMutable
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
Definition: ExprCXX.cpp:1318
clang::OpenMPScheduleClauseModifier
OpenMPScheduleClauseModifier
OpenMP modifiers for &#39;schedule&#39; clause.
Definition: OpenMPKinds.h:93
clang::CXXTypeidExpr::isTypeOperand
bool isTypeOperand() const
Definition: ExprCXX.h:804
clang::TemplateName::isNull
bool isNull() const
Determine whether this template name is NULL.
Definition: TemplateName.cpp:78
Decl.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::TreeTransform::RebuildIndirectGotoStmt
StmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *Target)
Build a new indirect goto statement.
Definition: TreeTransform.h:1357
OMPDependClause::getColonLoc
SourceLocation getColonLoc() const
Get colon location.
Definition: OpenMPClause.h:4046
OMPDeviceClause
This represents &#39;device&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4089
clang::NestedNameSpecifierLoc::getNestedNameSpecifier
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Definition: NestedNameSpecifier.h:267
clang::TemplateArgument::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
Definition: TemplateBase.cpp:217
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:106
clang::AsmStmt::isVolatile
bool isVolatile() const
Definition: Stmt.h:2755
clang::Sema::ArgumentPackSubstitutionIndex
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:8200
OMPDefaultmapClause::getDefaultmapKind
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
Definition: OpenMPClause.h:5735
clang::ConceptDecl
Definition: DeclTemplate.h:3226
clang::TreeTransform::TransformCXXNamedCastExpr
ExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E)
Definition: TreeTransform.h:10531
clang::MemberExpr::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:2992
clang::CoroutineBodyStmt::getReturnStmtOnAllocFailure
Stmt * getReturnStmtOnAllocFailure() const
Definition: StmtCXX.h:414
clang::WhileStmt::getConditionVariable
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
Definition: Stmt.cpp:1050
clang::TemplateArgumentLoc::getArgument
const TemplateArgument & getArgument() const
Definition: TemplateBase.h:498
clang::EST_Unevaluated
not evaluated yet, for special member function
Definition: ExceptionSpecificationType.h:30
clang::CoroutineBodyStmt::getAllocate
Expr * getAllocate() const
Definition: StmtCXX.h:403
clang::PredefinedExpr
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1903
clang::MemberExpr::getMemberNameInfo
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Definition: Expr.h:3013
clang::UnaryOperatorKind
UnaryOperatorKind
Definition: OperationKinds.h:30
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
clang::ObjCPropertyRefExpr::getLocation
SourceLocation getLocation() const
Definition: ExprObjC.h:763
clang::RequiresExpr::getBody
RequiresExprBodyDecl * getBody() const
Definition: ExprConcepts.h:498
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2359
clang::BlockDecl::captures
ArrayRef< Capture > captures() const
Definition: Decl.h:4164
clang::GCCAsmStmt::getOutputIdentifier
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition: Stmt.h:2968
clang::TreeTransform::RebuildCompoundLiteralExpr
ExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *Init)
Build a new compound literal expression.
Definition: TreeTransform.h:2428
clang::TemplateDecl
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:402
clang::AsmStmt::isSimple
bool isSimple() const
Definition: Stmt.h:2752
clang::TemplateArgumentLocInventIterator::pointer
Definition: TreeTransform.h:4150
clang::CXXOperatorCallExpr::getOperator
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:107
ModifierLoc
SourceLocation ModifierLoc
Location of linear modifier if any.
Definition: OpenMPClause.h:104
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::BlockDecl::isVariadic
bool isVariadic() const
Definition: Decl.h:4112
clang::Sema::ImpCastExprToType
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type &#39;Type&#39;, insert an implicit cast.
Definition: Sema.cpp:529
clang::CXXForRangeStmt::getCond
Expr * getCond()
Definition: StmtCXX.h:166
clang::MSPropertyRefExpr::getPropertyDecl
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:920
clang::ObjCAtFinallyStmt::getFinallyBody
const Stmt * getFinallyBody() const
Definition: StmtObjC.h:139
clang::TypeLoc::getType
QualType getType() const
Get the type for which this source info wrapper provides information.
Definition: TypeLoc.h:132
clang::CXXForRangeStmt::getBody
Stmt * getBody()
Definition: StmtCXX.h:169
clang::AttributedStmt::getAttrs
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:1812
clang::CXXThisExpr::isImplicit
bool isImplicit() const
Definition: ExprCXX.h:1118
clang::TreeTransform::RebuildOMPDistScheduleClause
OMPClause * RebuildOMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;dist_schedule&#39; clause.
Definition: TreeTransform.h:1940
clang::CoroutineBodyStmt::hasDependentPromiseType
bool hasDependentPromiseType() const
Definition: StmtCXX.h:372
clang::OMPSectionDirective
This represents &#39;#pragma omp section&#39; directive.
Definition: StmtOpenMP.h:1472
clang::TreeTransform::RebuildElaboratedType
QualType RebuildElaboratedType(SourceLocation KeywordLoc, ElaboratedTypeKeyword Keyword, NestedNameSpecifierLoc QualifierLoc, QualType Named)
Build a new qualified name type.
Definition: TreeTransform.h:996
clang::OMPTeamsDistributeDirective
This represents &#39;#pragma omp teams distribute&#39; directive.
Definition: StmtOpenMP.h:3961
clang::CoroutineBodyStmt::getReturnValueInit
Expr * getReturnValueInit() const
Definition: StmtCXX.h:409
clang::TreeTransform::RebuildCXXFunctionalCastExpr
ExprResult RebuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, SourceLocation LParenLoc, Expr *Sub, SourceLocation RParenLoc, bool ListInitialization)
Build a new C++ functional-style cast expression.
Definition: TreeTransform.h:2688
clang::TemplateArgumentLoc::getSourceExpression
Expr * getSourceExpression() const
Definition: TemplateBase.h:511
clang::FunctionType::ExtParameterInfo
Interesting information about a specific parameter that can&#39;t simply be reflected in parameter&#39;s type...
Definition: Type.h:3448
clang::ObjCDictionaryElement::EllipsisLoc
SourceLocation EllipsisLoc
The location of the ellipsis, if this is a pack expansion.
Definition: ExprObjC.h:269
clang::NestedNameSpecifier::isDependent
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
Definition: NestedNameSpecifier.cpp:202
clang::CXXUnresolvedConstructExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
Definition: ExprCXX.h:3429
clang::VarDecl::getInit
const Expr * getInit() const
Definition: Decl.h:1229
clang::Decl::getAccess
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
clang::TreeTransform::Owned
static ExprResult Owned(Expr *E)
Definition: TreeTransform.h:137
clang::ObjCAvailabilityCheckExpr
A runtime availability query.
Definition: ExprObjC.h:1699
clang::DependentSizedExtVectorTypeLoc
Definition: TypeLoc.h:1771
clang::UnaryTransformType::UTTKind
UTTKind
Definition: Type.h:4415
clang::TemplateArgumentLocContainerIterator::TemplateArgumentLocContainerIterator
TemplateArgumentLocContainerIterator(ArgLocContainer &Container, unsigned Index)
Definition: TreeTransform.h:6059
clang::PipeTypeLoc
Definition: TypeLoc.h:2417
clang::QualType::hasLocalQualifiers
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Definition: Type.h:756
clang::CXXReinterpretCastExpr
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:487
clang::OMPSimdDirective
This represents &#39;#pragma omp simd&#39; directive.
Definition: StmtOpenMP.h:1194
clang::PseudoDestructorTypeStorage::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:2444
clang::SEHTryStmt::getHandler
Stmt * getHandler() const
Definition: Stmt.h:3317
clang::DependentTemplateSpecializationTypeLoc::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: TypeLoc.h:2264
clang::CoyieldExpr
Represents a &#39;co_yield&#39; expression.
Definition: ExprCXX.h:4786
clang::CXXDependentScopeMemberExpr::getMember
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3657
clang::InitListExpr::getLBraceLoc
SourceLocation getLBraceLoc() const
Definition: Expr.h:4550
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::Stmt::getStmtClass
StmtClass getStmtClass() const
Definition: Stmt.h:1109
clang::ObjCTypeParamDecl
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:571
clang::VectorType::getVectorKind
VectorKind getVectorKind() const
Definition: Type.h:3280
clang::ParmVarDecl::getDefaultArg
Expr * getDefaultArg()
Definition: Decl.cpp:2710
clang::LambdaExpr::getIntroducerRange
SourceRange getIntroducerRange() const
Retrieve the source range covering the lambda introducer, which contains the explicit capture list su...
Definition: ExprCXX.h:1988
clang::NamedDecl::isCXXClassMember
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
Definition: Decl.h:328
clang::CoreturnStmt::getOperand
Expr * getOperand() const
Retrieve the operand of the &#39;co_return&#39; statement.
Definition: StmtCXX.h:480
OMPDefaultmapClause::getLParenLoc
SourceLocation getLParenLoc()
Get location of &#39;(&#39;.
Definition: OpenMPClause.h:5743
clang::PackExpansionExpr
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4015
clang::CXXConstructExpr::isListInitialization
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1513
clang::TreeTransform::RebuildOMPOrderedClause
OMPClause * RebuildOMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Num)
Build a new OpenMP &#39;ordered&#39; clause.
Definition: TreeTransform.h:1645
clang::CoawaitExpr::isImplicit
bool isImplicit() const
Definition: ExprCXX.h:4725
clang::UnresolvedSet< 8 >
clang::OMPUnifiedSharedMemoryClause
This represents &#39;unified_shared_memory&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1065
clang::OMPLinearClause
This represents clause &#39;linear&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3166
clang::ConceptReference::getNestedNameSpecifierLoc
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
Definition: ASTConcept.h:138
clang::EnumDecl
Represents an enum.
Definition: Decl.h:3481
clang::ASTTemplateArgumentListInfo::LAngleLoc
SourceLocation LAngleLoc
The source location of the left angle bracket (&#39;<&#39;).
Definition: TemplateBase.h:614
clang::ObjCAtSynchronizedStmt::getSynchExpr
const Expr * getSynchExpr() const
Definition: StmtObjC.h:305
clang::TreeTransform::RebuildOMPLinearClause
OMPClause * RebuildOMPLinearClause(ArrayRef< Expr *> VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;linear&#39; clause.
Definition: TreeTransform.h:1754
clang::CoroutineBodyStmt::getInitSuspendStmt
Stmt * getInitSuspendStmt() const
Definition: StmtCXX.h:389
clang::ExpressionTrait
ExpressionTrait
Definition: ExpressionTraits.h:19
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2833
clang::VarDecl::isParameterPack
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack...
Definition: Decl.cpp:2464
clang::Qualifiers::hasObjCLifetime
bool hasObjCLifetime() const
Definition: Type.h:332
clang::PointerLikeTypeLoc::setSigilLoc
void setSigilLoc(SourceLocation Loc)
Definition: TypeLoc.h:1204
clang::MSDependentExistsStmt::isIfExists
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:277
clang::Sema::FullExprArg::get
Expr * get() const
Definition: Sema.h:4072
clang::AttributedTypeLoc::getModifiedLoc
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
Definition: TypeLoc.h:868
clang::CapturedStmt::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3568
clang::SourceLocExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: Expr.h:4339
clang::MSPropertyRefExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Definition: ExprCXX.h:923
clang::TreeTransform::RebuildCaseStmtBody
StmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body)
Attach the body to a new case statement.
Definition: TreeTransform.h:1248
clang::TemplateArgumentListInfo::arguments
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Definition: TemplateBase.h:582
clang::UnresolvedMemberExpr::getMemberNameInfo
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the full name info for the member that this expression refers to.
Definition: ExprCXX.h:3880
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:690
OMPDefaultmapClause::getDefaultmapModifier
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
Definition: OpenMPClause.h:5738
clang::TemplateArgumentLocContainerIterator::value_type
TemplateArgumentLoc value_type
Definition: TreeTransform.h:6040
clang::LambdaExpr::getTemplateParameterList
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it...
Definition: ExprCXX.cpp:1297
clang::OMPAtomicDirective
This represents &#39;#pragma omp atomic&#39; directive.
Definition: StmtOpenMP.h:2379
clang::concepts::ExprRequirement::isExprSubstitutionFailure
bool isExprSubstitutionFailure() const
Definition: ExprConcepts.h:354
clang::OMPClause::getBeginLoc
SourceLocation getBeginLoc() const
Returns the starting location of the clause.
Definition: OpenMPClause.h:67
clang::TemplateArgument::pack_begin
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Definition: TemplateBase.h:339
clang::SubstTemplateTypeParmType::getReplacedParameter
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Definition: Type.h:4743
clang::TemplateArgument::isNull
bool isNull() const
Determine whether this template argument has no value.
Definition: TemplateBase.h:237
OMPNumTasksClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5459
clang::ObjCBridgedCastExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: ExprObjC.h:1662
clang::Sema::SemaConvertVectorExpr
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
Definition: SemaChecking.cpp:6075
OMPMapClause::isImplicitMapType
bool isImplicitMapType() const LLVM_READONLY
Is this an implicit map type? We have to capture &#39;IsMapTypeImplicit&#39; from the parser for more informa...
Definition: OpenMPClause.h:5016
clang::CXXTypeidExpr::getTypeOperandSourceInfo
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:811
clang::TreeTransform::RebuildConceptSpecializationExpr
ExprResult RebuildConceptSpecializationExpr(NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, TemplateArgumentListInfo *TALI)
Build a new Objective-C boxed expression.
Definition: TreeTransform.h:3065
clang::DesignatedInitExpr::getArrayRangeEnd
Expr * getArrayRangeEnd(const Designator &D) const
Definition: Expr.cpp:4419
clang::ElaboratedTypeLoc::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:2100
clang::SEHLeaveStmt
Represents a __leave statement.
Definition: Stmt.h:3337
clang::ElaboratedTypeLoc::getElaboratedKeywordLoc
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:2092
clang::AttributedType::getModifiedType
QualType getModifiedType() const
Definition: Type.h:4575
clang::FunctionTypeLoc::getNumParams
unsigned getNumParams() const
Definition: TypeLoc.h:1426
clang::AutoTypeLoc
Definition: TypeLoc.h:1942
clang::AddrLabelExpr::getLabel
LabelDecl * getLabel() const
Definition: Expr.h:3932
clang::DependentNameTypeLoc::setNameLoc
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:2175
clang::Sema::BuildInstanceMessage
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Definition: SemaExprObjC.cpp:2702
clang::ArrayTypeLoc::getRBracketLoc
SourceLocation getRBracketLoc() const
Definition: TypeLoc.h:1497
clang::OMPClause::getEndLoc
SourceLocation getEndLoc() const
Returns the ending location of the clause.
Definition: OpenMPClause.h:70
clang::CXXNoexceptExpr
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3958
clang::TypeLoc::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:152
clang::SwitchStmt
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2043
clang::CXXPseudoDestructorExpr::getColonColonLoc
SourceLocation getColonColonLoc() const
Retrieve the location of the &#39;::&#39; in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2560
clang::TreeTransform::RebuildTemplateIdExpr
ExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
Build a new template-id expression.
Definition: TreeTransform.h:2909
clang::TreeTransform::RebuildOMPFromClause
OMPClause * RebuildOMPFromClause(ArrayRef< Expr *> VarList, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, const OMPVarListLocTy &Locs, ArrayRef< Expr *> UnresolvedMappers)
Build a new OpenMP &#39;from&#39; clause.
Definition: TreeTransform.h:1965
clang::TreeTransform::RebuildOMPCopyprivateClause
OMPClause * RebuildOMPCopyprivateClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;copyprivate&#39; clause.
Definition: TreeTransform.h:1795
clang::CXXDeleteExpr::getBeginLoc
SourceLocation getBeginLoc() const
Definition: ExprCXX.h:2410
clang::PointerLikeTypeLoc::getPointeeLoc
TypeLoc getPointeeLoc() const
Definition: TypeLoc.h:1208
clang::OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
clang::DependentScopeDeclRefExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
Definition: ExprCXX.h:3207
clang::ObjCForCollectionStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: StmtObjC.h:54
clang::DeclRefExpr::getNameInfo
DeclarationNameInfo getNameInfo() const
Definition: Expr.h:1251
clang::CoroutineBodyStmt
Represents the body of a coroutine.
Definition: StmtCXX.h:317
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4495
clang::Sema::BuildObjCEncodeExpression
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
Definition: SemaExprObjC.cpp:1072
clang::TemplateArgumentLoc
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:449
clang::ArrayType::getIndexTypeCVRQualifiers
unsigned getIndexTypeCVRQualifiers() const
Definition: Type.h:2920
clang::TreeTransform::RebuildVAArgExpr
ExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc, Expr *SubExpr, TypeSourceInfo *TInfo, SourceLocation RParenLoc)
Build a new va_arg expression.
Definition: TreeTransform.h:2497
clang::ObjCIsaExpr::getBase
Expr * getBase() const
Definition: ExprObjC.h:1518
clang::TreeTransform::RebuildBinaryOperator
ExprResult RebuildBinaryOperator(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHS, Expr *RHS)
Build a new binary operator expression.
Definition: TreeTransform.h:2382
clang::ShuffleVectorExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:4017
clang::ReferenceTypeLoc
Definition: TypeLoc.h:1307
clang::TreeTransform::RebuildChooseExpr
ExprResult RebuildChooseExpr(SourceLocation BuiltinLoc, Expr *Cond, Expr *LHS, Expr *RHS, SourceLocation RParenLoc)
Build a new __builtin_choose_expr expression.
Definition: TreeTransform.h:2539
clang::ArraySubscriptExpr
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2462
clang::ObjCObjectTypeLoc::getTypeArgTInfo
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
Definition: TypeLoc.h:944
clang::OMPDefaultClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:906
clang::OMPIfClause::getNameModifier
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
Definition: OpenMPClause.h:496
clang::ObjCArrayLiteral::getNumElements
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition: ExprObjC.h:227
clang::Sema::ContextRAII::pop
void pop()
Definition: Sema.h:816
clang::TreeTransform::RebuildOMPMapClause
OMPClause * RebuildOMPMapClause(ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec MapperIdScopeSpec, DeclarationNameInfo MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr *> VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr *> UnresolvedMappers)
Build a new OpenMP &#39;map&#39; clause.
Definition: TreeTransform.h:1843
StmtOpenMP.h
This file defines OpenMP AST classes for executable directives and clauses.
clang::ObjCForCollectionStmt
Represents Objective-C&#39;s collection statement.
Definition: StmtObjC.h:23
clang::ConstantArrayTypeLoc
Definition: TypeLoc.h:1534
clang::DependentNameTypeLoc
Definition: TypeLoc.h:2146
clang::TypedefTypeLoc::getTypedefNameDecl
TypedefNameDecl * getTypedefNameDecl() const
Definition: TypeLoc.h:674
clang::TemplateSpecializationTypeLoc::getTemplateNameLoc
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:1620
clang::ObjCEncodeExpr
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
clang::SizeOfPackExpr::getRParenLoc
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
Definition: ExprCXX.h:4159
clang::AtomicTypeLoc::getKWLoc
SourceLocation getKWLoc() const
Definition: TypeLoc.h:2369
clang::AtomicTypeLoc::getRParenLoc
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:2385
clang::TreeTransform::RebuildOMPGrainsizeClause
OMPClause * RebuildOMPGrainsizeClause(Expr *Grainsize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;grainsize&#39; clause.
Definition: TreeTransform.h:1907
clang::ObjCIvarRefExpr::getLocation
SourceLocation getLocation() const
Definition: ExprObjC.h:589
clang::ConstantArrayType::getSize
const llvm::APInt & getSize() const
Definition: Type.h:2958
clang::DeducedTemplateSpecializationTypeLoc::setTemplateNameLoc
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:2075
clang::CUDAKernelCallExpr
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:224
clang::Type::isFunctionType
bool isFunctionType() const
Definition: Type.h:6500
clang::ChooseExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:4185
clang::CoawaitExpr
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4699
clang::TreeTransform::RebuildSwitchStmtStart
StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init, Sema::ConditionResult Cond)
Start building a new switch statement.
Definition: TreeTransform.h:1298
clang::OMPFinalClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:564
clang::ObjCIndirectCopyRestoreExpr::getSubExpr
Expr * getSubExpr()
Definition: ExprObjC.h:1602
clang::TemplateArgumentLocInventIterator::difference_type
std::iterator_traits< InputIterator >::difference_type difference_type
Definition: TreeTransform.h:4147
clang::DeclaratorDecl::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:700
clang::SwitchStmt::getInit
Stmt * getInit()
Definition: Stmt.h:2124
clang::OMPInReductionClause::getColonLoc
SourceLocation getColonLoc() const
Gets location of &#39;:&#39; symbol in clause.
Definition: OpenMPClause.h:3078
clang::GCCAsmStmt::getLabelExpr
AddrLabelExpr * getLabelExpr(unsigned i) const
Definition: Stmt.cpp:459
clang::UnqualifiedId::setOperatorFunctionId
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
Definition: DeclSpec.cpp:1377
clang::CXXNewExpr::getDirectInitRange
SourceRange getDirectInitRange() const
Definition: ExprCXX.h:2342
clang::CXXDependentScopeMemberExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information...
Definition: ExprCXX.h:3632
clang::OpenMPScheduleClauseKind
OpenMPScheduleClauseKind
OpenMP attributes for &#39;schedule&#39; clause.
Definition: OpenMPKinds.h:85
clang::ObjCTypeParamTypeLoc::getProtocolLoc
SourceLocation getProtocolLoc(unsigned i) const
Definition: TypeLoc.h:792
clang::ArrayTypeLoc::getSizeExpr
Expr * getSizeExpr() const
Definition: TypeLoc.h:1509
CoroutineStmtBuilder.h
clang::UnaryOperator::getOpcode
Opcode getOpcode() const
Definition: Expr.h:2071
clang::CXXConstructExpr::getArg
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1573
clang::TreeTransform::RebuildOMPCopyinClause
OMPClause * RebuildOMPCopyinClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;copyin&#39; clause.
Definition: TreeTransform.h:1783
clang::ReferenceType
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2750
clang::NestedNameSpecifierLoc::getEndLoc
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
Definition: NestedNameSpecifier.h:298
clang::DeclStmt::decls
decl_range decls()
Definition: Stmt.h:1273
clang::ConstantArrayType::getSizeExpr
const Expr * getSizeExpr() const
Definition: Type.h:2959
clang::CapturedDecl::getParam
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4273
clang::TypeLoc::getTypeLocClass
TypeLocClass getTypeLocClass() const
Definition: TypeLoc.h:115
clang::ObjCObjectTypeLoc::setTypeArgsRAngleLoc
void setTypeArgsRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:936
clang::RecordTypeLoc
Wrapper for source info for record types.
Definition: TypeLoc.h:718
clang::ArrayTypeLoc::getLBracketLoc
SourceLocation getLBracketLoc() const
Definition: TypeLoc.h:1489
clang::ObjCAtFinallyStmt
Represents Objective-C&#39;s @finally statement.
Definition: StmtObjC.h:127
clang::GenericSelectionExpr::getDefaultLoc
SourceLocation getDefaultLoc() const
Definition: Expr.h:5486
clang::ExceptionSpecificationType
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Definition: ExceptionSpecificationType.h:20
clang::ObjCObjectPointerTypeLoc
Wraps an ObjCPointerType with source location information.
Definition: TypeLoc.h:1294
clang::FunctionProtoType::ExceptionSpecInfo
Holds information about the various types of exception specification.
Definition: Type.h:3811
clang::MSAsmStmt::getAsmString
StringRef getAsmString() const
Definition: Stmt.h:3135
clang::OpenMPDefaultClauseKind
OpenMPDefaultClauseKind
OpenMP attributes for &#39;default&#39; clause.
Definition: OpenMPKinds.h:77
clang::MSAsmStmt::getAllConstraints
ArrayRef< StringRef > getAllConstraints() const
Definition: Stmt.h:3169
clang::DependentTemplateSpecializationTypeLoc::getNumArgs
unsigned getNumArgs() const
Definition: TypeLoc.h:2272
OMPDistScheduleClause::getDistScheduleKindLoc
SourceLocation getDistScheduleKindLoc()
Get kind location.
Definition: OpenMPClause.h:5628
clang::OMPExecutableDirective::hasAssociatedStmt
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Definition: StmtOpenMP.h:250
clang::TreeTransform::RebuildDependentCoawaitExpr
ExprResult RebuildDependentCoawaitExpr(SourceLocation CoawaitLoc, Expr *Result, UnresolvedLookupExpr *Lookup)
Build a new co_await expression.
Definition: TreeTransform.h:1436
clang::ObjCIvarRefExpr::getBase
const Expr * getBase() const
Definition: ExprObjC.h:580
clang::sema::CapturingScopeInfo::CaptureMap
llvm::DenseMap< VarDecl *, unsigned > CaptureMap
CaptureMap - A map of captured variables to (index+1) into Captures.
Definition: ScopeInfo.h:644
clang::CXXDependentScopeMemberExpr::isArrow
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3618
clang::MemberExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:3001
clang::OMPTaskReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:2836
clang::SwitchCase::getColonLoc
SourceLocation getColonLoc() const
Definition: Stmt.h:1481
clang::OMPWriteClause
This represents &#39;write&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1725
clang::ParenTypeLoc::getLParenLoc
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1117
clang::TreeTransform::RebuildCXXStaticCastExpr
ExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, SourceLocation LParenLoc, Expr *SubExpr, SourceLocation RParenLoc)
Build a new C++ static_cast expression.
Definition: TreeTransform.h:2620
clang::TreeTransform::RebuildCoroutineBodyStmt
StmtResult RebuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs Args)
Definition: TreeTransform.h:1450
clang::DeclarationNameInfo::setNamedTypeInfo
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
Definition: DeclarationName.h:740
clang::AsmStmt::getNumClobbers
unsigned getNumClobbers() const
Definition: Stmt.h:2800
clang::CoreturnStmt::isImplicit
bool isImplicit() const
Definition: StmtCXX.h:489
clang::ForStmt::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Stmt.h:2460
clang::ObjCIvarRefExpr
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:546
clang::FunctionProtoType::ExceptionSpecInfo::Exceptions
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3816
clang::SizeOfPackExpr::isPartiallySubstituted
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:4179
clang::TreeTransform::RebuildCoawaitExpr
ExprResult RebuildCoawaitExpr(SourceLocation CoawaitLoc, Expr *Result, bool IsImplicit)
Build a new co_await expression.
Definition: TreeTransform.h:1427
clang::CXXForRangeStmt::getRangeStmt
DeclStmt * getRangeStmt()
Definition: StmtCXX.h:161
clang::CXXUnresolvedConstructExpr::arg_size
unsigned arg_size() const
Retrieve the number of arguments.
Definition: ExprCXX.h:3447
clang::BlockDecl::capturesCXXThis
bool capturesCXXThis() const
Definition: Decl.h:4169
clang::Sema::LookupQualifiedName
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Definition: SemaLookup.cpp:2221
OMPThreadLimitClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:5206
clang::ObjCObjectTypeLoc::getBaseLoc
TypeLoc getBaseLoc() const
Definition: TypeLoc.h:1002
clang::QualifiedTypeLoc::getUnqualifiedLoc
UnqualTypeLoc getUnqualifiedLoc() const
Definition: TypeLoc.h:281
clang::AutoTypeLoc::setRAngleLoc
void setRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2010
clang::ChooseExpr::getRHS
Expr * getRHS() const
Definition: Expr.h:4179
clang::OverloadExpr::decls
llvm::iterator_range< decls_iterator > decls() const
Definition: ExprCXX.h:2942
clang::CXXUnresolvedConstructExpr
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
clang::AsmStmt::getAsmLoc
SourceLocation getAsmLoc() const
Definition: Stmt.h:2749
clang::GotoStmt
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2481
clang::CXXDefaultInitExpr
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1279
clang::IndirectGotoStmt::getTarget
Expr * getTarget()
Definition: Stmt.h:2540
clang::DependentVectorType::getVectorKind
VectorType::VectorKind getVectorKind() const
Definition: Type.h:3328
clang::TypeSourceInfo::getTypeLoc
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Definition: TypeLoc.h:244
clang::CXXFunctionalCastExpr::isListInitialization
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:1725
clang::ConvertVectorExpr::getSrcExpr
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:4091
clang::CXXDependentScopeMemberExpr::getLAngleLoc
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Definition: ExprCXX.h:3673
clang::TypedefType::getDecl
TypedefNameDecl * getDecl() const
Definition: Type.h:4256
X
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:14780
clang::DependentTemplateSpecializationTypeLoc::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: TypeLoc.h:2256
clang::NestedNameSpecifierLoc::getOpaqueData
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
Definition: NestedNameSpecifier.h:272
clang::ObjCObjectTypeLoc::getTypeArgsLAngleLoc
SourceLocation getTypeArgsLAngleLoc() const
Definition: TypeLoc.h:924
clang::TemplateArgument::pack_end
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
Definition: TemplateBase.h:346
clang::FunctionProtoType::ExceptionSpecInfo::NoexceptExpr
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition: Type.h:3819
clang::Designation::AddDesignator
void AddDesignator(Designator D)
AddDesignator - Add a designator to the end of this list.
Definition: Designator.h:186
clang::OMPOrderedClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:1529
clang::CapturedStmt::getCapturedDecl
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1298
clang::TemplateArgument::getKind
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:234
clang::AttributedType
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:4550
clang::ObjCIvarRefExpr::isFreeIvar
bool isFreeIvar() const
Definition: ExprObjC.h:585
clang::DoStmt::getCond
Expr * getCond()
Definition: Stmt.h:2372
clang::TemplateArgumentLocInventIterator::pointer::pointer
pointer(TemplateArgumentLoc Arg)
Definition: TreeTransform.h:4154
clang::AtomicTypeLoc::setKWLoc
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:2373
clang::DeclarationName::getCXXDeductionGuideTemplate
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
Definition: DeclarationName.h:451
clang::OMPInReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:3081
clang::ObjCTypeParamType
Represents a type parameter type in Objective C.
Definition: Type.h:5620
clang::TreeTransform::RebuildWhileStmt
StmtResult RebuildWhileStmt(SourceLocation WhileLoc, Sema::ConditionResult Cond, Stmt *Body)
Build a new while statement.
Definition: TreeTransform.h:1316
clang::CXXScopeSpec::Extend
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form &#39;type...
Definition: DeclSpec.cpp:46
clang::IfStmt::getConditionVariable
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
Definition: Stmt.cpp:887
clang::OMPScheduleClause::getSecondScheduleModifier
OpenMPScheduleClauseModifier getSecondScheduleModifier() const
Get the second modifier of the clause.
Definition: OpenMPClause.h:1416
clang::ASTContext::getTranslationUnitDecl
TranslationUnitDecl * getTranslationUnitDecl() const
Definition: ASTContext.h:1009
clang::MemberExpr
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2836
clang::DoStmt::getWhileLoc
SourceLocation getWhileLoc() const
Definition: Stmt.h:2385
clang::VectorType::VectorKind
VectorKind
Definition: Type.h:3237
clang::TreeTransform::RebuildOMPTaskReductionClause
OMPClause * RebuildOMPTaskReductionClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr *> UnresolvedReductions)
Build a new OpenMP &#39;task_reduction&#39; clause.
Definition: TreeTransform.h:1723
clang::NestedNameSpecifierLocBuilder::getWithLocInContext
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Definition: NestedNameSpecifier.cpp:700
clang::TreeTransform::DropCallArgument
bool DropCallArgument(Expr *E)
Determine whether the given call argument should be dropped, e.g., because it is a default argument...
Definition: TreeTransform.h:221
clang::DependentSizedArrayTypeLoc
Definition: TypeLoc.h:1546
clang::ExprResult
ActionResult< Expr * > ExprResult
Definition: Ownership.h:263
clang::QualType::getUnqualifiedType
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Definition: Type.h:6336
clang::OMPTargetParallelDirective
This represents &#39;#pragma omp target parallel&#39; directive.
Definition: StmtOpenMP.h:2748
clang::OMPNowaitClause
This represents &#39;nowait&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1569
ExprConcepts.h
Defines Expressions and AST nodes for C++2a concepts.
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
clang::TreeTransform::RebuildPackExpansion
TemplateArgumentLoc RebuildPackExpansion(TemplateArgumentLoc Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Build a new template argument pack expansion.
Definition: TreeTransform.h:3344
clang::DependentTemplateSpecializationType
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:5420
clang::ContinueStmt
ContinueStmt - This represents a continue.
Definition: Stmt.h:2569
clang::MSPropertySubscriptExpr::getExprLoc
SourceLocation getExprLoc() const LLVM_READONLY
Definition: ExprCXX.h:978
clang::OMPScheduleClause::getFirstScheduleModifier
OpenMPScheduleClauseModifier getFirstScheduleModifier() const
Get the first modifier of the clause.
Definition: OpenMPClause.h:1411
clang::TreeTransform::ReplacingOriginal
bool ReplacingOriginal()
Whether the transformation is forming an expression or statement that replaces the original...
Definition: TreeTransform.h:158
clang::ArrayInitLoopExpr
Represents a loop initializing the elements of an array.
Definition: Expr.h:5027
clang::TemplateArgumentLocContainerIterator::pointer::operator->
const TemplateArgumentLoc * operator->() const
Definition: TreeTransform.h:6051
OMPNumTasksClause
This represents &#39;num_tasks&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5421
clang::CoroutineBodyStmt::getFallthroughHandler
Stmt * getFallthroughHandler() const
Definition: StmtCXX.h:399
clang::CXXForRangeStmt::getColonLoc
SourceLocation getColonLoc() const
Definition: StmtCXX.h:203
clang::IncompleteArrayType
Represents a C array with an unspecified size.
Definition: Type.h:2995
clang::AutoTypeLoc::setArgLocInfo
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
Definition: TypeLoc.h:2018
clang::concepts::NestedRequirement
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
Definition: ExprConcepts.h:389
clang::ChooseExpr
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4130
clang::TreeTransform::RebuildOMPIfClause
OMPClause * RebuildOMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;if&#39; clause.
Definition: TreeTransform.h:1526
clang::SEHExceptStmt::getFilterExpr
Expr * getFilterExpr() const
Definition: Stmt.h:3228
clang::AttributedStmt::getAttrLoc
SourceLocation getAttrLoc() const
Definition: Stmt.h:1811
clang::BinaryConditionalOperator
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:3808
clang::CXXCatchStmt
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
clang::TreeTransform::RebuildOMPDefaultmapClause
OMPClause * RebuildOMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;defaultmap&#39; clause.
Definition: TreeTransform.h:1996
clang::CXXFunctionalCastExpr
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1688
clang::ParenListExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: Expr.h:5189
clang::OMPScheduleClause::getScheduleKind
OpenMPScheduleClauseKind getScheduleKind() const
Get kind of the clause.
Definition: OpenMPClause.h:1408
clang::ObjCDictionaryElement::isPackExpansion
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
Definition: ExprObjC.h:276
Priority
int Priority
Definition: Format.cpp:1829
clang::OpenMPMapClauseKind
OpenMPMapClauseKind
OpenMP mapping kind for &#39;map&#39; clause.
Definition: OpenMPKinds.h:118
clang::SourceLocation::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:107
clang::QualType::getQualifiers
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition: Type.h:6283
clang::TreeTransform::RebuildOMPFirstprivateClause
OMPClause * RebuildOMPFirstprivateClause(ArrayRef< Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build a new OpenMP &#39;firstprivate&#39; clause.
Definition: TreeTransform.h:1667
clang::ConditionalOperator::getRHS
Expr * getRHS() const
Definition: Expr.h:3781
clang::CoawaitExpr::getOperand
Expr * getOperand() const
Definition: ExprCXX.h:4720
clang::ObjCIvarDecl
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1959
clang::FunctionTypeLoc::setParam
void setParam(unsigned i, ParmVarDecl *VD)
Definition: TypeLoc.h:1433
clang::TreeTransform::RebuildSEHExceptStmt
StmtResult RebuildSEHExceptStmt(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: TreeTransform.h:2167
clang::ElaboratedType::getNamedType
QualType getNamedType() const
Retrieve the type named by the qualified-id.
Definition: Type.h:5325
clang::WhileStmt
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2226
clang::OMPScheduleClause::getFirstScheduleModifierLoc
SourceLocation getFirstScheduleModifierLoc() const
Get the first modifier location.
Definition: OpenMPClause.h:1427
clang::ConceptSpecializationExpr
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
Definition: ExprConcepts.h:40
clang::ASTContext::getMacroQualifiedType
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
Definition: ASTContext.cpp:4493
clang::CXXConstructExpr::getParenOrBraceRange
SourceRange getParenOrBraceRange() const
Definition: ExprCXX.h:1590
clang::sema::LambdaScopeInfo
Definition: ScopeInfo.h:793
clang::Sema::TryCaptureKind
TryCaptureKind
Definition: Sema.h:4479
clang::ObjCObjectTypeLoc::getNumProtocols
unsigned getNumProtocols() const
Definition: TypeLoc.h:970
clang::OMPInReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:3116
clang::ParenTypeLoc::setLParenLoc
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1125
clang::TreeTransform::RebuildDependentTemplateSpecializationType
QualType RebuildDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const IdentifierInfo *Name, SourceLocation NameLoc, TemplateArgumentListInfo &Args, bool AllowInjectedClassName)
Build a new typename type that refers to a template-id.
Definition: TreeTransform.h:1010
clang::sema::BlockScopeInfo::TheDecl
BlockDecl * TheDecl
Definition: ScopeInfo.h:718
clang::SubstTemplateTypeParmType::getReplacementType
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
Definition: Type.h:4749
clang::TemplateArgumentLocInfo
Location information for a TemplateArgument.
Definition: TemplateBase.h:392
clang::UnaryTransformTypeLoc::getParensRange
SourceRange getParensRange() const
Definition: TypeLoc.h:1917
clang::sema::CapturingScopeInfo::isCXXThisCaptured
bool isCXXThisCaptured() const
Determine whether the C++ &#39;this&#39; is captured.
Definition: ScopeInfo.h:679
clang::CXXFunctionalCastExpr::getLParenLoc
SourceLocation getLParenLoc() const
Definition: ExprCXX.h:1719
clang::ObjCAtSynchronizedStmt::getAtSynchronizedLoc
SourceLocation getAtSynchronizedLoc() const
Definition: StmtObjC.h:294
OMPThreadLimitClause::getThreadLimit
Expr * getThreadLimit()
Return ThreadLimit number.
Definition: OpenMPClause.h:5209
Expr.h
clang::ASTContext::getPointerType
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Definition: ASTContext.cpp:3102
clang::TreeTransform::RebuildDependentScopeDeclRefExpr
ExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI)
Build a new (previously unresolved) declaration reference expression.
Definition: TreeTransform.h:2887
clang::TreeTransform::RebuildReturnStmt
StmtResult RebuildReturnStmt(SourceLocation ReturnLoc, Expr *Result)
Build a new return statement.
Definition: TreeTransform.h:1367
clang::PackExpansionExpr::getNumExpansions
Optional< unsigned > getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated...
Definition: ExprCXX.h:4055
clang::DeducedTemplateSpecializationTypeLoc
Definition: TypeLoc.h:2066
clang::CXXScopeSpec::MakeGlobal
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier &#39;::&#39;.
Definition: DeclSpec.cpp:96
clang::CXXDefaultInitExpr::getUsedContext
const DeclContext * getUsedContext() const
Definition: ExprCXX.h:1316
clang::CXXTryStmt::getTryBlock
CompoundStmt * getTryBlock()
Definition: StmtCXX.h:99
clang::CXXRecordDecl::getLambdaContextDecl
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition: DeclCXX.cpp:1496
clang::CaseStmt::getCaseLoc
SourceLocation getCaseLoc() const
Definition: Stmt.h:1571
clang::NestedNameSpecifierLoc::getTypeLoc
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Definition: NestedNameSpecifier.cpp:463
clang::CXXFoldExpr::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: ExprCXX.h:4574
clang::MacroQualifiedTypeLoc::getMacroIdentifier
const IdentifierInfo * getMacroIdentifier() const
Definition: TypeLoc.h:1089
clang::ObjCAtTryStmt
Represents Objective-C&#39;s @try ... @catch ... @finally statement.
Definition: StmtObjC.h:165
clang::PackExpansionTypeLoc
Definition: TypeLoc.h:2325
clang::ConceptReference::getTemplateKWLoc
SourceLocation getTemplateKWLoc() const
Definition: ASTConcept.h:148
clang::Stmt::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:263
clang::CXXDeleteExpr::isGlobalDelete
bool isGlobalDelete() const
Definition: ExprCXX.h:2385
clang::TreeTransform::RebuildPackExpansion
ExprResult RebuildPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Build a new expression pack expansion.
Definition: TreeTransform.h:3392
clang::OMPTaskLoopSimdDirective
This represents &#39;#pragma omp taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3137
clang::ConvertVectorExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
getBuiltinLoc - Return the location of the __builtin_convertvector token.
Definition: Expr.h:4102
clang::UnaryTransformTypeLoc
Definition: TypeLoc.h:1891
clang::ObjCAtTryStmt::getNumCatchStmts
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Definition: StmtObjC.h:214
clang::CXXDependentScopeMemberExpr::getBase
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3609
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1711
clang::LambdaExpr::hasExplicitParameters
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
Definition: ExprCXX.h:2025
clang::TreeTransform::RebuildShuffleVectorExpr
ExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc, MultiExprArg SubExprs, SourceLocation RParenLoc)
Build a new shuffle vector expression.
Definition: TreeTransform.h:3303
clang::TreeTransform::SDK_NotDiscarded
Definition: TreeTransform.h:333
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2546
clang::TypeSpecTypeLoc::getNameLoc
SourceLocation getNameLoc() const
Definition: TypeLoc.h:523
clang::CXXNewExpr::getTypeIdParens
SourceRange getTypeIdParens() const
Definition: ExprCXX.h:2254
clang::PackExpansionExpr::getPattern
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:4044
clang::sema::CapturingScopeInfo::HasImplicitReturnType
bool HasImplicitReturnType
Definition: ScopeInfo.h:655
clang::TemplateSpecializationTypeLoc::setRAngleLoc
void setRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1600
clang::NamedDecl::getName
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:250
clang::ExprError
ExprResult ExprError()
Definition: Ownership.h:279
OMPDistScheduleClause
This represents &#39;dist_schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5550
clang::DependentAddressSpaceTypeLoc::getAttrOperandParensRange
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
Definition: TypeLoc.h:1711
clang::BlockDecl::blockMissingReturnType
bool blockMissingReturnType() const
Definition: Decl.h:4172
clang::TreeTransform::TransformExceptionSpec
bool TransformExceptionSpec(SourceLocation Loc, FunctionProtoType::ExceptionSpecInfo &ESI, SmallVectorImpl< QualType > &Exceptions, bool &Changed)
Definition: TreeTransform.h:5555
clang::ChooseExpr::getLHS
Expr * getLHS() const
Definition: Expr.h:4177
clang::LambdaExpr::capture_begin
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
Definition: ExprCXX.cpp:1245
clang::TypeOfExprTypeLoc
Definition: TypeLoc.h:1844
clang::CoroutineBodyStmt::getBody
Stmt * getBody() const
Retrieve the body of the coroutine as written.
Definition: StmtCXX.h:378
clang::ObjCObjectTypeLoc::getNumTypeArgs
unsigned getNumTypeArgs() const
Definition: TypeLoc.h:940
clang::TreeTransform::RebuildImplicitValueInitExpr
ExprResult RebuildImplicitValueInitExpr(QualType T)
Build a new value-initialized expression.
Definition: TreeTransform.h:2489
clang::AutoTypeLoc::getTemplateKWLoc
SourceLocation getTemplateKWLoc() const
Definition: TypeLoc.h:1964
clang::CXXNamedCastExpr
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:353
clang::VectorType::getNumElements
unsigned getNumElements() const
Definition: Type.h:3271
clang::OverloadExpr::getRAngleLoc
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Definition: ExprCXX.h:2985
clang::TreeTransform::RebuildObjCAtCatchStmt
StmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParenLoc, VarDecl *Var, Stmt *Body)
Build a new Objective-C @catch statement.
Definition: TreeTransform.h:1482
clang::OMPSectionsDirective
This represents &#39;#pragma omp sections&#39; directive.
Definition: StmtOpenMP.h:1403
clang::Designation
Designation - Represent a full designation, which is a sequence of designators.
Definition: Designator.h:180
OMPHintClause::getHint
Expr * getHint() const
Returns number of threads.
Definition: OpenMPClause.h:5522
clang::OMPTaskReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:2839
clang::ObjCBoolLiteralExpr
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
clang::ObjCPropertyRefExpr::isObjectReceiver
bool isObjectReceiver() const
Definition: ExprObjC.h:775
clang::TranslationUnitDecl
The top declaration context.
Definition: Decl.h:82
clang::OffsetOfExpr::getNumComponents
unsigned getNumComponents() const
Definition: Expr.h:2326
clang::OMPTargetDataDirective
This represents &#39;#pragma omp target data&#39; directive.
Definition: StmtOpenMP.h:2573
clang::PipeType::isReadOnly
bool isReadOnly() const
Definition: Type.h:6192
clang::TreeTransform::RebuildStmtExpr
ExprResult RebuildStmtExpr(SourceLocation LParenLoc, Stmt *SubStmt, SourceLocation RParenLoc)
Build a new GNU statement expression.
Definition: TreeTransform.h:2529
clang::CXXDefaultArgExpr::getParam
const ParmVarDecl * getParam() const
Definition: ExprCXX.h:1237
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2150
clang::TreeTransform::RebuildConvertVectorExpr
ExprResult RebuildConvertVectorExpr(SourceLocation BuiltinLoc, Expr *SrcExpr, TypeSourceInfo *DstTInfo, SourceLocation RParenLoc)
Build a new convert vector expression.
Definition: TreeTransform.h:3332
clang::TemplateArgument::getAsType
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:256
clang::CXXRewrittenBinaryOperator
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:273
clang::DeclRefExpr
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1171
clang::DependentAddressSpaceType
Represents an extended address space qualifier where the input address space value is dependent...
Definition: Type.h:3153
clang::TemplateSpecializationType
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4996
clang::BlockDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4123
clang::BinaryOperator::getRHS
Expr * getRHS() const
Definition: Expr.h:3476
clang::TreeTransform::RebuildCXXThisExpr
ExprResult RebuildCXXThisExpr(SourceLocation ThisLoc, QualType ThisType, bool isImplicit)
Build a new C++ "this" expression.
Definition: TreeTransform.h:2762
clang::TreeTransform::RebuildObjCPropertyRefExpr
ExprResult RebuildObjCPropertyRefExpr(Expr *Base, QualType T, ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, SourceLocation PropertyLoc)
Build a new Objective-C property reference expression.
Definition: TreeTransform.h:3270
clang::TreeTransform::RebuildTypeRequirement
concepts::TypeRequirement * RebuildTypeRequirement(TypeSourceInfo *T)
Definition: TreeTransform.h:3099
clang::OverloadExpr::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
Definition: ExprCXX.h:2965
clang::OMPReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:2605
clang::Type::isPointerType
bool isPointerType() const
Definition: Type.h:6504
clang::ObjCObjectTypeLoc::setProtocolLAngleLoc
void setProtocolLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:958
clang::TemplateArgumentLocInventIterator
Iterator adaptor that invents template argument location information for each of the template argumen...
Definition: TreeTransform.h:4139
clang::BreakStmt
BreakStmt - This represents a break.
Definition: Stmt.h:2599
clang::OMPScheduleClause::getChunkSize
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:1440
clang::ObjCAtCatchStmt::getCatchParamDecl
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:97
clang::TypedefType
Definition: Type.h:4240
clang::TemplateArgumentLoc::getTemplateNameLoc
SourceLocation getTemplateNameLoc() const
Definition: TemplateBase.h:538
clang::GCCAsmStmt::getNumLabels
unsigned getNumLabels() const
Definition: Stmt.h:3027
clang::CoyieldExpr::getOperand
Expr * getOperand() const
Definition: ExprCXX.h:4799
clang::DependentAddressSpaceTypeLoc::getAttrNameLoc
SourceLocation getAttrNameLoc() const
The location of the attribute name, i.e.
Definition: TypeLoc.h:1690
clang::ComplexTypeLoc
Definition: TypeLoc.h:1778
clang::CXXDependentScopeMemberExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Definition: ExprCXX.h:3665
clang::Expr::isDefaultArgument
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
Definition: Expr.cpp:3051
clang::OMPNumThreadsClause::getNumThreads
Expr * getNumThreads() const
Returns number of threads.
Definition: OpenMPClause.h:638
clang::LabelStmt::getSubStmt
Stmt * getSubStmt()
Definition: Stmt.h:1753
clang::ASTContext::getDependentTemplateSpecializationType
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
Definition: ASTContext.cpp:4531
clang::interp::Null
bool Null(InterpState &S, CodePtr OpPC)
Definition: Interp.h:818
clang::AttributedTypeLoc::getAttrKind
attr::Kind getAttrKind() const
Definition: TypeLoc.h:856
clang::OMPVarListLocTy
This structure contains most locations needed for by an OMPVarListClause.
Definition: OpenMPClause.h:172
clang::ObjCBridgedCastExpr::getBridgeKeywordLoc
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition: ExprObjC.h:1673
clang::CXXConstructExpr::hadMultipleCandidates
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1...
Definition: ExprCXX.h:1505
clang::MSPropertyDecl
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3940
clang::ActionResult::getAs
T * getAs()
Definition: Ownership.h:171
clang::CXXForRangeStmt::getLoopVarStmt
DeclStmt * getLoopVarStmt()
Definition: StmtCXX.h:168
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:630
clang::BuiltinTypeLoc
Wrapper for source info for builtin types.
Definition: TypeLoc.h:550
clang::TreeTransform::RebuildCXXUuidofExpr
ExprResult RebuildCXXUuidofExpr(QualType TypeInfoType, SourceLocation TypeidLoc, Expr *Operand, SourceLocation RParenLoc)
Build a new C++ __uuidof(expr) expression.
Definition: TreeTransform.h:2749
clang::VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:129
clang::ParenTypeLoc::setRParenLoc
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1129
clang::CXXConstructExpr::getNumArgs
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1570
clang::TemplateTypeParmTypeLoc
Wrapper for template type parameters.
Definition: TypeLoc.h:734
clang::ObjCPropertyRefExpr::getBase
const Expr * getBase() const
Definition: ExprObjC.h:756
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:207
clang::TreeTransform::RebuildCXXTypeidExpr
ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, SourceLocation TypeidLoc, Expr *Operand, SourceLocation RParenLoc)
Build a new C++ typeid(expr) expression.
Definition: TreeTransform.h:2725
clang::Sema::Context
ASTContext & Context
Definition: Sema.h:385
clang::OMPTaskyieldDirective
This represents &#39;#pragma omp taskyield&#39; directive.
Definition: StmtOpenMP.h:2055
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:223
clang::UnqualifiedId::setIdentifier
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
Definition: DeclSpec.h:1049
clang::OMPDistributeParallelForSimdDirective
This represents &#39;#pragma omp distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3688
clang::TagType
Definition: Type.h:4471
clang::CXXBoolLiteralExpr
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:645
clang::MemberExpr::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Definition: Expr.h:2953
clang::OMPSafelenClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:701
clang::BuiltinBitCastExpr::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprCXX.h:4830
clang::OffsetOfExpr
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2267
clang::TypeLoc::castAs
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
Definition: TypeLoc.h:77
clang::interp::Opcode
Opcode
Definition: Opcode.h:21
clang::VariableArrayType
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:3039
clang::ExpressionTraitExpr::getQueriedExpression
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2824
clang::OMPParallelSectionsDirective
This represents &#39;#pragma omp parallel sections&#39; directive.
Definition: StmtOpenMP.h:1914
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:2967
clang::TreeTransform::RebuildCoreturnStmt
StmtResult RebuildCoreturnStmt(SourceLocation CoreturnLoc, Expr *Result, bool IsImplicit)
Build a new co_return statement.
Definition: TreeTransform.h:1418
clang::CXXForRangeStmt::getInc
Expr * getInc()
Definition: StmtCXX.h:167
clang::TemplateSpecializationTypeLoc::setTemplateNameLoc
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1624
clang::TreeTransform::getSema
Sema & getSema() const
Retrieves a reference to the semantic analysis object used for this tree transform.
Definition: TreeTransform.h:142
clang::AtomicExpr::getBuiltinLoc
SourceLocation getBuiltinLoc() const
Definition: Expr.h:5939
clang::DependentTemplateSpecializationTypeLoc::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:2216
clang::CXXUuidofExpr
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1000
clang::ETK_None
No keyword precedes the qualified type name.
Definition: Type.h:5227
clang::CXXFunctionalCastExpr::getRParenLoc
SourceLocation getRParenLoc() const
Definition: ExprCXX.h:1721
clang::TreeTransform::RebuildCompoundStmt
StmtResult RebuildCompoundStmt(SourceLocation LBraceLoc, MultiStmtArg Statements, SourceLocation RBraceLoc, bool IsStmtExpr)
Build a new compound statement.
Definition: TreeTransform.h:1223
clang::TypeOfExprTypeLoc::getUnderlyingExpr
Expr * getUnderlyingExpr() const
Definition: TypeLoc.h:1848
clang::DependentAddressSpaceType::getAttributeLoc
SourceLocation getAttributeLoc() const
Definition: Type.h:3168
clang::TemplateArgument::getAsTemplate
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:280
clang::BinaryConditionalOperator::getCommon
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:3848
clang::DependentScopeDeclRefExpr::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:3260
clang::VAArgExpr::getWrittenTypeInfo
TypeSourceInfo * getWrittenTypeInfo() const
Definition: Expr.h:4270
clang::CXXForRangeStmt::getBeginStmt
DeclStmt * getBeginStmt()
Definition: StmtCXX.h:162
clang::DependentVectorType::getElementType
QualType getElementType() const
Definition: Type.h:3326
clang::BlockDecl::setBlockMissingReturnType
void setBlockMissingReturnType(bool val=true)
Definition: Decl.h:4176
clang::ExtVectorTypeLoc
Definition: TypeLoc.h:1764
clang::FunctionProtoType::getExtParameterInfosOrNull
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present...
Definition: Type.h:4161
clang::ObjCMessageExpr::getRightLoc
SourceLocation getRightLoc() const
Definition: ExprObjC.h:1417
clang::AutoType::getTypeConstraintConcept
ConceptDecl * getTypeConstraintConcept() const
Definition: Type.h:4908
clang::Attr::getKind
attr::Kind getKind() const
Definition: Attr.h:85
clang::TreeTransform::RebuildCXXDependentScopeMemberExpr
ExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
Build a new member reference expression.
Definition: TreeTransform.h:2988
clang::OMPIfClause::getLParenLoc
SourceLocation getLParenLoc() const
Returns the location of &#39;(&#39;.
Definition: OpenMPClause.h:487
clang::LookupResult::getRepresentativeDecl
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
Definition: Lookup.h:524
clang::DeclContextLookupResult::empty
bool empty() const
Definition: DeclBase.h:1239
clang::GenericSelectionExpr::getGenericLoc
SourceLocation getGenericLoc() const
Definition: Expr.h:5483
clang::ObjCMessageExpr::getSelectorLocs
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
Definition: ExprObjC.cpp:289
clang::TemplateArgument::getAsTemplateOrTemplatePattern
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:287
clang::TreeTransform::RebuildNestedRequirement
concepts::NestedRequirement * RebuildNestedRequirement(concepts::Requirement::SubstitutionDiagnostic *SubstDiag)
Definition: TreeTransform.h:3120
clang::TypeLocBuilder::pushFullCopy
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
Definition: TypeLocBuilder.cpp:18
clang::PointerTypeLoc
Wrapper for source info for pointers.
Definition: TypeLoc.h:1226
OMPMappableExprListClause::getMapperIdInfo
const DeclarationNameInfo & getMapperIdInfo() const
Gets the name info for associated user-defined mapper.
Definition: OpenMPClause.h:4597
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:216
clang::ConvertVectorExpr::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
getTypeSourceInfo - Return the destination type.
Definition: Expr.h:4094
clang::MaterializeTemporaryExpr::getSubExpr
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
Definition: ExprCXX.h:4436
clang::Sema::CheckTypenameType
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
Definition: SemaTemplate.cpp:10225
clang::CXXFoldExpr::getOperator
BinaryOperatorKind getOperator() const
Definition: ExprCXX.h:4575
ColonLoc
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:107
clang::OffsetOfExpr::getRParenLoc
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Definition: Expr.h:2306
OMPNontemporalClause
This represents clause &#39;nontemporal&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6281
clang::DeclaratorDecl::getInnerLocStart
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition: Decl.h:714
clang::TreeTransform::transformedLocalDecl
void transformedLocalDecl(Decl *Old, ArrayRef< Decl *> New)
Note that a local declaration has been transformed by this transformer.
Definition: TreeTransform.h:462
clang::TreeTransform::RebuildCallExpr
ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
Build a new call expression.
Definition: TreeTransform.h:2312
clang::SizeOfPackExpr::getPack
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:4162
clang::BlockPointerTypeLoc
Wrapper for source info for block pointers.
Definition: TypeLoc.h:1239
clang::TreeTransform::RebuildOMPUseDevicePtrClause
OMPClause * RebuildOMPUseDevicePtrClause(ArrayRef< Expr *> VarList, const OMPVarListLocTy &Locs)
Build a new OpenMP &#39;use_device_ptr&#39; clause.
Definition: TreeTransform.h:1978
clang::ObjCAutoreleasePoolStmt
Represents Objective-C&#39;s @autoreleasepool Statement.
Definition: StmtObjC.h:368
clang::AttributedType::getImmediateNullability
llvm::Optional< NullabilityKind > getImmediateNullability() const
Definition: Type.cpp:3958
clang::ASTContext::getAutoType
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
Definition: ASTContext.cpp:5145
clang::CoroutineSuspendExpr::getKeywordLoc
SourceLocation getKeywordLoc() const
Definition: ExprCXX.h:4657
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2935
clang::SEHTryStmt::getTryBlock
CompoundStmt * getTryBlock() const
Definition: Stmt.h:3313
clang::AttributedStmt::getSubStmt
Stmt * getSubStmt()
Definition: Stmt.h:1816
clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec
ExceptionSpecInfo ExceptionSpec
Definition: Type.h:3843
clang::UnresolvedMemberExpr::getBaseType
QualType getBaseType() const
Definition: ExprCXX.h:3857
clang::TemplateArgumentLocContainerIterator::TemplateArgumentLocContainerIterator
TemplateArgumentLocContainerIterator()
Definition: TreeTransform.h:6057
clang::InitListExpr::getSyntacticForm
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4562
clang::TreeTransform::RebuildDeducedTemplateSpecializationType
QualType RebuildDeducedTemplateSpecializationType(TemplateName Template, QualType Deduced)
By default, builds a new DeducedTemplateSpecializationType with the given deduced type...
Definition: TreeTransform.h:968
clang::MSPropertyRefExpr::getBaseExpr
Expr * getBaseExpr() const
Definition: ExprCXX.h:919
clang::TreeTransform::RebuildTypedefType
QualType RebuildTypedefType(TypedefNameDecl *Typedef)
Build a new typedef type.
Definition: TreeTransform.h:909
clang::ImplicitValueInitExpr
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5117
clang::SEHExceptStmt::getBlock
CompoundStmt * getBlock() const
Definition: Stmt.h:3232
clang::AutoTypeLoc::getConceptNameLoc
SourceLocation getConceptNameLoc() const
Definition: TypeLoc.h:1972
clang::TreeTransform::Owned
static StmtResult Owned(Stmt *S)
Definition: TreeTransform.h:138
clang::CXXRewrittenBinaryOperator::DecomposedForm
Definition: ExprCXX.h:296
clang::ReturnStmt::getReturnLoc
SourceLocation getReturnLoc() const
Definition: Stmt.h:2692
clang::interp::Sub
bool Sub(InterpState &S, CodePtr OpPC)
Definition: Interp.h:140
clang::Sema::ConditionResult
Definition: Sema.h:10992
clang::CoroutineBodyStmt::getFinalSuspendStmt
Stmt * getFinalSuspendStmt() const
Definition: StmtCXX.h:392
clang::ElaboratedTypeLoc::setElaboratedKeywordLoc
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:2096
clang::CapturedStmt::getCapturedRegionKind
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
Definition: Stmt.cpp:1313
clang::OMPTargetParallelForDirective
This represents &#39;#pragma omp target parallel for&#39; directive.
Definition: StmtOpenMP.h:2808
clang::TreeTransform::RebuildCXXInheritedCtorInitExpr
ExprResult RebuildCXXInheritedCtorInitExpr(QualType T, SourceLocation Loc, CXXConstructorDecl *Constructor, bool ConstructsVBase, bool InheritedFromVBase)
Build a new implicit construction via inherited constructor expression.
Definition: TreeTransform.h:2950
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:45
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:429
OMPUseDevicePtrClause
This represents clause &#39;use_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6016
clang::ObjCObjectTypeLoc::getTypeArgsRAngleLoc
SourceLocation getTypeArgsRAngleLoc() const
Definition: TypeLoc.h:932
clang::MemberPointerType::getPointeeType
QualType getPointeeType() const
Definition: Type.h:2853
clang::TypeSourceInfo::getType
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6238
clang::TypeTraitExpr::getTrait
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition: ExprCXX.h:2666
clang::GenericSelectionExpr::associations
association_range associations()
Definition: Expr.h:5463
clang::OMPArraySectionExpr::getLength
Expr * getLength()
Get length of array section.
Definition: ExprOpenMP.h:98
clang::TreeTransform::RebuildIfStmt
StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, Sema::ConditionResult Cond, Stmt *Init, Stmt *Then, SourceLocation ElseLoc, Stmt *Else)
Build a new "if" statement.
Definition: TreeTransform.h:1287
clang::TypeOfTypeLoc::setUnderlyingTInfo
void setUnderlyingTInfo(TypeSourceInfo *TI) const
Definition: TypeLoc.h:1869
clang::CXXDependentScopeMemberExpr::getMemberNameInfo
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3652
clang::DependentTemplateSpecializationType::getIdentifier
const IdentifierInfo * getIdentifier() const
Definition: Type.h:5447
clang::Create
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
clang::DependentSizedExtVectorType::getSizeExpr
Expr * getSizeExpr() const
Definition: Type.h:3210
clang::NamedDecl::isCXXInstanceMember
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
Definition: Decl.cpp:1790
clang::CXXConstructExpr::getConstructionKind
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Definition: ExprCXX.h:1542
clang::BuiltinBitCastExpr::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprCXX.h:4831
clang::ObjCMessageExpr::getClassReceiverTypeInfo
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or nullptr if the message is not a class m...
Definition: ExprObjC.h:1288
clang::OMPArraySectionExpr::getBase
Expr * getBase()
An array section can be written only as Base[LowerBound:Length].
Definition: ExprOpenMP.h:81
clang::QualType::getObjCLifetime
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
Definition: Type.h:1080
clang::Sema::ContextRAII
A RAII object to temporarily push a declaration context.
Definition: Sema.h:797
clang::CaseStmt::getSubStmt
Stmt * getSubStmt()
Definition: Stmt.h:1619
clang::TreeTransform::RebuildObjCAtTryStmt
StmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc, Stmt *TryBody, MultiStmtArg CatchStmts, Stmt *Finally)
Build a new Objective-C @try statement.
Definition: TreeTransform.h:1458
clang::concepts::ExprRequirement::getReturnTypeRequirement
const ReturnTypeRequirement & getReturnTypeRequirement() const
Definition: ExprConcepts.h:358
clang::OMPTaskLoopDirective
This represents &#39;#pragma omp taskloop&#39; directive.
Definition: StmtOpenMP.h:3071