clang 19.0.0git
Sema.h
Go to the documentation of this file.
1//===--- Sema.h - Semantic Analysis & AST Building --------------*- 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//
9// This file defines the Sema class, which performs semantic analysis and
10// builds ASTs.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMA_H
15#define LLVM_CLANG_SEMA_SEMA_H
16
19#include "clang/AST/ASTFwd.h"
20#include "clang/AST/Attr.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExprCXX.h"
28#include "clang/AST/ExprObjC.h"
33#include "clang/AST/NSAPI.h"
35#include "clang/AST/StmtCXX.h"
38#include "clang/AST/TypeLoc.h"
44#include "clang/Basic/Module.h"
54#include "clang/Sema/DeclSpec.h"
59#include "clang/Sema/Scope.h"
62#include "clang/Sema/Weak.h"
63#include "llvm/ADT/ArrayRef.h"
64#include "llvm/ADT/SetVector.h"
65#include "llvm/ADT/SmallBitVector.h"
66#include "llvm/ADT/SmallPtrSet.h"
67#include "llvm/ADT/SmallSet.h"
68#include "llvm/ADT/SmallVector.h"
69#include "llvm/ADT/TinyPtrVector.h"
70#include "llvm/Frontend/OpenMP/OMPConstants.h"
71#include <deque>
72#include <memory>
73#include <optional>
74#include <string>
75#include <tuple>
76#include <vector>
77
78namespace llvm {
79class APSInt;
80template <typename ValueT, typename ValueInfoT> class DenseSet;
81class SmallBitVector;
82struct InlineAsmIdentifierInfo;
83} // namespace llvm
84
85namespace clang {
86class ADLResult;
87class ASTConsumer;
88class ASTContext;
89class ASTMutationListener;
90class ASTReader;
91class ASTWriter;
92class ArrayType;
93class ParsedAttr;
94class BindingDecl;
95class BlockDecl;
96class CapturedDecl;
97class CXXBasePath;
98class CXXBasePaths;
99class CXXBindTemporaryExpr;
101class CXXConstructorDecl;
102class CXXConversionDecl;
103class CXXDeleteExpr;
104class CXXDestructorDecl;
105class CXXFieldCollector;
106class CXXMemberCallExpr;
107class CXXMethodDecl;
108class CXXScopeSpec;
109class CXXTemporary;
110class CXXTryStmt;
111class CallExpr;
112class ClassTemplateDecl;
113class ClassTemplatePartialSpecializationDecl;
114class ClassTemplateSpecializationDecl;
115class VarTemplatePartialSpecializationDecl;
116class CodeCompleteConsumer;
117class CodeCompletionAllocator;
118class CodeCompletionTUInfo;
119class CodeCompletionResult;
120class CoroutineBodyStmt;
121class Decl;
122class DeclAccessPair;
123class DeclContext;
124class DeclRefExpr;
125class DeclaratorDecl;
126class DeducedTemplateArgument;
127class DependentDiagnostic;
128class DesignatedInitExpr;
129class Designation;
130class EnableIfAttr;
131class EnumConstantDecl;
132class Expr;
133class ExtVectorType;
134class FormatAttr;
135class FriendDecl;
136class FunctionDecl;
137class FunctionProtoType;
138class FunctionTemplateDecl;
139class ImplicitConversionSequence;
141class InitListExpr;
142class InitializationKind;
143class InitializationSequence;
144class InitializedEntity;
145class IntegerLiteral;
146class LabelStmt;
147class LambdaExpr;
148class LangOptions;
149class LocalInstantiationScope;
150class LookupResult;
151class MacroInfo;
153class ModuleLoader;
154class MultiLevelTemplateArgumentList;
155class NamedDecl;
156class ObjCCategoryDecl;
157class ObjCCategoryImplDecl;
158class ObjCCompatibleAliasDecl;
159class ObjCContainerDecl;
160class ObjCImplDecl;
161class ObjCImplementationDecl;
162class ObjCInterfaceDecl;
163class ObjCIvarDecl;
164template <class T> class ObjCList;
165class ObjCMessageExpr;
166class ObjCMethodDecl;
167class ObjCPropertyDecl;
168class ObjCProtocolDecl;
169class OMPThreadPrivateDecl;
170class OMPRequiresDecl;
171class OMPDeclareReductionDecl;
172class OMPDeclareSimdDecl;
173class OMPClause;
174struct OMPVarListLocTy;
175struct OverloadCandidate;
176enum class OverloadCandidateParamOrder : char;
178class OverloadCandidateSet;
179class OverloadExpr;
180class ParenListExpr;
181class ParmVarDecl;
182class Preprocessor;
183class PseudoDestructorTypeStorage;
184class PseudoObjectExpr;
185class QualType;
186class StandardConversionSequence;
187class Stmt;
188class StringLiteral;
189class SwitchStmt;
190class TemplateArgument;
191class TemplateArgumentList;
192class TemplateArgumentLoc;
193class TemplateDecl;
194class TemplateInstantiationCallback;
195class TemplateParameterList;
196class TemplatePartialOrderingContext;
197class TemplateTemplateParmDecl;
198class Token;
199class TypeAliasDecl;
200class TypedefDecl;
201class TypedefNameDecl;
202class TypeLoc;
203class TypoCorrectionConsumer;
204class UnqualifiedId;
205class UnresolvedLookupExpr;
206class UnresolvedMemberExpr;
207class UnresolvedSetImpl;
208class UnresolvedSetIterator;
209class UsingDecl;
210class UsingShadowDecl;
211class ValueDecl;
212class VarDecl;
213class VarTemplateSpecializationDecl;
214class VisibilityAttr;
215class VisibleDeclConsumer;
216class IndirectFieldDecl;
217struct DeductionFailureInfo;
218class TemplateSpecCandidateSet;
219
220namespace sema {
221class AccessedEntity;
222class BlockScopeInfo;
223class Capture;
224class CapturedRegionScopeInfo;
225class CapturingScopeInfo;
226class CompoundScopeInfo;
227class DelayedDiagnostic;
228class DelayedDiagnosticPool;
229class FunctionScopeInfo;
230class LambdaScopeInfo;
231class PossiblyUnreachableDiag;
232class RISCVIntrinsicManager;
233class SemaPPCallbacks;
234class TemplateDeductionInfo;
235} // namespace sema
236
237namespace threadSafety {
238class BeforeSet;
239void threadSafetyCleanup(BeforeSet *Cache);
240} // namespace threadSafety
241
242// FIXME: No way to easily map from TemplateTypeParmTypes to
243// TemplateTypeParmDecls, so we have this horrible PointerUnion.
244typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType *, NamedDecl *>,
245 SourceLocation>
247
248/// Describes whether we've seen any nullability information for the given
249/// file.
251 /// The first pointer declarator (of any pointer kind) in the file that does
252 /// not have a corresponding nullability annotation.
254
255 /// The end location for the first pointer declarator in the file. Used for
256 /// placing fix-its.
258
259 /// Which kind of pointer declarator we saw.
260 uint8_t PointerKind;
261
262 /// Whether we saw any type nullability annotations in the given file.
263 bool SawTypeNullability = false;
264};
265
266/// A mapping from file IDs to a record of whether we've seen nullability
267/// information in that file.
269 /// A mapping from file IDs to the nullability information for each file ID.
270 llvm::DenseMap<FileID, FileNullability> Map;
271
272 /// A single-element cache based on the file ID.
273 struct {
276 } Cache;
277
278public:
280 // Check the single-element cache.
281 if (file == Cache.File)
282 return Cache.Nullability;
283
284 // It's not in the single-element cache; flush the cache if we have one.
285 if (!Cache.File.isInvalid()) {
286 Map[Cache.File] = Cache.Nullability;
287 }
288
289 // Pull this entry into the cache.
290 Cache.File = file;
291 Cache.Nullability = Map[file];
292 return Cache.Nullability;
293 }
294};
295
296/// Tracks expected type during expression parsing, for use in code completion.
297/// The type is tied to a particular token, all functions that update or consume
298/// the type take a start location of the token they are looking at as a
299/// parameter. This avoids updating the type on hot paths in the parser.
301public:
302 PreferredTypeBuilder(bool Enabled) : Enabled(Enabled) {}
303
304 void enterCondition(Sema &S, SourceLocation Tok);
305 void enterReturn(Sema &S, SourceLocation Tok);
307 /// Handles e.g. BaseType{ .D = Tok...
309 const Designation &D);
310 /// Computing a type for the function argument may require running
311 /// overloading, so we postpone its computation until it is actually needed.
312 ///
313 /// Clients should be very careful when using this function, as it stores a
314 /// function_ref, clients should make sure all calls to get() with the same
315 /// location happen while function_ref is alive.
316 ///
317 /// The callback should also emit signature help as a side-effect, but only
318 /// if the completion point has been reached.
320 llvm::function_ref<QualType()> ComputeType);
321
323 void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind,
324 SourceLocation OpLoc);
325 void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op);
327 void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS);
328 /// Handles all type casts, including C-style cast, C++ casts, etc.
330
331 /// Get the expected type associated with this location, if any.
332 ///
333 /// If the location is a function argument, determining the expected type
334 /// involves considering all function overloads and the arguments so far.
335 /// In this case, signature help for these function overloads will be reported
336 /// as a side-effect (only if the completion point has been reached).
338 if (!Enabled || Tok != ExpectedLoc)
339 return QualType();
340 if (!Type.isNull())
341 return Type;
342 if (ComputeType)
343 return ComputeType();
344 return QualType();
345 }
346
347private:
348 bool Enabled;
349 /// Start position of a token for which we store expected type.
350 SourceLocation ExpectedLoc;
351 /// Expected type for a token starting at ExpectedLoc.
353 /// A function to compute expected type at ExpectedLoc. It is only considered
354 /// if Type is null.
355 llvm::function_ref<QualType()> ComputeType;
356};
357
358/// Describes the result of template argument deduction.
359///
360/// The TemplateDeductionResult enumeration describes the result of
361/// template argument deduction, as returned from
362/// DeduceTemplateArguments(). The separate TemplateDeductionInfo
363/// structure provides additional information about the results of
364/// template argument deduction, e.g., the deduced template argument
365/// list (if successful) or the specific template parameters or
366/// deduced arguments that were involved in the failure.
368 /// Template argument deduction was successful.
369 Success = 0,
370 /// The declaration was invalid; do nothing.
371 Invalid,
372 /// Template argument deduction exceeded the maximum template
373 /// instantiation depth (which has already been diagnosed).
375 /// Template argument deduction did not deduce a value
376 /// for every template parameter.
378 /// Template argument deduction did not deduce a value for every
379 /// expansion of an expanded template parameter pack.
381 /// Template argument deduction produced inconsistent
382 /// deduced values for the given template parameter.
384 /// Template argument deduction failed due to inconsistent
385 /// cv-qualifiers on a template parameter type that would
386 /// otherwise be deduced, e.g., we tried to deduce T in "const T"
387 /// but were given a non-const "X".
389 /// Substitution of the deduced template argument values
390 /// resulted in an error.
392 /// After substituting deduced template arguments, a dependent
393 /// parameter type did not match the corresponding argument.
395 /// After substituting deduced template arguments, an element of
396 /// a dependent parameter type did not match the corresponding element
397 /// of the corresponding argument (when deducing from an initializer list).
399 /// A non-depnedent component of the parameter did not match the
400 /// corresponding component of the argument.
402 /// When performing template argument deduction for a function
403 /// template, there were too many call arguments.
405 /// When performing template argument deduction for a function
406 /// template, there were too few call arguments.
408 /// The explicitly-specified template arguments were not valid
409 /// template arguments for the given template.
411 /// Checking non-dependent argument conversions failed.
413 /// The deduced arguments did not satisfy the constraints associated
414 /// with the template.
416 /// Deduction failed; that's all we know.
418 /// CUDA Target attributes do not match.
420 /// Some error which was already diagnosed.
422};
423
424/// Sema - This implements semantic analysis and AST building for C.
425/// \nosubgrouping
426class Sema final {
427 // Table of Contents
428 // -----------------
429 // 1. Semantic Analysis (Sema.cpp)
430 // 2. C++ Access Control (SemaAccess.cpp)
431 // 3. Attributes (SemaAttr.cpp)
432 // 4. Availability Attribute Handling (SemaAvailability.cpp)
433 // 5. Casts (SemaCast.cpp)
434 // 6. Extra Semantic Checking (SemaChecking.cpp)
435 // 7. C++ Coroutines (SemaCoroutine.cpp)
436 // 8. C++ Scope Specifiers (SemaCXXScopeSpec.cpp)
437 // 9. Declarations (SemaDecl.cpp)
438 // 10. Declaration Attribute Handling (SemaDeclAttr.cpp)
439 // 11. C++ Declarations (SemaDeclCXX.cpp)
440 // 12. C++ Exception Specifications (SemaExceptionSpec.cpp)
441 // 13. Expressions (SemaExpr.cpp)
442 // 14. C++ Expressions (SemaExprCXX.cpp)
443 // 15. Member Access Expressions (SemaExprMember.cpp)
444 // 16. Initializers (SemaInit.cpp)
445 // 17. C++ Lambda Expressions (SemaLambda.cpp)
446 // 18. Name Lookup (SemaLookup.cpp)
447 // 19. Modules (SemaModule.cpp)
448 // 20. C++ Overloading (SemaOverload.cpp)
449 // 21. Pseudo-Object (SemaPseudoObject.cpp)
450 // 22. Statements (SemaStmt.cpp)
451 // 23. `inline asm` Statement (SemaStmtAsm.cpp)
452 // 24. Statement Attribute Handling (SemaStmtAttr.cpp)
453 // 25. C++ Templates (SemaTemplate.cpp)
454 // 26. C++ Template Argument Deduction (SemaTemplateDeduction.cpp)
455 // 27. C++ Template Instantiation (SemaTemplateInstantiate.cpp)
456 // 28. C++ Template Declaration Instantiation
457 // (SemaTemplateInstantiateDecl.cpp)
458 // 29. C++ Variadic Templates (SemaTemplateVariadic.cpp)
459 // 30. Constraints and Concepts (SemaConcept.cpp)
460 // 31. Types (SemaType.cpp)
461 // 32. ObjC Declarations (SemaDeclObjC.cpp)
462 // 33. ObjC Expressions (SemaExprObjC.cpp)
463 // 34. ObjC @property and @synthesize (SemaObjCProperty.cpp)
464 // 35. Code Completion (SemaCodeComplete.cpp)
465 // 36. FixIt Helpers (SemaFixItUtils.cpp)
466 // 37. Name Lookup for RISC-V Vector Intrinsic (SemaRISCVVectorLookup.cpp)
467 // 38. CUDA (SemaCUDA.cpp)
468 // 39. HLSL Constructs (SemaHLSL.cpp)
469 // 40. OpenACC Constructs (SemaOpenACC.cpp)
470 // 41. OpenMP Directives and Clauses (SemaOpenMP.cpp)
471 // 42. SYCL Constructs (SemaSYCL.cpp)
472
473 /// \name Semantic Analysis
474 /// Implementations are in Sema.cpp
475 ///@{
476
477public:
478 Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
480 CodeCompleteConsumer *CompletionConsumer = nullptr);
481 ~Sema();
482
483 /// Perform initialization that occurs after the parser has been
484 /// initialized but before it parses anything.
485 void Initialize();
486
487 /// This virtual key function only exists to limit the emission of debug info
488 /// describing the Sema class. GCC and Clang only emit debug info for a class
489 /// with a vtable when the vtable is emitted. Sema is final and not
490 /// polymorphic, but the debug info size savings are so significant that it is
491 /// worth adding a vtable just to take advantage of this optimization.
492 virtual void anchor();
493
494 const LangOptions &getLangOpts() const { return LangOpts; }
497
500 Preprocessor &getPreprocessor() const { return PP; }
501 ASTContext &getASTContext() const { return Context; }
505
507 StringRef Platform);
509
510 /// Registers an external source. If an external source already exists,
511 /// creates a multiplex external source and appends to it.
512 ///
513 ///\param[in] E - A non-null external sema source.
514 ///
516
517 /// Helper class that creates diagnostics with optional
518 /// template instantiation stacks.
519 ///
520 /// This class provides a wrapper around the basic DiagnosticBuilder
521 /// class that emits diagnostics. ImmediateDiagBuilder is
522 /// responsible for emitting the diagnostic (as DiagnosticBuilder
523 /// does) and, if the diagnostic comes from inside a template
524 /// instantiation, printing the template instantiation stack as
525 /// well.
527 Sema &SemaRef;
528 unsigned DiagID;
529
530 public:
531 ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
532 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
533 ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
534 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
535
536 // This is a cunning lie. DiagnosticBuilder actually performs move
537 // construction in its copy constructor (but due to varied uses, it's not
538 // possible to conveniently express this as actual move construction). So
539 // the default copy ctor here is fine, because the base class disables the
540 // source anyway, so the user-defined ~ImmediateDiagBuilder is a safe no-op
541 // in that case anwyay.
543
545 // If we aren't active, there is nothing to do.
546 if (!isActive())
547 return;
548
549 // Otherwise, we need to emit the diagnostic. First clear the diagnostic
550 // builder itself so it won't emit the diagnostic in its own destructor.
551 //
552 // This seems wasteful, in that as written the DiagnosticBuilder dtor will
553 // do its own needless checks to see if the diagnostic needs to be
554 // emitted. However, because we take care to ensure that the builder
555 // objects never escape, a sufficiently smart compiler will be able to
556 // eliminate that code.
557 Clear();
558
559 // Dispatch to Sema to emit the diagnostic.
560 SemaRef.EmitCurrentDiagnostic(DiagID);
561 }
562
563 /// Teach operator<< to produce an object of the correct type.
564 template <typename T>
565 friend const ImmediateDiagBuilder &
566 operator<<(const ImmediateDiagBuilder &Diag, const T &Value) {
567 const DiagnosticBuilder &BaseDiag = Diag;
568 BaseDiag << Value;
569 return Diag;
570 }
571
572 // It is necessary to limit this to rvalue reference to avoid calling this
573 // function with a bitfield lvalue argument since non-const reference to
574 // bitfield is not allowed.
575 template <typename T,
576 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
578 const DiagnosticBuilder &BaseDiag = *this;
579 BaseDiag << std::move(V);
580 return *this;
581 }
582 };
583
584 /// A generic diagnostic builder for errors which may or may not be deferred.
585 ///
586 /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
587 /// which are not allowed to appear inside __device__ functions and are
588 /// allowed to appear in __host__ __device__ functions only if the host+device
589 /// function is never codegen'ed.
590 ///
591 /// To handle this, we use the notion of "deferred diagnostics", where we
592 /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
593 ///
594 /// This class lets you emit either a regular diagnostic, a deferred
595 /// diagnostic, or no diagnostic at all, according to an argument you pass to
596 /// its constructor, thus simplifying the process of creating these "maybe
597 /// deferred" diagnostics.
599 public:
600 enum Kind {
601 /// Emit no diagnostics.
603 /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
605 /// Emit the diagnostic immediately, and, if it's a warning or error, also
606 /// emit a call stack showing how this function can be reached by an a
607 /// priori known-emitted function.
609 /// Create a deferred diagnostic, which is emitted only if the function
610 /// it's attached to is codegen'ed. Also emit a call stack as with
611 /// K_ImmediateWithCallStack.
613 };
614
615 SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID,
616 const FunctionDecl *Fn, Sema &S);
619
620 // The copy and move assignment operator is defined as deleted pending
621 // further motivation.
624
626
627 bool isImmediate() const { return ImmediateDiag.has_value(); }
628
629 /// Convertible to bool: True if we immediately emitted an error, false if
630 /// we didn't emit an error or we created a deferred error.
631 ///
632 /// Example usage:
633 ///
634 /// if (SemaDiagnosticBuilder(...) << foo << bar)
635 /// return ExprError();
636 ///
637 /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
638 /// want to use these instead of creating a SemaDiagnosticBuilder yourself.
639 operator bool() const { return isImmediate(); }
640
641 template <typename T>
643 operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
644 if (Diag.ImmediateDiag)
645 *Diag.ImmediateDiag << Value;
646 else if (Diag.PartialDiagId)
647 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
648 << Value;
649 return Diag;
650 }
651
652 // It is necessary to limit this to rvalue reference to avoid calling this
653 // function with a bitfield lvalue argument since non-const reference to
654 // bitfield is not allowed.
655 template <typename T,
656 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
658 if (ImmediateDiag)
659 *ImmediateDiag << std::move(V);
660 else if (PartialDiagId)
661 S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
662 return *this;
663 }
664
667 if (Diag.ImmediateDiag)
668 PD.Emit(*Diag.ImmediateDiag);
669 else if (Diag.PartialDiagId)
670 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
671 return Diag;
672 }
673
674 void AddFixItHint(const FixItHint &Hint) const {
675 if (ImmediateDiag)
676 ImmediateDiag->AddFixItHint(Hint);
677 else if (PartialDiagId)
678 S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
679 }
680
682 return ExprError();
683 }
685 return StmtError();
686 }
687 operator ExprResult() const { return ExprError(); }
688 operator StmtResult() const { return StmtError(); }
689 operator TypeResult() const { return TypeError(); }
690 operator DeclResult() const { return DeclResult(true); }
691 operator MemInitResult() const { return MemInitResult(true); }
692
693 private:
694 Sema &S;
695 SourceLocation Loc;
696 unsigned DiagID;
697 const FunctionDecl *Fn;
698 bool ShowCallStack;
699
700 // Invariant: At most one of these Optionals has a value.
701 // FIXME: Switch these to a Variant once that exists.
702 std::optional<ImmediateDiagBuilder> ImmediateDiag;
703 std::optional<unsigned> PartialDiagId;
704 };
705
706 void PrintStats() const;
707
708 /// Warn that the stack is nearly exhausted.
710
711 /// Run some code with "sufficient" stack space. (Currently, at least 256K is
712 /// guaranteed). Produces a warning if we're low on stack space and allocates
713 /// more in that case. Use this in code that may recurse deeply (for example,
714 /// in template instantiation) to avoid stack overflow.
716 llvm::function_ref<void()> Fn);
717
718 /// Returns default addr space for method qualifiers.
720
721 /// Load weak undeclared identifiers from the external source.
723
724 /// Determine if VD, which must be a variable or function, is an external
725 /// symbol that nonetheless can't be referenced from outside this translation
726 /// unit because its type has no linkage and it's not extern "C".
727 bool isExternalWithNoLinkageType(const ValueDecl *VD) const;
728
729 /// Obtain a sorted list of functions that are undefined but ODR-used.
731 SmallVectorImpl<std::pair<NamedDecl *, SourceLocation>> &Undefined);
732
733 typedef std::pair<SourceLocation, bool> DeleteExprLoc;
735 /// Retrieves list of suspicious delete-expressions that will be checked at
736 /// the end of translation unit.
737 const llvm::MapVector<FieldDecl *, DeleteLocs> &
739
740 /// Cause the active diagnostic on the DiagosticsEngine to be
741 /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
742 /// should not be used elsewhere.
743 void EmitCurrentDiagnostic(unsigned DiagID);
744
745 void addImplicitTypedef(StringRef Name, QualType T);
746
747 /// Emit a diagnostic.
748 SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID,
749 bool DeferHint = false);
750
751 /// Emit a partial diagnostic.
753 bool DeferHint = false);
754
755 /// Whether uncompilable error has occurred. This includes error happens
756 /// in deferred diagnostics.
757 bool hasUncompilableErrorOccurred() const;
758
759 bool findMacroSpelling(SourceLocation &loc, StringRef name);
760
761 /// Calls \c Lexer::getLocForEndOfToken()
762 SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset = 0);
763
764 /// Retrieve the module loader associated with the preprocessor.
766
767 /// Invent a new identifier for parameters of abbreviated templates.
770 unsigned Index);
771
773
774 // Emit all deferred diagnostics.
775 void emitDeferredDiags();
776
778 /// The global module fragment, between 'module;' and a module-declaration.
780 /// A normal translation unit fragment. For a non-module unit, this is the
781 /// entire translation unit. Otherwise, it runs from the module-declaration
782 /// to the private-module-fragment (if any) or the end of the TU (if not).
784 /// The private module fragment, between 'module :private;' and the end of
785 /// the translation unit.
786 Private
787 };
788
792
794
795 void PushFunctionScope();
796 void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
798
799 /// This is used to inform Sema what the current TemplateParameterDepth
800 /// is during Parsing. Currently it is used to pass on the depth
801 /// when parsing generic lambda 'auto' parameters.
802 void RecordParsingTemplateParameterDepth(unsigned Depth);
803
804 void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
806 unsigned OpenMPCaptureLevel = 0);
807
808 /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
809 /// time after they've been popped.
811 Sema *Self;
812
813 public:
816 };
817
819 std::unique_ptr<sema::FunctionScopeInfo, PoppedFunctionScopeDeleter>;
820
823 const Decl *D = nullptr,
824 QualType BlockType = QualType());
825
827
832
833 void PushCompoundScope(bool IsStmtExpr);
834 void PopCompoundScope();
835
837
838 /// Retrieve the current block, if any.
840
841 /// Get the innermost lambda enclosing the current location, if any. This
842 /// looks through intervening non-lambda scopes such as local functions and
843 /// blocks.
845
846 /// Retrieve the current lambda scope info, if any.
847 /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
848 /// lambda scope info ignoring all inner capturing scopes that are not
849 /// lambda scopes.
851 getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
852
853 /// Retrieve the current generic lambda info, if any.
855
856 /// Retrieve the current captured region, if any.
858
859 void ActOnComment(SourceRange Comment);
860
861 /// Retrieve the parser's current scope.
862 ///
863 /// This routine must only be used when it is certain that semantic analysis
864 /// and the parser are in precisely the same context, which is not the case
865 /// when, e.g., we are performing any kind of template instantiation.
866 /// Therefore, the only safe places to use this scope are in the parser
867 /// itself and in routines directly invoked from the parser and *never* from
868 /// template substitution or instantiation.
869 Scope *getCurScope() const { return CurScope; }
870
872
875 }
876
877 SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID,
878 const FunctionDecl *FD = nullptr);
880 const PartialDiagnostic &PD,
881 const FunctionDecl *FD = nullptr) {
882 return targetDiag(Loc, PD.getDiagID(), FD) << PD;
883 }
884
885 /// Check if the type is allowed to be used for the current target.
887 ValueDecl *D = nullptr);
888
889 /// The kind of conversion being performed.
891 /// An implicit conversion.
893 /// A C-style cast.
895 /// A functional-style cast.
897 /// A cast other than a C-style cast.
899 /// A conversion for an operand of a builtin overloaded operator.
901 };
902
903 /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
904 /// cast. If there is already an implicit cast, merge into the existing one.
905 /// If isLvalue, the result of the cast is an lvalue.
909 const CXXCastPath *BasePath = nullptr,
911
912 /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
913 /// to the conversion from scalar type ScalarTy to the Boolean type.
915
916 /// If \p AllowLambda is true, treat lambda as function.
917 DeclContext *getFunctionLevelDeclContext(bool AllowLambda = false) const;
918
919 /// Returns a pointer to the innermost enclosing function, or nullptr if the
920 /// current context is not inside a function. If \p AllowLambda is true,
921 /// this can return the call operator of an enclosing lambda, otherwise
922 /// lambdas are skipped when looking for an enclosing function.
923 FunctionDecl *getCurFunctionDecl(bool AllowLambda = false) const;
924
925 /// getCurMethodDecl - If inside of a method body, this returns a pointer to
926 /// the method decl for the method being parsed. If we're currently
927 /// in a 'block', this returns the containing context.
929
930 /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
931 /// or C function we're in, otherwise return null. If we're currently
932 /// in a 'block', this returns the containing context.
934
935 /// Warn if we're implicitly casting from a _Nullable pointer type to a
936 /// _Nonnull one.
938 SourceLocation Loc);
939
940 /// Warn when implicitly casting 0 to nullptr.
941 void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E);
942
944 UnavailableAttr::ImplicitReason reason);
945
946 /// Retrieve a suitable printing policy for diagnostics.
949 }
950
951 /// Retrieve a suitable printing policy for diagnostics.
953 const Preprocessor &PP);
954
955 /// Scope actions.
957
958 /// Determine whether \param D is function like (function or function
959 /// template) for parsing.
961
962 /// The maximum alignment, same as in llvm::Value. We duplicate them here
963 /// because that allows us not to duplicate the constants in clang code,
964 /// which we must to since we can't directly use the llvm constants.
965 /// The value is verified against llvm here: lib/CodeGen/CGDecl.cpp
966 ///
967 /// This is the greatest alignment value supported by load, store, and alloca
968 /// instructions, and global values.
969 static const unsigned MaxAlignmentExponent = 32;
970 static const uint64_t MaximumAlignment = 1ull << MaxAlignmentExponent;
971
972 /// Flag indicating whether or not to collect detailed statistics.
974
975 std::unique_ptr<sema::FunctionScopeInfo> CachedFunctionScope;
976
977 /// Stack containing information about each of the nested
978 /// function, block, and method scopes that are currently active.
980
981 /// The index of the first FunctionScope that corresponds to the current
982 /// context.
984
985 /// Track the number of currently active capturing scopes.
987
988 llvm::BumpPtrAllocator BumpAlloc;
989
990 /// The kind of translation unit we are processing.
991 ///
992 /// When we're processing a complete translation unit, Sema will perform
993 /// end-of-translation-unit semantic tasks (such as creating
994 /// initializers for tentative definitions in C) once parsing has
995 /// completed. Modules and precompiled headers perform different kinds of
996 /// checks.
998
999 /// Translation Unit Scope - useful to Objective-C actions that need
1000 /// to lookup file scope declarations in the "ordinary" C decl namespace.
1001 /// For example, user-defined classes, built-in "id" type, etc.
1003
1005
1007 return CurScope->incrementMSManglingNumber();
1008 }
1009
1010 /// Try to recover by turning the given expression into a
1011 /// call. Returns true if recovery was attempted or an error was
1012 /// emitted; this may also leave the ExprResult invalid.
1014 bool ForceComplain = false,
1015 bool (*IsPlausibleResult)(QualType) = nullptr);
1016
1017 /// Figure out if an expression could be turned into a call.
1018 bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
1019 UnresolvedSetImpl &NonTemplateOverloads);
1020
1024
1027
1035
1036 /// A RAII object to enter scope of a compound statement.
1038 public:
1039 CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) {
1040 S.ActOnStartOfCompoundStmt(IsStmtExpr);
1041 }
1042
1044
1045 private:
1046 Sema &S;
1047 };
1048
1049 /// An RAII helper that pops function a function scope on exit.
1055 if (Active)
1057 }
1058 void disable() { Active = false; }
1059 };
1060
1061 /// Build a partial diagnostic.
1062 PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1063
1065 return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
1066 }
1067
1068 /// Worker object for performing CFG-based warnings.
1071
1072 /// Callback to the parser to parse templated functions when needed.
1073 typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
1074 typedef void LateTemplateParserCleanupCB(void *P);
1078
1080 LateTemplateParserCleanupCB *LTPCleanup, void *P) {
1081 LateTemplateParser = LTP;
1082 LateTemplateParserCleanup = LTPCleanup;
1083 OpaqueParser = P;
1084 }
1085
1086 /// Callback to the parser to parse a type expressed as a string.
1087 std::function<TypeResult(StringRef, StringRef, SourceLocation)>
1089
1090 /// VAListTagName - The declaration name corresponding to __va_list_tag.
1091 /// This is used as part of a hack to omit that class from ADL results.
1093
1094 /// Is the last error level diagnostic immediate. This is used to determined
1095 /// whether the next info diagnostic should be immediate.
1097
1098 class DelayedDiagnostics;
1099
1101 sema::DelayedDiagnosticPool *SavedPool = nullptr;
1103 };
1106
1107 /// A class which encapsulates the logic for delaying diagnostics
1108 /// during parsing and other processing.
1110 /// The current pool of diagnostics into which delayed
1111 /// diagnostics should go.
1112 sema::DelayedDiagnosticPool *CurPool = nullptr;
1113
1114 public:
1116
1117 /// Adds a delayed diagnostic.
1118 void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
1119
1120 /// Determines whether diagnostics should be delayed.
1121 bool shouldDelayDiagnostics() { return CurPool != nullptr; }
1122
1123 /// Returns the current delayed-diagnostics pool.
1124 sema::DelayedDiagnosticPool *getCurrentPool() const { return CurPool; }
1125
1126 /// Enter a new scope. Access and deprecation diagnostics will be
1127 /// collected in this pool.
1130 state.SavedPool = CurPool;
1131 CurPool = &pool;
1132 return state;
1133 }
1134
1135 /// Leave a delayed-diagnostic state that was previously pushed.
1136 /// Do not emit any of the diagnostics. This is performed as part
1137 /// of the bookkeeping of popping a pool "properly".
1139 CurPool = state.SavedPool;
1140 }
1141
1142 /// Enter a new scope where access and deprecation diagnostics are
1143 /// not delayed.
1146 state.SavedPool = CurPool;
1147 CurPool = nullptr;
1148 return state;
1149 }
1150
1151 /// Undo a previous pushUndelayed().
1153 assert(CurPool == nullptr);
1154 CurPool = state.SavedPool;
1155 }
1156 } DelayedDiagnostics;
1157
1159 return DelayedDiagnostics.push(pool);
1160 }
1161
1162 /// CurContext - This is the current declaration context of parsing.
1164
1165protected:
1166 friend class Parser;
1168 friend class ASTReader;
1169 friend class ASTDeclReader;
1170 friend class ASTWriter;
1171
1172private:
1173 std::optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
1174 bool WarnedDarwinSDKInfoMissing = false;
1175
1176 Sema(const Sema &) = delete;
1177 void operator=(const Sema &) = delete;
1178
1179 /// Source of additional semantic information.
1181
1182 /// The handler for the FileChanged preprocessor events.
1183 ///
1184 /// Used for diagnostics that implement custom semantic analysis for #include
1185 /// directives, like -Wpragma-pack.
1186 sema::SemaPPCallbacks *SemaPPCallbackHandler;
1187
1188 /// The parser's current scope.
1189 ///
1190 /// The parser maintains this state here.
1191 Scope *CurScope;
1192
1193 mutable IdentifierInfo *Ident_super;
1194
1195 ///@}
1196
1197 //
1198 //
1199 // -------------------------------------------------------------------------
1200 //
1201 //
1202
1203 /// \name C++ Access Control
1204 /// Implementations are in SemaAccess.cpp
1205 ///@{
1206
1207public:
1214
1215 bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
1216 NamedDecl *PrevMemberDecl,
1217 AccessSpecifier LexicalAS);
1218
1220 DeclAccessPair FoundDecl);
1222 DeclAccessPair FoundDecl);
1224 SourceRange PlacementRange,
1225 CXXRecordDecl *NamingClass,
1226 DeclAccessPair FoundDecl,
1227 bool Diagnose = true);
1229 DeclAccessPair FoundDecl,
1230 const InitializedEntity &Entity,
1231 bool IsCopyBindingRefToTemp = false);
1233 DeclAccessPair FoundDecl,
1234 const InitializedEntity &Entity,
1235 const PartialDiagnostic &PDiag);
1237 CXXDestructorDecl *Dtor,
1238 const PartialDiagnostic &PDiag,
1239 QualType objectType = QualType());
1242 CXXRecordDecl *NamingClass,
1243 DeclAccessPair Found);
1246 CXXRecordDecl *DecomposedClass,
1247 DeclAccessPair Field);
1249 const SourceRange &,
1250 DeclAccessPair FoundDecl);
1252 Expr *ArgExpr,
1253 DeclAccessPair FoundDecl);
1255 ArrayRef<Expr *> ArgExprs,
1256 DeclAccessPair FoundDecl);
1258 DeclAccessPair FoundDecl);
1260 QualType Derived, const CXXBasePath &Path,
1261 unsigned DiagID, bool ForceCheck = false,
1262 bool ForceUnprivileged = false);
1263 void CheckLookupAccess(const LookupResult &R);
1264 bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass,
1265 QualType BaseType);
1267 DeclAccessPair Found, QualType ObjectType,
1268 SourceLocation Loc,
1269 const PartialDiagnostic &Diag);
1271 DeclAccessPair Found,
1272 QualType ObjectType) {
1273 return isMemberAccessibleForDeletion(NamingClass, Found, ObjectType,
1274 SourceLocation(), PDiag());
1275 }
1276
1278 const DependentDiagnostic &DD,
1279 const MultiLevelTemplateArgumentList &TemplateArgs);
1281
1282 ///@}
1283
1284 //
1285 //
1286 // -------------------------------------------------------------------------
1287 //
1288 //
1289
1290 /// \name Attributes
1291 /// Implementations are in SemaAttr.cpp
1292 ///@{
1293
1294public:
1295 /// Controls member pointer representation format under the MS ABI.
1298
1299 bool MSStructPragmaOn; // True when \#pragma ms_struct on
1300
1301 /// Source location for newly created implicit MSInheritanceAttrs
1303
1304 /// pragma clang section kind
1311 PCSK_Relro = 5
1313
1315
1317 std::string SectionName;
1318 bool Valid = false;
1320 };
1321
1327
1329 PSK_Reset = 0x0, // #pragma ()
1330 PSK_Set = 0x1, // #pragma (value)
1331 PSK_Push = 0x2, // #pragma (push[, id])
1332 PSK_Pop = 0x4, // #pragma (pop[, id])
1333 PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
1334 PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
1335 PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
1336 };
1337
1340 StringRef SlotLabel;
1342 };
1343
1344 // #pragma pack and align.
1346 public:
1347 // `Native` represents default align mode, which may vary based on the
1348 // platform.
1349 enum Mode : unsigned char { Native, Natural, Packed, Mac68k };
1350
1351 // #pragma pack info constructor
1352 AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
1353 : PackAttr(true), AlignMode(M), PackNumber(Num), XLStack(IsXL) {
1354 assert(Num == PackNumber && "The pack number has been truncated.");
1355 }
1356
1357 // #pragma align info constructor
1359 : PackAttr(false), AlignMode(M),
1360 PackNumber(M == Packed ? 1 : UninitPackVal), XLStack(IsXL) {}
1361
1362 explicit AlignPackInfo(bool IsXL) : AlignPackInfo(Native, IsXL) {}
1363
1365
1366 // When a AlignPackInfo itself cannot be used, this returns an 32-bit
1367 // integer encoding for it. This should only be passed to
1368 // AlignPackInfo::getFromRawEncoding, it should not be inspected directly.
1369 static uint32_t getRawEncoding(const AlignPackInfo &Info) {
1370 std::uint32_t Encoding{};
1371 if (Info.IsXLStack())
1372 Encoding |= IsXLMask;
1373
1374 Encoding |= static_cast<uint32_t>(Info.getAlignMode()) << 1;
1375
1376 if (Info.IsPackAttr())
1377 Encoding |= PackAttrMask;
1378
1379 Encoding |= static_cast<uint32_t>(Info.getPackNumber()) << 4;
1380
1381 return Encoding;
1382 }
1383
1384 static AlignPackInfo getFromRawEncoding(unsigned Encoding) {
1385 bool IsXL = static_cast<bool>(Encoding & IsXLMask);
1387 static_cast<AlignPackInfo::Mode>((Encoding & AlignModeMask) >> 1);
1388 int PackNumber = (Encoding & PackNumMask) >> 4;
1389
1390 if (Encoding & PackAttrMask)
1391 return AlignPackInfo(M, PackNumber, IsXL);
1392
1393 return AlignPackInfo(M, IsXL);
1394 }
1395
1396 bool IsPackAttr() const { return PackAttr; }
1397
1398 bool IsAlignAttr() const { return !PackAttr; }
1399
1400 Mode getAlignMode() const { return AlignMode; }
1401
1402 unsigned getPackNumber() const { return PackNumber; }
1403
1404 bool IsPackSet() const {
1405 // #pragma align, #pragma pack(), and #pragma pack(0) do not set the pack
1406 // attriute on a decl.
1407 return PackNumber != UninitPackVal && PackNumber != 0;
1408 }
1409
1410 bool IsXLStack() const { return XLStack; }
1411
1412 bool operator==(const AlignPackInfo &Info) const {
1413 return std::tie(AlignMode, PackNumber, PackAttr, XLStack) ==
1414 std::tie(Info.AlignMode, Info.PackNumber, Info.PackAttr,
1415 Info.XLStack);
1416 }
1417
1418 bool operator!=(const AlignPackInfo &Info) const {
1419 return !(*this == Info);
1420 }
1421
1422 private:
1423 /// \brief True if this is a pragma pack attribute,
1424 /// not a pragma align attribute.
1425 bool PackAttr;
1426
1427 /// \brief The alignment mode that is in effect.
1428 Mode AlignMode;
1429
1430 /// \brief The pack number of the stack.
1431 unsigned char PackNumber;
1432
1433 /// \brief True if it is a XL #pragma align/pack stack.
1434 bool XLStack;
1435
1436 /// \brief Uninitialized pack value.
1437 static constexpr unsigned char UninitPackVal = -1;
1438
1439 // Masks to encode and decode an AlignPackInfo.
1440 static constexpr uint32_t IsXLMask{0x0000'0001};
1441 static constexpr uint32_t AlignModeMask{0x0000'0006};
1442 static constexpr uint32_t PackAttrMask{0x00000'0008};
1443 static constexpr uint32_t PackNumMask{0x0000'01F0};
1444 };
1445
1446 template <typename ValueType> struct PragmaStack {
1447 struct Slot {
1448 llvm::StringRef StackSlotLabel;
1449 ValueType Value;
1452 Slot(llvm::StringRef StackSlotLabel, ValueType Value,
1457 };
1458
1459 void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action,
1460 llvm::StringRef StackSlotLabel, ValueType Value) {
1461 if (Action == PSK_Reset) {
1463 CurrentPragmaLocation = PragmaLocation;
1464 return;
1465 }
1466 if (Action & PSK_Push)
1467 Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
1468 PragmaLocation);
1469 else if (Action & PSK_Pop) {
1470 if (!StackSlotLabel.empty()) {
1471 // If we've got a label, try to find it and jump there.
1472 auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
1473 return x.StackSlotLabel == StackSlotLabel;
1474 });
1475 // If we found the label so pop from there.
1476 if (I != Stack.rend()) {
1477 CurrentValue = I->Value;
1478 CurrentPragmaLocation = I->PragmaLocation;
1479 Stack.erase(std::prev(I.base()), Stack.end());
1480 }
1481 } else if (!Stack.empty()) {
1482 // We do not have a label, just pop the last entry.
1483 CurrentValue = Stack.back().Value;
1484 CurrentPragmaLocation = Stack.back().PragmaLocation;
1485 Stack.pop_back();
1486 }
1487 }
1488 if (Action & PSK_Set) {
1490 CurrentPragmaLocation = PragmaLocation;
1491 }
1492 }
1493
1494 // MSVC seems to add artificial slots to #pragma stacks on entering a C++
1495 // method body to restore the stacks on exit, so it works like this:
1496 //
1497 // struct S {
1498 // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
1499 // void Method {}
1500 // #pragma <name>(pop, InternalPragmaSlot)
1501 // };
1502 //
1503 // It works even with #pragma vtordisp, although MSVC doesn't support
1504 // #pragma vtordisp(push [, id], n)
1505 // syntax.
1506 //
1507 // Push / pop a named sentinel slot.
1508 void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
1509 assert((Action == PSK_Push || Action == PSK_Pop) &&
1510 "Can only push / pop #pragma stack sentinels!");
1512 }
1513
1514 // Constructors.
1515 explicit PragmaStack(const ValueType &Default)
1517
1518 bool hasValue() const { return CurrentValue != DefaultValue; }
1519
1521 ValueType DefaultValue; // Value used for PSK_Reset action.
1522 ValueType CurrentValue;
1524 };
1525 // FIXME: We should serialize / deserialize these if they occur in a PCH (but
1526 // we shouldn't do so if they're in a module).
1527
1528 /// Whether to insert vtordisps prior to virtual bases in the Microsoft
1529 /// C++ ABI. Possible values are 0, 1, and 2, which mean:
1530 ///
1531 /// 0: Suppress all vtordisps
1532 /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
1533 /// structors
1534 /// 2: Always insert vtordisps to support RTTI on partially constructed
1535 /// objects
1538 // The current #pragma align/pack values and locations at each #include.
1543 };
1545 // Segment #pragmas.
1550
1551 // #pragma strict_gs_check.
1553
1554 // This stack tracks the current state of Sema.CurFPFeatures.
1557 FPOptionsOverride result;
1558 if (!FpPragmaStack.hasValue()) {
1559 result = FPOptionsOverride();
1560 } else {
1561 result = FpPragmaStack.CurrentValue;
1562 }
1563 return result;
1564 }
1565
1571 };
1572
1573 // RAII object to push / pop sentinel slots for all MS #pragma stacks.
1574 // Actions should be performed only if we enter / exit a C++ method body.
1576 public:
1577 PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
1579
1580 private:
1581 Sema &S;
1582 StringRef SlotLabel;
1583 bool ShouldAct;
1584 };
1585
1586 /// Last section used with #pragma init_seg.
1589
1590 /// Sections used with #pragma alloc_text.
1591 llvm::StringMap<std::tuple<StringRef, SourceLocation>> FunctionToSectionMap;
1592
1593 /// VisContext - Manages the stack for \#pragma GCC visibility.
1594 void *VisContext; // Really a "PragmaVisStack*"
1595
1596 /// This an attribute introduced by \#pragma clang attribute.
1602 };
1603
1604 /// A push'd group of PragmaAttributeEntries.
1606 /// The location of the push attribute.
1608 /// The namespace of this push group.
1611 };
1612
1614
1615 /// The declaration that is currently receiving an attribute from the
1616 /// #pragma attribute stack.
1618
1619 /// This represents the last location of a "#pragma clang optimize off"
1620 /// directive if such a directive has not been closed by an "on" yet. If
1621 /// optimizations are currently "on", this is set to an invalid location.
1623
1624 /// Get the location for the currently active "\#pragma clang optimize
1625 /// off". If this location is invalid, then the state of the pragma is "on".
1628 }
1629
1630 /// The "on" or "off" argument passed by \#pragma optimize, that denotes
1631 /// whether the optimizations in the list passed to the pragma should be
1632 /// turned off or on. This boolean is true by default because command line
1633 /// options are honored when `#pragma optimize("", on)`.
1634 /// (i.e. `ModifyFnAttributeMSPragmaOptimze()` does nothing)
1636
1637 /// Set of no-builtin functions listed by \#pragma function.
1639
1640 /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
1641 /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
1643
1644 /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
1646
1647 /// Add gsl::Pointer attribute to std::container::iterator
1648 /// \param ND The declaration that introduces the name
1649 /// std::container::iterator. \param UnderlyingRecord The record named by ND.
1650 void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord);
1651
1652 /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
1654
1655 /// Add [[gsl::Pointer]] attributes for std:: types.
1657
1659 POAK_Native, // #pragma options align=native
1660 POAK_Natural, // #pragma options align=natural
1661 POAK_Packed, // #pragma options align=packed
1662 POAK_Power, // #pragma options align=power
1663 POAK_Mac68k, // #pragma options align=mac68k
1664 POAK_Reset // #pragma options align=reset
1666
1667 /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
1670 PragmaClangSectionKind SecKind,
1671 StringRef SecName);
1672
1673 /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
1675 SourceLocation PragmaLoc);
1676
1677 /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
1678 void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
1679 StringRef SlotLabel, Expr *Alignment);
1680
1681 /// ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs
1682 /// (unless they are value dependent or type dependent). Returns false
1683 /// and emits a diagnostic if one or more of the arguments could not be
1684 /// folded into a constant.
1687
1691 };
1692
1694 SourceLocation IncludeLoc);
1696
1697 /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
1699
1700 /// ActOnPragmaMSComment - Called on well formed
1701 /// \#pragma comment(kind, "arg").
1703 StringRef Arg);
1704
1705 /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
1706 void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
1707 StringRef Value);
1708
1709 /// Are precise floating point semantics currently enabled?
1711 return !CurFPFeatures.getAllowFPReassociate() &&
1712 !CurFPFeatures.getNoSignedZero() &&
1713 !CurFPFeatures.getAllowReciprocal() &&
1714 !CurFPFeatures.getAllowApproxFunc();
1715 }
1716
1719
1720 /// ActOnPragmaFloatControl - Call on well-formed \#pragma float_control
1723
1724 /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
1725 /// pointers_to_members(representation method[, general purpose
1726 /// representation]).
1729 SourceLocation PragmaLoc);
1730
1731 /// Called on well formed \#pragma vtordisp().
1734
1735 bool UnifySection(StringRef SectionName, int SectionFlags,
1736 NamedDecl *TheDecl);
1737 bool UnifySection(StringRef SectionName, int SectionFlags,
1738 SourceLocation PragmaSectionLocation);
1739
1740 /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
1741 void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
1742 PragmaMsStackAction Action,
1743 llvm::StringRef StackSlotLabel,
1744 StringLiteral *SegmentName, llvm::StringRef PragmaName);
1745
1746 /// Called on well formed \#pragma section().
1747 void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags,
1748 StringLiteral *SegmentName);
1749
1750 /// Called on well-formed \#pragma init_seg().
1751 void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
1752 StringLiteral *SegmentName);
1753
1754 /// Called on well-formed \#pragma alloc_text().
1756 SourceLocation PragmaLocation, StringRef Section,
1757 const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
1758 &Functions);
1759
1760 /// ActOnPragmaMSStrictGuardStackCheck - Called on well formed \#pragma
1761 /// strict_gs_check.
1763 PragmaMsStackAction Action,
1764 bool Value);
1765
1766 /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
1767 void ActOnPragmaUnused(const Token &Identifier, Scope *curScope,
1768 SourceLocation PragmaLoc);
1769
1770 /// AddCFAuditedAttribute - Check whether we're currently within
1771 /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
1772 /// the appropriate attribute.
1773 void AddCFAuditedAttribute(Decl *D);
1774
1776 SourceLocation PragmaLoc,
1779 const IdentifierInfo *Namespace);
1780
1781 /// Called on well-formed '\#pragma clang attribute pop'.
1783 const IdentifierInfo *Namespace);
1784
1785 /// Adds the attributes that have been specified using the
1786 /// '\#pragma clang attribute push' directives to the given declaration.
1787 void AddPragmaAttributes(Scope *S, Decl *D);
1788
1790
1792
1793 /// Called on well formed \#pragma clang optimize.
1794 void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
1795
1796 /// #pragma optimize("[optimization-list]", on | off).
1797 void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn);
1798
1799 /// Call on well formed \#pragma function.
1800 void
1802 const llvm::SmallVectorImpl<StringRef> &NoBuiltins);
1803
1804 /// Only called on function definitions; if there is a pragma in scope
1805 /// with the effect of a range-based optnone, consider marking the function
1806 /// with attribute optnone.
1808
1809 /// Only called on function definitions; if there is a `#pragma alloc_text`
1810 /// that decides which code section the function should be in, add
1811 /// attribute section to the function.
1813
1814 /// Adds the 'optnone' attribute to the function declaration if there
1815 /// are no conflicts; Loc represents the location causing the 'optnone'
1816 /// attribute to be added (usually because of a pragma).
1818
1819 /// Only called on function definitions; if there is a MSVC #pragma optimize
1820 /// in scope, consider changing the function's attributes based on the
1821 /// optimization list passed to the pragma.
1823
1824 /// Only called on function definitions; if there is a pragma in scope
1825 /// with the effect of a range-based no_builtin, consider marking the function
1826 /// with attribute no_builtin.
1828
1829 /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
1830 /// add an appropriate visibility attribute.
1832
1833 /// FreeVisContext - Deallocate and null out VisContext.
1834 void FreeVisContext();
1835
1836 /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
1837 void ActOnPragmaVisibility(const IdentifierInfo *VisType,
1838 SourceLocation PragmaLoc);
1839
1840 /// ActOnPragmaFPContract - Called on well formed
1841 /// \#pragma {STDC,OPENCL} FP_CONTRACT and
1842 /// \#pragma clang fp contract
1844
1845 /// Called on well formed
1846 /// \#pragma clang fp reassociate
1847 /// or
1848 /// \#pragma clang fp reciprocal
1850 bool IsEnabled);
1851
1852 /// ActOnPragmaFenvAccess - Called on well formed
1853 /// \#pragma STDC FENV_ACCESS
1854 void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled);
1855
1856 /// ActOnPragmaCXLimitedRange - Called on well formed
1857 /// \#pragma STDC CX_LIMITED_RANGE
1860
1861 /// Called on well formed '\#pragma clang fp' that has option 'exceptions'.
1864
1865 /// Called to set constant rounding mode for floating point operations.
1866 void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode);
1867
1868 /// Called to set exception behavior for floating point operations.
1870
1871 /// PushNamespaceVisibilityAttr - Note that we've entered a
1872 /// namespace with a visibility attribute.
1873 void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
1874 SourceLocation Loc);
1875
1876 /// PopPragmaVisibility - Pop the top element of the visibility stack; used
1877 /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
1878 void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
1879
1880 /// Handles semantic checking for features that are common to all attributes,
1881 /// such as checking whether a parameter was properly specified, or the
1882 /// correct number of arguments were passed, etc. Returns true if the
1883 /// attribute has been diagnosed.
1884 bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A,
1885 bool SkipArgCountCheck = false);
1886 bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
1887 bool SkipArgCountCheck = false);
1888
1889 ///@}
1890
1891 //
1892 //
1893 // -------------------------------------------------------------------------
1894 //
1895 //
1896
1897 /// \name Availability Attribute Handling
1898 /// Implementations are in SemaAvailability.cpp
1899 ///@{
1900
1901public:
1902 /// Issue any -Wunguarded-availability warnings in \c FD
1904
1906
1907 /// Retrieve the current function, if any, that should be analyzed for
1908 /// potential availability violations.
1910
1912 const ObjCInterfaceDecl *UnknownObjCClass,
1913 bool ObjCPropertyAccess,
1914 bool AvoidPartialAvailabilityChecks = false,
1915 ObjCInterfaceDecl *ClassReceiver = nullptr);
1916
1917 ///@}
1918
1919 //
1920 //
1921 // -------------------------------------------------------------------------
1922 //
1923 //
1924
1925 /// \name Casts
1926 /// Implementations are in SemaCast.cpp
1927 ///@{
1928
1929public:
1931 return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast ||
1932 CCK == CCK_OtherCast;
1933 }
1934
1935 /// ActOnCXXNamedCast - Parse
1936 /// {dynamic,static,reinterpret,const,addrspace}_cast's.
1938 SourceLocation LAngleBracketLoc, Declarator &D,
1939 SourceLocation RAngleBracketLoc,
1940 SourceLocation LParenLoc, Expr *E,
1941 SourceLocation RParenLoc);
1942
1944 TypeSourceInfo *Ty, Expr *E,
1945 SourceRange AngleBrackets, SourceRange Parens);
1946
1948 ExprResult Operand,
1949 SourceLocation RParenLoc);
1950
1952 Expr *Operand, SourceLocation RParenLoc);
1953
1954 // Checks that reinterpret casts don't have undefined behavior.
1955 void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
1956 bool IsDereference, SourceRange Range);
1957
1958 // Checks that the vector type should be initialized from a scalar
1959 // by splatting the value rather than populating a single element.
1960 // This is the case for AltiVecVector types as well as with
1961 // AltiVecPixel and AltiVecBool when -faltivec-src-compat=xl is specified.
1962 bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy);
1963
1964 // Checks if the -faltivec-src-compat=gcc option is specified.
1965 // If so, AltiVecVector, AltiVecBool and AltiVecPixel types are
1966 // treated the same way as they are when trying to initialize
1967 // these vectors on gcc (an error is emitted).
1969 QualType SrcTy);
1970
1972 SourceLocation RParenLoc, Expr *Op);
1973
1975 SourceLocation LParenLoc,
1976 Expr *CastExpr,
1977 SourceLocation RParenLoc);
1978
1979 ///@}
1980
1981 //
1982 //
1983 // -------------------------------------------------------------------------
1984 //
1985 //
1986
1987 /// \name Extra Semantic Checking
1988 /// Implementations are in SemaChecking.cpp
1989 ///@{
1990
1991public:
1992 /// Used to change context to isConstantEvaluated without pushing a heavy
1993 /// ExpressionEvaluationContextRecord object.
1995
1999 }
2000
2002 unsigned ByteNo) const;
2003
2005 FAPK_Fixed, // values to format are fixed (no C-style variadic arguments)
2006 FAPK_Variadic, // values to format are passed as variadic arguments
2007 FAPK_VAList, // values to format are passed in a va_list
2008 };
2009
2010 // Used to grab the relevant information from a FormatAttr and a
2011 // FunctionDeclaration.
2013 unsigned FormatIdx;
2016 };
2017
2018 static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
2019 bool IsVariadic, FormatStringInfo *FSI);
2020
2021 // Used by C++ template instantiation.
2024 SourceLocation BuiltinLoc,
2025 SourceLocation RParenLoc);
2026
2039 static FormatStringType GetFormatStringType(const FormatAttr *Format);
2040
2041 bool FormatStringHasSArg(const StringLiteral *FExpr);
2042
2043 static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
2044
2045 void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS,
2046 BinaryOperatorKind Opcode);
2047
2048 /// Register a magic integral constant to be used as a type tag.
2049 void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
2050 uint64_t MagicValue, QualType Type,
2051 bool LayoutCompatible, bool MustBeNull);
2052
2055
2059
2061
2062 /// If true, \c Type should be compared with other expression's types for
2063 /// layout-compatibility.
2064 LLVM_PREFERRED_TYPE(bool)
2066 LLVM_PREFERRED_TYPE(bool)
2067 unsigned MustBeNull : 1;
2068 };
2069
2070 /// A pair of ArgumentKind identifier and magic value. This uniquely
2071 /// identifies the magic value.
2072 typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
2073
2074 /// Diagnoses the current set of gathered accesses. This typically
2075 /// happens at full expression level. The set is cleared after emitting the
2076 /// diagnostics.
2078
2079 /// This function checks if the expression is in the sef of potentially
2080 /// misaligned members and it is converted to some pointer type T with lower
2081 /// or equal alignment requirements. If so it removes it. This is used when
2082 /// we do not want to diagnose such misaligned access (e.g. in conversions to
2083 /// void*).
2084 void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
2085
2086 /// This function calls Action when it determines that E designates a
2087 /// misaligned member due to the packed attribute. This is used to emit
2088 /// local diagnostics like in reference binding.
2090 Expr *E,
2091 llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
2092 Action);
2093
2094 enum class AtomicArgumentOrder { API, AST };
2096 BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
2097 SourceLocation RParenLoc, MultiExprArg Args,
2100
2101 /// Check to see if a given expression could have '.c_str()' called on it.
2102 bool hasCStrMethod(const Expr *E);
2103
2106 bool IsEqual, SourceRange Range);
2107
2109 bool CheckParameterNames);
2110
2111 void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
2112
2113 /// checkRetainCycles - Check whether an Objective-C message send
2114 /// might create an obvious retain cycle.
2116 void checkRetainCycles(Expr *receiver, Expr *argument);
2117 void checkRetainCycles(VarDecl *Var, Expr *Init);
2118
2119 /// checkUnsafeAssigns - Check whether +1 expr is being assigned
2120 /// to weak/__unsafe_unretained type.
2121 bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
2122
2123 /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
2124 /// to weak/__unsafe_unretained expression.
2125 void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
2126
2127 /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
2128 /// statement as a \p Body, and it is located on the same line.
2129 ///
2130 /// This helps prevent bugs due to typos, such as:
2131 /// if (condition);
2132 /// do_stuff();
2133 void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body,
2134 unsigned DiagID);
2135
2136 /// Warn if a for/while loop statement \p S, which is followed by
2137 /// \p PossibleBody, has a suspicious null statement as a body.
2138 void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody);
2139
2140 /// Warn if a value is moved to itself.
2141 void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
2142 SourceLocation OpLoc);
2143
2144 // Used for emitting the right warning by DefaultVariadicArgumentPromotion
2152
2153 bool IsLayoutCompatible(QualType T1, QualType T2) const;
2154
2155 bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
2156 const FunctionProtoType *Proto);
2157
2158private:
2159 void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
2160 const ArraySubscriptExpr *ASE = nullptr,
2161 bool AllowOnePastEnd = true, bool IndexNegated = false);
2162 void CheckArrayAccess(const Expr *E);
2163
2164 bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
2166 bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
2167 const FunctionProtoType *Proto);
2168 bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
2169 void CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType,
2171 const FunctionProtoType *Proto, SourceLocation Loc);
2172
2173 void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
2174
2175 void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
2176 StringRef ParamName, QualType ArgTy, QualType ParamTy);
2177
2178 void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
2179 const Expr *ThisArg, ArrayRef<const Expr *> Args,
2180 bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
2181 VariadicCallType CallType);
2182
2183 bool CheckObjCString(Expr *Arg);
2184 ExprResult CheckOSLogFormatStringArg(Expr *Arg);
2185
2186 ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
2187 CallExpr *TheCall);
2188
2189 bool CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2190 CallExpr *TheCall);
2191
2192 void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall);
2193
2194 bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
2195 unsigned MaxWidth);
2196 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2197 CallExpr *TheCall);
2198 bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2199 bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2200 bool ParseSVEImmChecks(CallExpr *TheCall,
2201 SmallVector<std::tuple<int, int, int>, 3> &ImmChecks);
2202 bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2203 bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2204 CallExpr *TheCall);
2205 bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
2206 bool WantCDE);
2207 bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2208 CallExpr *TheCall);
2209
2210 bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2211 CallExpr *TheCall);
2212 bool CheckBPFBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2213 bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2214 bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
2215 bool CheckMipsBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2216 CallExpr *TheCall);
2217 bool CheckMipsBuiltinCpu(const TargetInfo &TI, unsigned BuiltinID,
2218 CallExpr *TheCall);
2219 bool CheckMipsBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
2220 bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2221 bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
2222 bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
2223 bool CheckX86BuiltinTileArguments(unsigned BuiltinID, CallExpr *TheCall);
2224 bool CheckX86BuiltinTileArgumentsRange(CallExpr *TheCall,
2225 ArrayRef<int> ArgNums);
2226 bool CheckX86BuiltinTileDuplicate(CallExpr *TheCall, ArrayRef<int> ArgNums);
2227 bool CheckX86BuiltinTileRangeAndDuplicate(CallExpr *TheCall,
2228 ArrayRef<int> ArgNums);
2229 bool CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2230 CallExpr *TheCall);
2231 bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2232 CallExpr *TheCall);
2233 bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2234 bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
2235 bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2236 CallExpr *TheCall);
2237 void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D);
2238 bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
2239 unsigned BuiltinID, CallExpr *TheCall);
2240 bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
2241 unsigned BuiltinID,
2242 CallExpr *TheCall);
2243 bool CheckNVPTXBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2244 CallExpr *TheCall);
2245
2246 bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
2247 bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
2248 bool SemaBuiltinUnorderedCompare(CallExpr *TheCall, unsigned BuiltinID);
2249 bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs,
2250 unsigned BuiltinID);
2251 bool SemaBuiltinComplex(CallExpr *TheCall);
2252 bool SemaBuiltinVSX(CallExpr *TheCall);
2253 bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
2254 bool SemaValueIsRunOfOnes(CallExpr *TheCall, unsigned ArgNum);
2255
2256 bool SemaBuiltinPrefetch(CallExpr *TheCall);
2257 bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
2258 bool SemaBuiltinArithmeticFence(CallExpr *TheCall);
2259 bool SemaBuiltinAssume(CallExpr *TheCall);
2260 bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
2261 bool SemaBuiltinLongjmp(CallExpr *TheCall);
2262 bool SemaBuiltinSetjmp(CallExpr *TheCall);
2263 ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
2264 ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
2265 ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
2267 bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
2268 llvm::APSInt &Result);
2269 bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low,
2270 int High, bool RangeIsError = true);
2271 bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
2272 unsigned Multiple);
2273 bool SemaBuiltinConstantArgPower2(CallExpr *TheCall, int ArgNum);
2274 bool SemaBuiltinConstantArgShiftedByte(CallExpr *TheCall, int ArgNum,
2275 unsigned ArgBits);
2276 bool SemaBuiltinConstantArgShiftedByteOrXXFF(CallExpr *TheCall, int ArgNum,
2277 unsigned ArgBits);
2278 bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
2279 int ArgNum, unsigned ExpectedFieldNum,
2280 bool AllowName);
2281 bool SemaBuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
2282 bool SemaBuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID,
2283 const char *TypeDesc);
2284
2285 bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
2286
2287 bool SemaBuiltinElementwiseMath(CallExpr *TheCall);
2288 bool SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall,
2289 bool CheckForFloatArgs = true);
2290 bool PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall);
2291 bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
2292
2293 bool SemaBuiltinNonDeterministicValue(CallExpr *TheCall);
2294
2295 // Matrix builtin handling.
2296 ExprResult SemaBuiltinMatrixTranspose(CallExpr *TheCall,
2297 ExprResult CallResult);
2298 ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
2299 ExprResult CallResult);
2300 ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
2301 ExprResult CallResult);
2302
2303 // WebAssembly builtin handling.
2304 bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
2305 bool BuiltinWasmRefNullFunc(CallExpr *TheCall);
2306 bool BuiltinWasmTableGet(CallExpr *TheCall);
2307 bool BuiltinWasmTableSet(CallExpr *TheCall);
2308 bool BuiltinWasmTableSize(CallExpr *TheCall);
2309 bool BuiltinWasmTableGrow(CallExpr *TheCall);
2310 bool BuiltinWasmTableFill(CallExpr *TheCall);
2311 bool BuiltinWasmTableCopy(CallExpr *TheCall);
2312
2313 bool CheckFormatArguments(const FormatAttr *Format,
2314 ArrayRef<const Expr *> Args, bool IsCXXMember,
2315 VariadicCallType CallType, SourceLocation Loc,
2316 SourceRange Range,
2317 llvm::SmallBitVector &CheckedVarArgs);
2318 bool CheckFormatArguments(ArrayRef<const Expr *> Args,
2319 FormatArgumentPassingKind FAPK, unsigned format_idx,
2320 unsigned firstDataArg, FormatStringType Type,
2321 VariadicCallType CallType, SourceLocation Loc,
2322 SourceRange range,
2323 llvm::SmallBitVector &CheckedVarArgs);
2324
2325 void CheckInfNaNFunction(const CallExpr *Call, const FunctionDecl *FDecl);
2326
2327 void CheckAbsoluteValueFunction(const CallExpr *Call,
2328 const FunctionDecl *FDecl);
2329
2330 void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
2331
2332 void CheckMemaccessArguments(const CallExpr *Call, unsigned BId,
2333 IdentifierInfo *FnName);
2334
2335 void CheckStrlcpycatArguments(const CallExpr *Call, IdentifierInfo *FnName);
2336
2337 void CheckStrncatArguments(const CallExpr *Call, IdentifierInfo *FnName);
2338
2339 void CheckFreeArguments(const CallExpr *E);
2340
2341 void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
2342 SourceLocation ReturnLoc, bool isObjCMethod = false,
2343 const AttrVec *Attrs = nullptr,
2344 const FunctionDecl *FD = nullptr);
2345
2346 void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
2347 void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
2348 void CheckForIntOverflow(const Expr *E);
2349 void CheckUnsequencedOperations(const Expr *E);
2350
2351 /// Perform semantic checks on a completed expression. This will either
2352 /// be a full-expression or a default argument expression.
2353 void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
2354 bool IsConstexpr = false);
2355
2356 void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
2357 Expr *Init);
2358 /// Check whether receiver is mutable ObjC container which
2359 /// attempts to add itself into the container
2360 void CheckObjCCircularContainer(ObjCMessageExpr *Message);
2361
2362 void CheckTCBEnforcement(const SourceLocation CallExprLoc,
2363 const NamedDecl *Callee);
2364
2365 /// A map from magic value to type information.
2366 std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
2367 TypeTagForDatatypeMagicValues;
2368
2369 /// Peform checks on a call of a function with argument_with_type_tag
2370 /// or pointer_with_type_tag attributes.
2371 void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
2372 const ArrayRef<const Expr *> ExprArgs,
2373 SourceLocation CallSiteLoc);
2374
2375 /// Check if we are taking the address of a packed field
2376 /// as this may be a problem if the pointer value is dereferenced.
2377 void CheckAddressOfPackedMember(Expr *rhs);
2378
2379 /// Helper class that collects misaligned member designations and
2380 /// their location info for delayed diagnostics.
2381 struct MisalignedMember {
2382 Expr *E;
2383 RecordDecl *RD;
2384 ValueDecl *MD;
2385 CharUnits Alignment;
2386
2387 MisalignedMember() : E(), RD(), MD() {}
2388 MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
2389 CharUnits Alignment)
2390 : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
2391 explicit MisalignedMember(Expr *E)
2392 : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
2393
2394 bool operator==(const MisalignedMember &m) { return this->E == m.E; }
2395 };
2396 /// Small set of gathered accesses to potentially misaligned members
2397 /// due to the packed attribute.
2398 SmallVector<MisalignedMember, 4> MisalignedMembers;
2399
2400 /// Adds an expression to the set of gathered misaligned members.
2401 void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
2402 CharUnits Alignment);
2403 ///@}
2404
2405 //
2406 //
2407 // -------------------------------------------------------------------------
2408 //
2409 //
2410
2411 /// \name C++ Coroutines
2412 /// Implementations are in SemaCoroutine.cpp
2413 ///@{
2414
2415public:
2416 /// The C++ "std::coroutine_traits" template, which is defined in
2417 /// <coroutine_traits>
2419
2421 StringRef Keyword);
2425
2428 UnresolvedLookupExpr *Lookup);
2430 Expr *Awaiter, bool IsImplicit = false);
2432 UnresolvedLookupExpr *Lookup);
2435 bool IsImplicit = false);
2440
2441 // As a clang extension, enforces that a non-coroutine function must be marked
2442 // with [[clang::coro_wrapper]] if it returns a type marked with
2443 // [[clang::coro_return_type]].
2444 // Expects that FD is not a coroutine.
2446 /// Lookup 'coroutine_traits' in std namespace and std::experimental
2447 /// namespace. The namespace found is recorded in Namespace.
2449 SourceLocation FuncLoc);
2450 /// Check that the expression co_await promise.final_suspend() shall not be
2451 /// potentially-throwing.
2452 bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
2453
2454 ///@}
2455
2456 //
2457 //
2458 // -------------------------------------------------------------------------
2459 //
2460 //
2461
2462 /// \name C++ Scope Specifiers
2463 /// Implementations are in SemaCXXScopeSpec.cpp
2464 ///@{
2465
2466public:
2467 // Marks SS invalid if it represents an incomplete type.
2469 // Complete an enum decl, maybe without a scope spec.
2471 CXXScopeSpec *SS = nullptr);
2472
2475 bool EnteringContext = false);
2478
2479 /// The parser has parsed a global nested-name-specifier '::'.
2480 ///
2481 /// \param CCLoc The location of the '::'.
2482 ///
2483 /// \param SS The nested-name-specifier, which will be updated in-place
2484 /// to reflect the parsed nested-name-specifier.
2485 ///
2486 /// \returns true if an error occurred, false otherwise.
2488
2489 /// The parser has parsed a '__super' nested-name-specifier.
2490 ///
2491 /// \param SuperLoc The location of the '__super' keyword.
2492 ///
2493 /// \param ColonColonLoc The location of the '::'.
2494 ///
2495 /// \param SS The nested-name-specifier, which will be updated in-place
2496 /// to reflect the parsed nested-name-specifier.
2497 ///
2498 /// \returns true if an error occurred, false otherwise.
2500 SourceLocation ColonColonLoc, CXXScopeSpec &SS);
2501
2503 bool *CanCorrect = nullptr);
2505
2506 /// Keeps information about an identifier in a nested-name-spec.
2507 ///
2509 /// The type of the object, if we're parsing nested-name-specifier in
2510 /// a member access expression.
2512
2513 /// The identifier preceding the '::'.
2515
2516 /// The location of the identifier.
2518
2519 /// The location of the '::'.
2521
2522 /// Creates info object for the most typical case.
2524 SourceLocation ColonColonLoc,
2525 ParsedType ObjectType = ParsedType())
2526 : ObjectType(ObjectType), Identifier(II), IdentifierLoc(IdLoc),
2527 CCLoc(ColonColonLoc) {}
2528
2530 SourceLocation ColonColonLoc, QualType ObjectType)
2531 : ObjectType(ParsedType::make(ObjectType)), Identifier(II),
2532 IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {}
2533 };
2534
2535 bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
2536 bool EnteringContext, CXXScopeSpec &SS,
2537 NamedDecl *ScopeLookupResult,
2538 bool ErrorRecoveryLookup,
2539 bool *IsCorrectedToColon = nullptr,
2540 bool OnlyNamespace = false);
2541
2542 /// The parser has parsed a nested-name-specifier 'identifier::'.
2543 ///
2544 /// \param S The scope in which this nested-name-specifier occurs.
2545 ///
2546 /// \param IdInfo Parser information about an identifier in the
2547 /// nested-name-spec.
2548 ///
2549 /// \param EnteringContext Whether we're entering the context nominated by
2550 /// this nested-name-specifier.
2551 ///
2552 /// \param SS The nested-name-specifier, which is both an input
2553 /// parameter (the nested-name-specifier before this type) and an
2554 /// output parameter (containing the full nested-name-specifier,
2555 /// including this new type).
2556 ///
2557 /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
2558 /// are allowed. The bool value pointed by this parameter is set to 'true'
2559 /// if the identifier is treated as if it was followed by ':', not '::'.
2560 ///
2561 /// \param OnlyNamespace If true, only considers namespaces in lookup.
2562 ///
2563 /// \returns true if an error occurred, false otherwise.
2564 bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
2565 bool EnteringContext, CXXScopeSpec &SS,
2566 bool *IsCorrectedToColon = nullptr,
2567 bool OnlyNamespace = false);
2568
2569 /// The parser has parsed a nested-name-specifier
2570 /// 'template[opt] template-name < template-args >::'.
2571 ///
2572 /// \param S The scope in which this nested-name-specifier occurs.
2573 ///
2574 /// \param SS The nested-name-specifier, which is both an input
2575 /// parameter (the nested-name-specifier before this type) and an
2576 /// output parameter (containing the full nested-name-specifier,
2577 /// including this new type).
2578 ///
2579 /// \param TemplateKWLoc the location of the 'template' keyword, if any.
2580 /// \param TemplateName the template name.
2581 /// \param TemplateNameLoc The location of the template name.
2582 /// \param LAngleLoc The location of the opening angle bracket ('<').
2583 /// \param TemplateArgs The template arguments.
2584 /// \param RAngleLoc The location of the closing angle bracket ('>').
2585 /// \param CCLoc The location of the '::'.
2586 ///
2587 /// \param EnteringContext Whether we're entering the context of the
2588 /// nested-name-specifier.
2589 ///
2590 ///
2591 /// \returns true if an error occurred, false otherwise.
2593 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
2594 TemplateTy TemplateName, SourceLocation TemplateNameLoc,
2595 SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
2596 SourceLocation RAngleLoc, SourceLocation CCLoc, bool EnteringContext);
2597
2599 SourceLocation ColonColonLoc);
2600
2602 const DeclSpec &DS,
2603 SourceLocation ColonColonLoc,
2604 QualType Type);
2605
2607 NestedNameSpecInfo &IdInfo,
2608 bool EnteringContext);
2609
2610 /// Given a C++ nested-name-specifier, produce an annotation value
2611 /// that the parser can use later to reconstruct the given
2612 /// nested-name-specifier.
2613 ///
2614 /// \param SS A nested-name-specifier.
2615 ///
2616 /// \returns A pointer containing all of the information in the
2617 /// nested-name-specifier \p SS.
2619
2620 /// Given an annotation pointer for a nested-name-specifier, restore
2621 /// the nested-name-specifier structure.
2622 ///
2623 /// \param Annotation The annotation pointer, produced by
2624 /// \c SaveNestedNameSpecifierAnnotation().
2625 ///
2626 /// \param AnnotationRange The source range corresponding to the annotation.
2627 ///
2628 /// \param SS The nested-name-specifier that will be updated with the contents
2629 /// of the annotation pointer.
2630 void RestoreNestedNameSpecifierAnnotation(void *Annotation,
2631 SourceRange AnnotationRange,
2632 CXXScopeSpec &SS);
2633
2634 bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
2635
2636 /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
2637 /// scope or nested-name-specifier) is parsed, part of a declarator-id.
2638 /// After this method is called, according to [C++ 3.4.3p3], names should be
2639 /// looked up in the declarator-id's scope, until the declarator is parsed and
2640 /// ActOnCXXExitDeclaratorScope is called.
2641 /// The 'SS' should be a non-empty valid CXXScopeSpec.
2643
2644 /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
2645 /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
2646 /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
2647 /// Used to indicate that names should revert to being looked up in the
2648 /// defining scope.
2650
2651 ///@}
2652
2653 //
2654 //
2655 // -------------------------------------------------------------------------
2656 //
2657 //
2658
2659 /// \name Declarations
2660 /// Implementations are in SemaDecl.cpp
2661 ///@{
2662
2663public:
2665
2666 /// The index of the first InventedParameterInfo that refers to the current
2667 /// context.
2669
2670 /// A RAII object to temporarily push a declaration context.
2672 private:
2673 Sema &S;
2674 DeclContext *SavedContext;
2675 ProcessingContextState SavedContextState;
2676 QualType SavedCXXThisTypeOverride;
2677 unsigned SavedFunctionScopesStart;
2678 unsigned SavedInventedParameterInfosStart;
2679
2680 public:
2681 ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
2682 : S(S), SavedContext(S.CurContext),
2683 SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
2684 SavedCXXThisTypeOverride(S.CXXThisTypeOverride),
2685 SavedFunctionScopesStart(S.FunctionScopesStart),
2686 SavedInventedParameterInfosStart(S.InventedParameterInfosStart) {
2687 assert(ContextToPush && "pushing null context");
2688 S.CurContext = ContextToPush;
2689 if (NewThisContext)
2690 S.CXXThisTypeOverride = QualType();
2691 // Any saved FunctionScopes do not refer to this context.
2692 S.FunctionScopesStart = S.FunctionScopes.size();
2693 S.InventedParameterInfosStart = S.InventedParameterInfos.size();
2694 }
2695
2696 void pop() {
2697 if (!SavedContext)
2698 return;
2699 S.CurContext = SavedContext;
2700 S.DelayedDiagnostics.popUndelayed(SavedContextState);
2701 S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
2702 S.FunctionScopesStart = SavedFunctionScopesStart;
2703 S.InventedParameterInfosStart = SavedInventedParameterInfosStart;
2704 SavedContext = nullptr;
2705 }
2706
2707 ~ContextRAII() { pop(); }
2708 };
2709
2710 void DiagnoseInvalidJumps(Stmt *Body);
2711
2712 /// The function definitions which were renamed as part of typo-correction
2713 /// to match their respective declarations. We want to keep track of them
2714 /// to ensure that we don't emit a "redefinition" error if we encounter a
2715 /// correctly named definition after the renamed definition.
2717
2718 /// A cache of the flags available in enumerations with the flag_bits
2719 /// attribute.
2720 mutable llvm::DenseMap<const EnumDecl *, llvm::APInt> FlagBitsCache;
2721
2722 /// WeakUndeclaredIdentifiers - Identifiers contained in \#pragma weak before
2723 /// declared. Rare. May alias another identifier, declared or undeclared.
2724 ///
2725 /// For aliases, the target identifier is used as a key for eventual
2726 /// processing when the target is declared. For the single-identifier form,
2727 /// the sole identifier is used as the key. Each entry is a `SetVector`
2728 /// (ordered by parse order) of aliases (identified by the alias name) in case
2729 /// of multiple aliases to the same undeclared identifier.
2730 llvm::MapVector<
2732 llvm::SetVector<
2734 llvm::SmallDenseSet<WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly>>>
2736
2737 /// ExtnameUndeclaredIdentifiers - Identifiers contained in
2738 /// \#pragma redefine_extname before declared. Used in Solaris system headers
2739 /// to define functions that occur in multiple standards to call the version
2740 /// in the currently selected standard.
2741 llvm::DenseMap<IdentifierInfo *, AsmLabelAttr *> ExtnameUndeclaredIdentifiers;
2742
2743 /// Set containing all typedefs that are likely unused.
2746
2750
2751 /// The set of file scoped decls seen so far that have not been used
2752 /// and must warn if not used. Only contains the first declaration.
2754
2758
2759 /// All the tentative definitions encountered in the TU.
2761
2762 /// All the external declarations encoutered and used in the TU.
2764
2765 /// Generally null except when we temporarily switch decl contexts,
2766 /// like in \see ActOnObjCTemporaryExitContainerContext.
2768
2769 /// Is the module scope we are in a C++ Header Unit?
2771 return ModuleScopes.empty() ? false
2772 : ModuleScopes.back().Module->isHeaderUnit();
2773 }
2774
2775 /// Get the module owning an entity.
2776 Module *getOwningModule(const Decl *Entity) {
2777 return Entity->getOwningModule();
2778 }
2779
2781 SkipBodyInfo() = default;
2782 bool ShouldSkip = false;
2783 bool CheckSameAsPrevious = false;
2785 NamedDecl *New = nullptr;
2786 };
2787
2788 DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
2789
2791 Scope *S, CXXScopeSpec *SS = nullptr,
2792 bool isClassName = false, bool HasTrailingDot = false,
2793 ParsedType ObjectType = nullptr,
2794 bool IsCtorOrDtorName = false,
2795 bool WantNontrivialTypeSourceInfo = false,
2796 bool IsClassTemplateDeductionContext = true,
2797 ImplicitTypenameContext AllowImplicitTypename =
2799 IdentifierInfo **CorrectedII = nullptr);
2801 bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
2803 Scope *S, CXXScopeSpec *SS,
2804 ParsedType &SuggestedType,
2805 bool IsTemplateName = false);
2806
2807 /// Attempt to behave like MSVC in situations where lookup of an unqualified
2808 /// type name has failed in a dependent context. In these situations, we
2809 /// automatically form a DependentTypeName that will retry lookup in a related
2810 /// scope during instantiation.
2812 SourceLocation NameLoc,
2813 bool IsTemplateTypeArg);
2814
2815 /// Describes the result of the name lookup and resolution performed
2816 /// by \c ClassifyName().
2818 /// This name is not a type or template in this context, but might be
2819 /// something else.
2821 /// Classification failed; an error has been produced.
2823 /// The name has been typo-corrected to a keyword.
2825 /// The name was classified as a type.
2827 /// The name was classified as a specific non-type, non-template
2828 /// declaration. ActOnNameClassifiedAsNonType should be called to
2829 /// convert the declaration to an expression.
2831 /// The name was classified as an ADL-only function name.
2832 /// ActOnNameClassifiedAsUndeclaredNonType should be called to convert the
2833 /// result to an expression.
2835 /// The name denotes a member of a dependent type that could not be
2836 /// resolved. ActOnNameClassifiedAsDependentNonType should be called to
2837 /// convert the result to an expression.
2839 /// The name was classified as an overload set, and an expression
2840 /// representing that overload set has been formed.
2841 /// ActOnNameClassifiedAsOverloadSet should be called to form a suitable
2842 /// expression referencing the overload set.
2844 /// The name was classified as a template whose specializations are types.
2846 /// The name was classified as a variable template name.
2848 /// The name was classified as a function template name.
2850 /// The name was classified as an ADL-only function template name.
2852 /// The name was classified as a concept name.
2854 };
2855
2858 union {
2863 };
2864
2865 explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
2866
2867 public:
2869
2870 NameClassification(const IdentifierInfo *Keyword) : Kind(NC_Keyword) {}
2871
2872 static NameClassification Error() { return NameClassification(NC_Error); }
2873
2875 return NameClassification(NC_Unknown);
2876 }
2877
2879 NameClassification Result(NC_OverloadSet);
2880 Result.Expr = E;
2881 return Result;
2882 }
2883
2885 NameClassification Result(NC_NonType);
2886 Result.NonTypeDecl = D;
2887 return Result;
2888 }
2889
2891 return NameClassification(NC_UndeclaredNonType);
2892 }
2893
2895 return NameClassification(NC_DependentNonType);
2896 }
2897
2899 NameClassification Result(NC_TypeTemplate);
2900 Result.Template = Name;
2901 return Result;
2902 }
2903
2905 NameClassification Result(NC_VarTemplate);
2906 Result.Template = Name;
2907 return Result;
2908 }
2909
2911 NameClassification Result(NC_FunctionTemplate);
2912 Result.Template = Name;
2913 return Result;
2914 }
2915
2917 NameClassification Result(NC_Concept);
2918 Result.Template = Name;
2919 return Result;
2920 }
2921
2923 NameClassification Result(NC_UndeclaredTemplate);
2924 Result.Template = Name;
2925 return Result;
2926 }
2927
2928 NameClassificationKind getKind() const { return Kind; }
2929
2931 assert(Kind == NC_OverloadSet);
2932 return Expr;
2933 }
2934
2936 assert(Kind == NC_Type);
2937 return Type;
2938 }
2939
2941 assert(Kind == NC_NonType);
2942 return NonTypeDecl;
2943 }
2944
2946 assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
2947 Kind == NC_VarTemplate || Kind == NC_Concept ||
2948 Kind == NC_UndeclaredTemplate);
2949 return Template;
2950 }
2951
2953 switch (Kind) {
2954 case NC_TypeTemplate:
2955 return TNK_Type_template;
2956 case NC_FunctionTemplate:
2957 return TNK_Function_template;
2958 case NC_VarTemplate:
2959 return TNK_Var_template;
2960 case NC_Concept:
2961 return TNK_Concept_template;
2962 case NC_UndeclaredTemplate:
2964 default:
2965 llvm_unreachable("unsupported name classification.");
2966 }
2967 }
2968 };
2969
2970 /// Perform name lookup on the given name, classifying it based on
2971 /// the results of name lookup and the following token.
2972 ///
2973 /// This routine is used by the parser to resolve identifiers and help direct
2974 /// parsing. When the identifier cannot be found, this routine will attempt
2975 /// to correct the typo and classify based on the resulting name.
2976 ///
2977 /// \param S The scope in which we're performing name lookup.
2978 ///
2979 /// \param SS The nested-name-specifier that precedes the name.
2980 ///
2981 /// \param Name The identifier. If typo correction finds an alternative name,
2982 /// this pointer parameter will be updated accordingly.
2983 ///
2984 /// \param NameLoc The location of the identifier.
2985 ///
2986 /// \param NextToken The token following the identifier. Used to help
2987 /// disambiguate the name.
2988 ///
2989 /// \param CCC The correction callback, if typo correction is desired.
2990 NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS,
2991 IdentifierInfo *&Name, SourceLocation NameLoc,
2992 const Token &NextToken,
2993 CorrectionCandidateCallback *CCC = nullptr);
2994
2995 /// Act on the result of classifying a name as an undeclared (ADL-only)
2996 /// non-type declaration.
2998 SourceLocation NameLoc);
2999 /// Act on the result of classifying a name as an undeclared member of a
3000 /// dependent base class.
3002 IdentifierInfo *Name,
3003 SourceLocation NameLoc,
3004 bool IsAddressOfOperand);
3005 /// Act on the result of classifying a name as a specific non-type
3006 /// declaration.
3008 NamedDecl *Found,
3009 SourceLocation NameLoc,
3010 const Token &NextToken);
3011 /// Act on the result of classifying a name as an overload set.
3013
3014 /// Describes the detailed kind of a template name. Used in diagnostics.
3021 Concept,
3023 };
3026
3027 /// Determine whether it's plausible that E was intended to be a
3028 /// template-name.
3030 if (!getLangOpts().CPlusPlus || E.isInvalid())
3031 return false;
3032 Dependent = false;
3033 if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
3034 return !DRE->hasExplicitTemplateArgs();
3035 if (auto *ME = dyn_cast<MemberExpr>(E.get()))
3036 return !ME->hasExplicitTemplateArgs();
3037 Dependent = true;
3038 if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
3039 return !DSDRE->hasExplicitTemplateArgs();
3040 if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
3041 return !DSME->hasExplicitTemplateArgs();
3042 // Any additional cases recognized here should also be handled by
3043 // diagnoseExprIntendedAsTemplateName.
3044 return false;
3045 }
3046
3047 void warnOnReservedIdentifier(const NamedDecl *D);
3048
3050
3052 MultiTemplateParamsArg TemplateParameterLists);
3054 SourceLocation Loc,
3055 unsigned FailedFoldDiagID);
3060 TemplateIdAnnotation *TemplateId,
3061 bool IsMemberSpecialization);
3062
3063 bool checkConstantPointerAuthKey(Expr *keyExpr, unsigned &key);
3064
3065 void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
3067 const LookupResult &R);
3070 const LookupResult &R);
3071 void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
3072 const LookupResult &R);
3073 void CheckShadow(Scope *S, VarDecl *D);
3074
3075 /// Warn if 'E', which is an expression that is about to be modified, refers
3076 /// to a shadowing declaration.
3078
3080
3081 void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
3082 void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
3083 TypedefNameDecl *NewTD);
3086 TypeSourceInfo *TInfo,
3089 LookupResult &Previous, bool &Redeclaration);
3091 Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo,
3092 LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists,
3093 bool &AddToScope, ArrayRef<BindingDecl *> Bindings = std::nullopt);
3094
3095 // Returns true if the variable declaration is a redeclaration
3099
3101 TypeSourceInfo *TInfo,
3103 MultiTemplateParamsArg TemplateParamLists,
3104 bool &AddToScope);
3106
3107 // Returns true if the function declaration is a redeclaration
3110 bool IsMemberSpecialization, bool DeclIsDefn);
3113 QualType NewT, QualType OldT);
3114 void CheckMain(FunctionDecl *FD, const DeclSpec &D);
3118 void CheckHLSLSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param,
3119 const HLSLAnnotationAttr *AnnotationAttr);
3121 const Attr *A, HLSLShaderAttr::ShaderType Stage,
3122 std::initializer_list<HLSLShaderAttr::ShaderType> AllowedStages);
3124 bool IsDefinition);
3127 SourceLocation ExplicitThisLoc = {});
3128 ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc,
3129 QualType T);
3130 QualType AdjustParameterTypeForObjCAutoRefCount(QualType T,
3131 SourceLocation NameLoc,
3132 TypeSourceInfo *TSInfo);
3133 ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc,
3134 SourceLocation NameLoc, IdentifierInfo *Name,
3135 QualType T, TypeSourceInfo *TSInfo,
3136 StorageClass SC);
3137
3138 // Contexts where using non-trivial C union types can be disallowed. This is
3139 // passed to err_non_trivial_c_union_in_invalid_context.
3141 // Function parameter.
3143 // Function return.
3145 // Default-initialized object.
3147 // Variable with automatic storage duration.
3149 // Initializer expression that might copy from another object.
3151 // Assignment.
3153 // Compound literal.
3155 // Block capture.
3157 // lvalue-to-rvalue conversion of volatile type.
3159 };
3160
3161 /// Emit diagnostics if the initializer or any of its explicit or
3162 /// implicitly-generated subexpressions require copying or
3163 /// default-initializing a type that is or contains a C union type that is
3164 /// non-trivial to copy or default-initialize.
3166
3167 // These flags are passed to checkNonTrivialCUnion.
3172 };
3173
3174 /// Emit diagnostics if a non-trivial C union type or a struct that contains
3175 /// a non-trivial C union is used in an invalid context.
3177 NonTrivialCUnionContext UseContext,
3178 unsigned NonTrivialKind);
3179
3180 void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
3181 void ActOnUninitializedDecl(Decl *dcl);
3182 void ActOnInitializerError(Decl *Dcl);
3183
3184 void ActOnCXXForRangeDecl(Decl *D);
3186 IdentifierInfo *Ident,
3187 ParsedAttributes &Attrs);
3188
3191 void FinalizeDeclaration(Decl *D);
3193 ArrayRef<Decl *> Group);
3195
3196 /// Should be called on all declarations that might have attached
3197 /// documentation comments.
3198 void ActOnDocumentableDecl(Decl *D);
3200
3201 enum class FnBodyKind {
3202 /// C++ [dcl.fct.def.general]p1
3203 /// function-body:
3204 /// ctor-initializer[opt] compound-statement
3205 /// function-try-block
3206 Other,
3207 /// = default ;
3208 Default,
3209 /// = delete ;
3210 Delete
3211 };
3212
3214 SourceLocation LocAfterDecls);
3216 FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
3217 SkipBodyInfo *SkipBody = nullptr);
3219 MultiTemplateParamsArg TemplateParamLists,
3220 SkipBodyInfo *SkipBody = nullptr,
3221 FnBodyKind BodyKind = FnBodyKind::Other);
3223 SkipBodyInfo *SkipBody = nullptr,
3224 FnBodyKind BodyKind = FnBodyKind::Other);
3225
3226 /// Determine whether we can delay parsing the body of a function or
3227 /// function template until it is used, assuming we don't care about emitting
3228 /// code for that function.
3229 ///
3230 /// This will be \c false if we may need the body of the function in the
3231 /// middle of parsing an expression (where it's impractical to switch to
3232 /// parsing a different function), for instance, if it's constexpr in C++11
3233 /// or has an 'auto' return type in C++14. These cases are essentially bugs.
3234 bool canDelayFunctionBody(const Declarator &D);
3235
3236 /// Determine whether we can skip parsing the body of a function
3237 /// definition, assuming we don't care about analyzing its body or emitting
3238 /// code for that function.
3239 ///
3240 /// This will be \c false only if we may need the body of the function in
3241 /// order to parse the rest of the program (for instance, if it is
3242 /// \c constexpr in C++11 or has an 'auto' return type in C++14).
3243 bool canSkipFunctionBody(Decl *D);
3244
3247 Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
3250
3251 /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
3252 /// attribute for which parsing is delayed.
3254
3255 /// Diagnose any unused parameters in the given sequence of
3256 /// ParmVarDecl pointers.
3258
3259 /// Diagnose whether the size of parameters or return value of a
3260 /// function or obj-c method definition is pass-by-value and larger than a
3261 /// specified threshold.
3262 void
3264 QualType ReturnTy, NamedDecl *D);
3265
3267 SourceLocation RParenLoc);
3268
3271
3272 void ActOnPopScope(SourceLocation Loc, Scope *S);
3273
3275 const ParsedAttributesView &DeclAttrs,
3276 RecordDecl *&AnonRecord);
3278 const ParsedAttributesView &DeclAttrs,
3279 MultiTemplateParamsArg TemplateParams,
3280 bool IsExplicitInstantiation,
3281 RecordDecl *&AnonRecord);
3282
3285 const PrintingPolicy &Policy);
3286
3287 /// Called once it is known whether
3288 /// a tag declaration is an anonymous union or struct.
3290
3292
3295
3296 /// Common ways to introduce type names without a tag for use in diagnostics.
3297 /// Keep in sync with err_tag_reference_non_tag.
3308 };
3309
3310 /// Given a non-tag type declaration, returns an enum useful for indicating
3311 /// what kind of non-tag type this is.
3313
3315 bool isDefinition, SourceLocation NewTagLoc,
3316 const IdentifierInfo *Name);
3317
3319 TUK_Reference, // Reference to a tag: 'struct foo *X;'
3320 TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
3321 TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
3322 TUK_Friend // Friend declaration: 'friend struct foo;'
3324
3326 // Not parsing a type within __builtin_offsetof.
3328 // Parsing a type within __builtin_offsetof.
3330 // Parsing a type within macro "offsetof", defined in __buitin_offsetof
3331 // To improve our diagnostic message.
3333 };
3334
3335 DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
3336 SourceLocation KWLoc, CXXScopeSpec &SS,
3337 IdentifierInfo *Name, SourceLocation NameLoc,
3339 SourceLocation ModulePrivateLoc,
3340 MultiTemplateParamsArg TemplateParameterLists,
3341 bool &OwnedDecl, bool &IsDependent,
3342 SourceLocation ScopedEnumKWLoc,
3343 bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
3344 bool IsTypeSpecifier, bool IsTemplateParamOrArg,
3345 OffsetOfKind OOK, SkipBodyInfo *SkipBody = nullptr);
3346
3347 Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
3348 Declarator &D, Expr *BitfieldWidth);
3349
3350 FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
3351 Declarator &D, Expr *BitfieldWidth,
3352 InClassInitStyle InitStyle, AccessSpecifier AS);
3353
3356 SourceLocation Loc, bool Mutable,
3357 Expr *BitfieldWidth, InClassInitStyle InitStyle,
3359 NamedDecl *PrevDecl, Declarator *D = nullptr);
3360
3362
3363 void ActOnLastBitfield(SourceLocation DeclStart,
3364 SmallVectorImpl<Decl *> &AllIvarDecls);
3365 Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D,
3366 Expr *BitWidth, tok::ObjCKeywordKind visibility);
3367
3368 // This is used for both record definitions and ObjC interface declarations.
3369 void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
3370 ArrayRef<Decl *> Fields, SourceLocation LBrac,
3371 SourceLocation RBrac, const ParsedAttributesView &AttrList);
3372
3373 /// ActOnTagStartDefinition - Invoked when we have entered the
3374 /// scope of a tag's definition (e.g., for an enumeration, class,
3375 /// struct, or union).
3377
3378 /// Perform ODR-like check for C/ObjC when merging tag types from modules.
3379 /// Differently from C++, actually parse the body and reject / error out
3380 /// in case of a structural mismatch.
3381 bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody);
3382
3384
3385 /// Invoked when we enter a tag definition that we're skipping.
3387
3389
3390 /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
3391 /// C++ record definition's base-specifiers clause and are starting its
3392 /// member declarations.
3394 SourceLocation FinalLoc,
3395 bool IsFinalSpelledSealed,
3396 bool IsAbstract,
3397 SourceLocation LBraceLoc);
3398
3399 /// ActOnTagFinishDefinition - Invoked once we have finished parsing
3400 /// the definition of a tag (enumeration, class, struct, or union).
3402 SourceRange BraceRange);
3403
3405
3407
3408 /// Invoked when we must temporarily exit the objective-c container
3409 /// scope for parsing/looking-up C constructs.
3410 ///
3411 /// Must be followed by a call to \see ActOnObjCReenterContainerContext
3414
3415 /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
3416 /// error parsing the definition of a tag.
3418
3420 EnumConstantDecl *LastEnumConst,
3422 Expr *val);
3424 bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
3425 QualType EnumUnderlyingTy, bool IsFixed,
3426 const EnumDecl *Prev);
3427
3428 /// Determine whether the body of an anonymous enumeration should be skipped.
3429 /// \param II The name of the first enumerator.
3431 SourceLocation IILoc);
3432
3433 Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
3435 const ParsedAttributesView &Attrs,
3436 SourceLocation EqualLoc, Expr *Val);
3437 void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
3438 Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
3439 const ParsedAttributesView &Attr);
3440
3441 /// Set the current declaration context until it gets popped.
3442 void PushDeclContext(Scope *S, DeclContext *DC);
3443 void PopDeclContext();
3444
3445 /// EnterDeclaratorContext - Used when we must lookup names in the context
3446 /// of a declarator's nested name specifier.
3449
3450 /// Enter a template parameter scope, after it's been associated with a
3451 /// particular DeclContext. Causes lookup within the scope to chain through
3452 /// enclosing contexts in the correct order.
3454
3455 /// Push the parameters of D, which must be a function, into scope.
3458
3459 /// Add this decl to the scope shadowed decl chains.
3460 void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
3461
3462 /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
3463 /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
3464 /// true if 'D' belongs to the given declaration context.
3465 ///
3466 /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
3467 /// enclosing namespace set of the context, rather than contained
3468 /// directly within it.
3469 bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
3470 bool AllowInlineNamespace = false) const;
3471
3472 /// Finds the scope corresponding to the given decl context, if it
3473 /// happens to be an enclosing scope. Otherwise return NULL.
3475
3476 /// Subroutines of ActOnDeclarator().
3478 TypeSourceInfo *TInfo);
3480
3481 /// Describes the kind of merge to perform for availability
3482 /// attributes (including "deprecated", "unavailable", and "availability").
3484 /// Don't merge availability attributes at all.
3486 /// Merge availability attributes for a redeclaration, which requires
3487 /// an exact match.
3489 /// Merge availability attributes for an override, which requires
3490 /// an exact match or a weakening of constraints.
3492 /// Merge availability attributes for an implementation of
3493 /// a protocol requirement.
3495 /// Merge availability attributes for an implementation of
3496 /// an optional protocol requirement.
3499
3500 void mergeDeclAttributes(NamedDecl *New, Decl *Old,
3503 LookupResult &OldDecls);
3504 bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
3505 bool MergeTypeWithOld, bool NewDeclIsDefn);
3507 Scope *S, bool MergeTypeWithOld);
3510 void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
3511 bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
3512 void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
3513
3515 bool ConsiderLinkage, bool AllowInlineNamespace);
3516
3520 bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const;
3521
3523
3524 /// If it's a file scoped decl that must warn if not used, keep track
3525 /// of it.
3527
3528 typedef llvm::function_ref<void(SourceLocation Loc, PartialDiagnostic PD)>
3530
3533 DiagReceiverTy DiagReceiver);
3534 void DiagnoseUnusedDecl(const NamedDecl *ND);
3535 void DiagnoseUnusedDecl(const NamedDecl *ND, DiagReceiverTy DiagReceiver);
3536
3537 /// If VD is set but not otherwise used, diagnose, for a parameter or a
3538 /// variable.
3539 void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver);
3540
3542 SourceLocation IdLoc,
3543 bool TypoCorrection = false);
3544
3546
3548 SourceLocation Loc);
3550 bool ForRedeclaration, SourceLocation Loc);
3551
3552 /// Get the outermost AttributedType node that sets a calling convention.
3553 /// Valid types should not have multiple attributes with different CCs.
3555
3558
3559 /// ParsingInitForAutoVars - a set of declarations with auto types for which
3560 /// we are currently parsing the initializer.
3562
3563 /// Look for a locally scoped extern "C" declaration by the given name.
3565
3567
3569
3571
3573
3574 /// Checks if the variant/multiversion functions are compatible.
3576 const FunctionDecl *OldFD, const FunctionDecl *NewFD,
3577 const PartialDiagnostic &NoProtoDiagID,
3578 const PartialDiagnosticAt &NoteCausedDiagIDAt,
3579 const PartialDiagnosticAt &NoSupportDiagIDAt,
3580 const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
3581 bool ConstexprSupported, bool CLinkageMayDiffer);
3582
3583 /// type checking declaration initializers (C99 6.7.8)
3585
3588 SourceRange Range, bool DirectInit,
3589 Expr *Init);
3590
3592 Expr *Init);
3593
3595
3596 /// The declarator \p D defines a function in the scope \p S which is nested
3597 /// in an `omp begin/end declare variant` scope. In this method we create a
3598 /// declaration for \p D and rename \p D according to the OpenMP context
3599 /// selector of the surrounding scope. Return all base functions in \p Bases.
3601 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
3603
3604 // Heuristically tells if the function is `get_return_object` member of a
3605 // coroutine promise_type by matching the function name.
3606 static bool CanBeGetReturnObject(const FunctionDecl *FD);
3607 static bool CanBeGetReturnTypeOnAllocFailure(const FunctionDecl *FD);
3608
3610 Scope *S);
3612 FunctionDecl *FD);
3614
3615 /// VerifyBitField - verifies that a bit field expression is an ICE and has
3616 /// the correct width, and that the field type is valid.
3617 /// Returns false on success.
3619 QualType FieldTy, bool IsMsStruct, Expr *BitWidth);
3620
3621 /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
3622 /// enum. If AllowMask is true, then we also allow the complement of a valid
3623 /// value, to be used as a mask.
3624 bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
3625 bool AllowMask) const;
3626
3627 /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
3628 void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc,
3629 SourceLocation WeakNameLoc);
3630
3631 /// ActOnPragmaRedefineExtname - Called on well formed
3632 /// \#pragma redefine_extname oldname newname.
3634 IdentifierInfo *AliasName,
3635 SourceLocation PragmaLoc,
3636 SourceLocation WeakNameLoc,
3637 SourceLocation AliasNameLoc);
3638
3639 /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
3640 void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName,
3641 SourceLocation PragmaLoc,
3642 SourceLocation WeakNameLoc,
3643 SourceLocation AliasNameLoc);
3644
3646
3647 /// Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
3649 Emitted,
3650 CUDADiscarded, // Discarded due to CUDA/HIP hostness
3651 OMPDiscarded, // Discarded due to OpenMP hostness
3652 TemplateDiscarded, // Discarded due to uninstantiated templates
3653 Unknown,
3654 };
3655 FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl,
3656 bool Final = false);
3657
3658 // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
3660
3661private:
3662 /// Function or variable declarations to be checked for whether the deferred
3663 /// diagnostics should be emitted.
3664 llvm::SmallSetVector<Decl *, 4> DeclsToCheckForDeferredDiags;
3665
3666 /// Map of current shadowing declarations to shadowed declarations. Warn if
3667 /// it looks like the user is trying to modify the shadowing declaration.
3668 llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
3669
3670 static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
3671
3672 ///@}
3673
3674 //
3675 //
3676 // -------------------------------------------------------------------------
3677 //
3678 //
3679
3680 /// \name Declaration Attribute Handling
3681 /// Implementations are in SemaDeclAttr.cpp
3682 ///@{
3683
3684public:
3685 /// Describes the kind of priority given to an availability attribute.
3686 ///
3687 /// The sum of priorities deteremines the final priority of the attribute.
3688 /// The final priority determines how the attribute will be merged.
3689 /// An attribute with a lower priority will always remove higher priority
3690 /// attributes for the specified platform when it is being applied. An
3691 /// attribute with a higher priority will not be applied if the declaration
3692 /// already has an availability attribute with a lower priority for the
3693 /// specified platform. The final prirority values are not expected to match
3694 /// the values in this enumeration, but instead should be treated as a plain
3695 /// integer value. This enumeration just names the priority weights that are
3696 /// used to calculate that final vaue.
3698 /// The availability attribute was specified explicitly next to the
3699 /// declaration.
3701
3702 /// The availability attribute was applied using '#pragma clang attribute'.
3704
3705 /// The availability attribute for a specific platform was inferred from
3706 /// an availability attribute for another platform.
3709
3710 /// Describes the reason a calling convention specification was ignored, used
3711 /// for diagnostics.
3713 ForThisTarget = 0,
3717 };
3718
3719 /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
3720 /// \#pragma weak during processing of other Decls.
3721 /// I couldn't figure out a clean way to generate these in-line, so
3722 /// we store them here and handle separately -- which is a hack.
3723 /// It would be best to refactor this.
3725
3726 /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
3728
3732
3733 /// ExtVectorDecls - This is a list all the extended vector types. This allows
3734 /// us to associate a raw vector type with one of the ext_vector type names.
3735 /// This is only necessary for issuing pretty diagnostics.
3737
3739 const Expr *E, StringRef &Str,
3740 SourceLocation *ArgLocation = nullptr);
3741 bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum,
3742 StringRef &Str,
3743 SourceLocation *ArgLocation = nullptr);
3744
3745 /// Determine if type T is a valid subject for a nonnull and similar
3746 /// attributes. By default, we look through references (the behavior used by
3747 /// nonnull), but if the second parameter is true, then we treat a reference
3748 /// type as valid.
3749 bool isValidPointerAttrType(QualType T, bool RefOkay = false);
3750
3751 /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
3752 /// declaration.
3753 void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
3754 Expr *OE);
3755
3756 /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
3757 /// declaration.
3758 void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
3759 Expr *ParamExpr);
3760
3761 bool CheckAttrTarget(const ParsedAttr &CurrAttr);
3762 bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
3763
3764 AvailabilityAttr *
3766 IdentifierInfo *Platform, bool Implicit,
3767 VersionTuple Introduced, VersionTuple Deprecated,
3768 VersionTuple Obsoleted, bool IsUnavailable,
3769 StringRef Message, bool IsStrict, StringRef Replacement,
3771 TypeVisibilityAttr *
3773 TypeVisibilityAttr::VisibilityType Vis);
3774 VisibilityAttr *mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
3775 VisibilityAttr::VisibilityType Vis);
3776 SectionAttr *mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
3777 StringRef Name);
3778
3779 llvm::Error isValidSectionSpecifier(StringRef Str);
3780 bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
3781 CodeSegAttr *mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
3782 StringRef Name);
3783
3784 bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
3785 bool checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D,
3786 StringRef &Str, bool &isDefault);
3788 SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal,
3789 Decl *D, bool &HasDefault, bool &HasCommas, bool &HasNotDefault,
3790 SmallVectorImpl<SmallString<64>> &StringsBuffer);
3791
3792 ErrorAttr *mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI,
3793 StringRef NewUserDiagnostic);
3794 FormatAttr *mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
3795 IdentifierInfo *Format, int FormatIdx,
3796 int FirstArg);
3797
3798 /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
3799 void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
3800 bool IsPackExpansion);
3802 bool IsPackExpansion);
3803
3804 /// AddAlignValueAttr - Adds an align_value attribute to a particular
3805 /// declaration.
3806 void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E);
3807
3808 /// AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
3809 void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI,
3810 StringRef Annot, MutableArrayRef<Expr *> Args);
3811
3813 bool BestCase,
3814 MSInheritanceModel SemanticSpelling);
3815
3817
3818 /// AddModeAttr - Adds a mode attribute to a particular declaration.
3819 void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name,
3820 bool InInstantiation = false);
3821 AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D,
3822 const AttributeCommonInfo &CI,
3823 const IdentifierInfo *Ident);
3824 MinSizeAttr *mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI);
3825 SwiftNameAttr *mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA,
3826 StringRef Name);
3827 OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D,
3828 const AttributeCommonInfo &CI);
3829 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
3830 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
3831 const InternalLinkageAttr &AL);
3832
3840
3841 /// Check validaty of calling convention attribute \p attr. If \p FD
3842 /// is not null pointer, use \p FD to determine the CUDA/HIP host/device
3843 /// target. Otherwise, it is specified by \p CFT.
3844 bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC,
3845 const FunctionDecl *FD = nullptr,
3847
3848 void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
3849 ParameterABI ABI);
3850 bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value);
3851
3852 /// Create an CUDALaunchBoundsAttr attribute.
3853 CUDALaunchBoundsAttr *CreateLaunchBoundsAttr(const AttributeCommonInfo &CI,
3854 Expr *MaxThreads,
3855 Expr *MinBlocks,
3856 Expr *MaxBlocks);
3857
3858 /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
3859 /// declaration.
3860 void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
3861 Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks);
3862
3863 enum class RetainOwnershipKind { NS, CF, OS };
3864 void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
3865 RetainOwnershipKind K, bool IsTemplateInstantiation);
3866
3868
3869 /// Do a check to make sure \p Name looks like a legal argument for the
3870 /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
3871 /// is invalid for the given declaration.
3872 ///
3873 /// \p AL is used to provide caret diagnostics in case of a malformed name.
3874 ///
3875 /// \returns true if the name is a valid swift name for \p D, false otherwise.
3876 bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc,
3877 const ParsedAttr &AL, bool IsAsync);
3878
3879 UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
3880 StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
3881
3882 BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL);
3883 HLSLNumThreadsAttr *mergeHLSLNumThreadsAttr(Decl *D,
3884 const AttributeCommonInfo &AL,
3885 int X, int Y, int Z);
3886 HLSLShaderAttr *mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL,
3887 HLSLShaderAttr::ShaderType ShaderType);
3888 HLSLParamModifierAttr *
3890 HLSLParamModifierAttr::Spelling Spelling);
3891
3892 WebAssemblyImportNameAttr *
3893 mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL);
3894 WebAssemblyImportModuleAttr *
3895 mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL);
3896
3897 /// Create an AMDGPUWavesPerEUAttr attribute.
3898 AMDGPUFlatWorkGroupSizeAttr *
3900 Expr *Max);
3901
3902 /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
3903 /// attribute to a particular declaration.
3905 Expr *Min, Expr *Max);
3906
3907 /// Create an AMDGPUWavesPerEUAttr attribute.
3908 AMDGPUWavesPerEUAttr *
3910 Expr *Max);
3911
3912 /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
3913 /// particular declaration.
3915 Expr *Min, Expr *Max);
3916
3917 /// Create an AMDGPUMaxNumWorkGroupsAttr attribute.
3918 AMDGPUMaxNumWorkGroupsAttr *
3920 Expr *YExpr, Expr *ZExpr);
3921
3922 /// addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups
3923 /// attribute to a particular declaration.
3925 Expr *XExpr, Expr *YExpr, Expr *ZExpr);
3926
3927 DLLImportAttr *mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI);
3928 DLLExportAttr *mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI);
3929 MSInheritanceAttr *mergeMSInheritanceAttr(Decl *D,
3930 const AttributeCommonInfo &CI,
3931 bool BestCase,
3932 MSInheritanceModel Model);
3933
3934 bool CheckCountedByAttr(Scope *Scope, const FieldDecl *FD);
3935
3936 EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
3937 EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
3938 const EnforceTCBLeafAttr &AL);
3939
3940 // Helper for delayed processing of attributes.
3942 const ParsedAttributesView &AttrList);
3943
3944 // Options for ProcessDeclAttributeList().
3947 : IncludeCXX11Attributes(true), IgnoreTypeAttributes(false) {}
3948
3950 ProcessDeclAttributeOptions Result = *this;
3951 Result.IncludeCXX11Attributes = Val;
3952 return Result;
3953 }
3954
3956 ProcessDeclAttributeOptions Result = *this;
3957 Result.IgnoreTypeAttributes = Val;
3958 return Result;
3959 }
3960
3961 // Should C++11 attributes be processed?
3963
3964 // Should any type attributes encountered be ignored?
3965 // If this option is false, a diagnostic will be emitted for any type
3966 // attributes of a kind that does not "slide" from the declaration to
3967 // the decl-specifier-seq.
3969 };
3970
3972 const ParsedAttributesView &AttrList,
3973 const ProcessDeclAttributeOptions &Options =
3976 const ParsedAttributesView &AttrList);
3977
3979
3981 SourceLocation Loc);
3982 void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W);
3983
3984 void ProcessPragmaWeak(Scope *S, Decl *D);
3985 // Decl attributes - this routine is the top level dispatcher.
3986 void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
3987
3989
3991
3992 ///@}
3993
3994 //
3995 //
3996 // -------------------------------------------------------------------------
3997 //
3998 //
3999
4000 /// \name C++ Declarations
4001 /// Implementations are in SemaDeclCXX.cpp
4002 ///@{
4003
4004public:
4006
4007 /// Called before parsing a function declarator belonging to a function
4008 /// declaration.
4010 unsigned TemplateParameterDepth);
4011
4012 /// Called after parsing a function declarator belonging to a function
4013 /// declaration.
4015
4016 // Act on C++ namespaces
4018 SourceLocation NamespaceLoc,
4019 SourceLocation IdentLoc, IdentifierInfo *Ident,
4020 SourceLocation LBrace,
4021 const ParsedAttributesView &AttrList,
4022 UsingDirectiveDecl *&UsingDecl, bool IsNested);
4023 void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
4024
4027
4029 EnumDecl *getStdAlignValT() const;
4030
4032 const IdentifierInfo *MemberOrBase);
4033
4035 /// The '<=>' operator was used in an expression and a builtin operator
4036 /// was selected.
4038 /// A defaulted 'operator<=>' needed the comparison category. This
4039 /// typically only applies to 'std::strong_ordering', due to the implicit
4040 /// fallback return value.
4042 };
4043
4044 /// Lookup the specified comparison category types in the standard
4045 /// library, an check the VarDecls possibly returned by the operator<=>
4046 /// builtins for that type.
4047 ///
4048 /// \return The type of the comparison category type corresponding to the
4049 /// specified Kind, or a null type if an error occurs
4051 SourceLocation Loc,
4053
4054 /// Tests whether Ty is an instance of std::initializer_list and, if
4055 /// it is and Element is not NULL, assigns the element type to Element.
4056 bool isStdInitializerList(QualType Ty, QualType *Element);
4057
4058 /// Looks for the std::initializer_list template and instantiates it
4059 /// with Element, or emits an error if it's not found.
4060 ///
4061 /// \returns The instantiated template, or null on error.
4063
4064 /// Determine whether Ctor is an initializer-list constructor, as
4065 /// defined in [dcl.init.list]p2.
4066 bool isInitListConstructor(const FunctionDecl *Ctor);
4067
4068 Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc,
4069 SourceLocation NamespcLoc, CXXScopeSpec &SS,
4070 SourceLocation IdentLoc,
4071 IdentifierInfo *NamespcName,
4072 const ParsedAttributesView &AttrList);
4073
4075
4076 Decl *ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc,
4077 SourceLocation AliasLoc, IdentifierInfo *Alias,
4078 CXXScopeSpec &SS, SourceLocation IdentLoc,
4079 IdentifierInfo *Ident);
4080
4081 void FilterUsingLookup(Scope *S, LookupResult &lookup);
4082 void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
4084 const LookupResult &PreviousDecls,
4085 UsingShadowDecl *&PrevShadow);
4088 UsingShadowDecl *PrevDecl);
4089
4091 bool HasTypenameKeyword,
4092 const CXXScopeSpec &SS,
4093 SourceLocation NameLoc,
4094 const LookupResult &Previous);
4095 bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename,
4096 const CXXScopeSpec &SS,
4097 const DeclarationNameInfo &NameInfo,
4098 SourceLocation NameLoc,
4099 const LookupResult *R = nullptr,
4100 const UsingDecl *UD = nullptr);
4101
4103 SourceLocation UsingLoc,
4104 bool HasTypenameKeyword,
4105 SourceLocation TypenameLoc, CXXScopeSpec &SS,
4106 DeclarationNameInfo NameInfo,
4107 SourceLocation EllipsisLoc,
4108 const ParsedAttributesView &AttrList,
4109 bool IsInstantiation, bool IsUsingIfExists);
4111 SourceLocation UsingLoc,
4112 SourceLocation EnumLoc,
4113 SourceLocation NameLoc,
4115 NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
4116 ArrayRef<NamedDecl *> Expansions);
4117
4119
4120 /// Given a derived-class using shadow declaration for a constructor and the
4121 /// correspnding base class constructor, find or create the implicit
4122 /// synthesized derived class constructor to use for this initialization.
4125 ConstructorUsingShadowDecl *DerivedShadow);
4126
4128 SourceLocation UsingLoc,
4129 SourceLocation TypenameLoc, CXXScopeSpec &SS,
4130 UnqualifiedId &Name, SourceLocation EllipsisLoc,
4131 const ParsedAttributesView &AttrList);
4133 SourceLocation UsingLoc,
4134 SourceLocation EnumLoc,
4135 SourceLocation IdentLoc, IdentifierInfo &II,
4136 CXXScopeSpec *SS = nullptr);
4138 MultiTemplateParamsArg TemplateParams,
4139 SourceLocation UsingLoc, UnqualifiedId &Name,
4140 const ParsedAttributesView &AttrList,
4141 TypeResult Type, Decl *DeclFromDeclSpec);
4142
4143 /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4144 /// including handling of its default argument expressions.
4145 ///
4146 /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4148 SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl,
4149 CXXConstructorDecl *Constructor, MultiExprArg Exprs,
4150 bool HadMultipleCandidates, bool IsListInitialization,
4151 bool IsStdInitListInitialization, bool RequiresZeroInit,
4152 CXXConstructionKind ConstructKind, SourceRange ParenRange);
4153
4154 /// Build a CXXConstructExpr whose constructor has already been resolved if
4155 /// it denotes an inherited constructor.
4157 SourceLocation ConstructLoc, QualType DeclInitType,
4158 CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg Exprs,
4159 bool HadMultipleCandidates, bool IsListInitialization,
4160 bool IsStdInitListInitialization, bool RequiresZeroInit,
4161 CXXConstructionKind ConstructKind, SourceRange ParenRange);
4162
4163 // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4164 // the constructor can be elidable?
4166 SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl,
4167 CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg Exprs,
4168 bool HadMultipleCandidates, bool IsListInitialization,
4169 bool IsStdInitListInitialization, bool RequiresZeroInit,
4170 CXXConstructionKind ConstructKind, SourceRange ParenRange);
4171
4173 SourceLocation InitLoc);
4174
4175 /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4176 /// constructed variable.
4177 void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
4178
4179 /// Helper class that collects exception specifications for
4180 /// implicitly-declared special member functions.
4182 // Pointer to allow copying
4183 Sema *Self;
4184 // We order exception specifications thus:
4185 // noexcept is the most restrictive, but is only used in C++11.
4186 // throw() comes next.
4187 // Then a throw(collected exceptions)
4188 // Finally no specification, which is expressed as noexcept(false).
4189 // throw(...) is used instead if any called function uses it.
4190 ExceptionSpecificationType ComputedEST;
4191 llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
4192 SmallVector<QualType, 4> Exceptions;
4193
4194 void ClearExceptions() {
4195 ExceptionsSeen.clear();
4196 Exceptions.clear();
4197 }
4198
4199 public:
4201 : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4202 if (!Self.getLangOpts().CPlusPlus11)
4203 ComputedEST = EST_DynamicNone;
4204 }
4205
4206 /// Get the computed exception specification type.
4208 assert(!isComputedNoexcept(ComputedEST) &&
4209 "noexcept(expr) should not be a possible result");
4210 return ComputedEST;
4211 }
4212
4213 /// The number of exceptions in the exception specification.
4214 unsigned size() const { return Exceptions.size(); }
4215
4216 /// The set of exceptions in the exception specification.
4217 const QualType *data() const { return Exceptions.data(); }
4218
4219 /// Integrate another called method into the collected data.
4220 void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
4221
4222 /// Integrate an invoked expression into the collected data.
4223 void CalledExpr(Expr *E) { CalledStmt(E); }
4224
4225 /// Integrate an invoked statement into the collected data.
4226 void CalledStmt(Stmt *S);
4227
4228 /// Overwrite an EPI's exception specification with this
4229 /// computed exception specification.
4232 ESI.Type = getExceptionSpecType();
4233 if (ESI.Type == EST_Dynamic) {
4234 ESI.Exceptions = Exceptions;
4235 } else if (ESI.Type == EST_None) {
4236 /// C++11 [except.spec]p14:
4237 /// The exception-specification is noexcept(false) if the set of
4238 /// potential exceptions of the special member function contains "any"
4239 ESI.Type = EST_NoexceptFalse;
4240 ESI.NoexceptExpr =
4241 Self->ActOnCXXBoolLiteral(SourceLocation(), tok::kw_false).get();
4242 }
4243 return ESI;
4244 }
4245 };
4246
4247 /// Evaluate the implicit exception specification for a defaulted
4248 /// special member function.
4250
4251 /// Check the given exception-specification and update the
4252 /// exception specification information with the results.
4253 void checkExceptionSpecification(bool IsTopLevel,
4255 ArrayRef<ParsedType> DynamicExceptions,
4256 ArrayRef<SourceRange> DynamicExceptionRanges,
4257 Expr *NoexceptExpr,
4258 SmallVectorImpl<QualType> &Exceptions,
4260
4261 /// Add an exception-specification to the given member function
4262 /// (or member function template). The exception-specification was parsed
4263 /// after the method itself was declared.
4265 Decl *Method, ExceptionSpecificationType EST,
4266 SourceRange SpecificationRange, ArrayRef<ParsedType> DynamicExceptions,
4267 ArrayRef<SourceRange> DynamicExceptionRanges, Expr *NoexceptExpr);
4268
4269 /// Kinds of C++ special members.
4279
4280 class InheritedConstructorInfo;
4281
4282 /// Determine if a special member function should have a deleted
4283 /// definition when it is defaulted.
4285 InheritedConstructorInfo *ICI = nullptr,
4286 bool Diagnose = false);
4287
4288 /// Produce notes explaining why a defaulted function was defined as deleted.
4290
4291 /// Declare the implicit default constructor for the given class.
4292 ///
4293 /// \param ClassDecl The class declaration into which the implicit
4294 /// default constructor will be added.
4295 ///
4296 /// \returns The implicitly-declared default constructor.
4299
4300 /// DefineImplicitDefaultConstructor - Checks for feasibility of
4301 /// defining this constructor as the default constructor.
4303 CXXConstructorDecl *Constructor);
4304
4305 /// Declare the implicit destructor for the given class.
4306 ///
4307 /// \param ClassDecl The class declaration into which the implicit
4308 /// destructor will be added.
4309 ///
4310 /// \returns The implicitly-declared destructor.
4312
4313 /// DefineImplicitDestructor - Checks for feasibility of
4314 /// defining this destructor as the default destructor.
4315 void DefineImplicitDestructor(SourceLocation CurrentLocation,
4316 CXXDestructorDecl *Destructor);
4317
4318 /// Build an exception spec for destructors that don't have one.
4319 ///
4320 /// C++11 says that user-defined destructors with no exception spec get one
4321 /// that looks as if the destructor was implicitly declared.
4323
4324 /// Define the specified inheriting constructor.
4326 CXXConstructorDecl *Constructor);
4327
4328 /// Declare the implicit copy constructor for the given class.
4329 ///
4330 /// \param ClassDecl The class declaration into which the implicit
4331 /// copy constructor will be added.
4332 ///
4333 /// \returns The implicitly-declared copy constructor.
4335
4336 /// DefineImplicitCopyConstructor - Checks for feasibility of
4337 /// defining this constructor as the copy constructor.
4338 void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
4339 CXXConstructorDecl *Constructor);
4340
4341 /// Declare the implicit move constructor for the given class.
4342 ///
4343 /// \param ClassDecl The Class declaration into which the implicit
4344 /// move constructor will be added.
4345 ///
4346 /// \returns The implicitly-declared move constructor, or NULL if it wasn't
4347 /// declared.
4349
4350 /// DefineImplicitMoveConstructor - Checks for feasibility of
4351 /// defining this constructor as the move constructor.
4352 void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
4353 CXXConstructorDecl *Constructor);
4354
4355 /// Declare the implicit copy assignment operator for the given class.
4356 ///
4357 /// \param ClassDecl The class declaration into which the implicit
4358 /// copy assignment operator will be added.
4359 ///
4360 /// \returns The implicitly-declared copy assignment operator.
4362
4363 /// Defines an implicitly-declared copy assignment operator.
4364 void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
4365 CXXMethodDecl *MethodDecl);
4366
4367 /// Declare the implicit move assignment operator for the given class.
4368 ///
4369 /// \param ClassDecl The Class declaration into which the implicit
4370 /// move assignment operator will be added.
4371 ///
4372 /// \returns The implicitly-declared move assignment operator, or NULL if it
4373 /// wasn't declared.
4375
4376 /// Defines an implicitly-declared move assignment operator.
4377 void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
4378 CXXMethodDecl *MethodDecl);
4379
4380 /// Check a completed declaration of an implicit special member.
4382
4383 /// Determine whether the given function is an implicitly-deleted
4384 /// special member function.
4386
4387 /// Check whether 'this' shows up in the type of a static member
4388 /// function after the (naturally empty) cv-qualifier-seq would be.
4389 ///
4390 /// \returns true if an error occurred.
4392
4393 /// Whether this' shows up in the exception specification of a static
4394 /// member function.
4396
4397 /// Check whether 'this' shows up in the attributes of the given
4398 /// static member function.
4399 ///
4400 /// \returns true if an error occurred.
4402
4404 FunctionDecl *FD, const sema::FunctionScopeInfo *FSI);
4405
4407
4409 QualType DeclInitType, MultiExprArg ArgsPtr,
4410 SourceLocation Loc,
4411 SmallVectorImpl<Expr *> &ConvertedArgs,
4412 bool AllowExplicit = false,
4413 bool IsListInitialization = false);
4414
4415 /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
4416 /// initializer for the declaration 'Dcl'.
4417 /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
4418 /// static data member of class X, names should be looked up in the scope of
4419 /// class X.
4421
4422 /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
4423 /// initializer for the declaration 'Dcl'.
4424 void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
4425
4426 /// Define the "body" of the conversion from a lambda object to a
4427 /// function pointer.
4428 ///
4429 /// This routine doesn't actually define a sensible body; rather, it fills
4430 /// in the initialization expression needed to copy the lambda object into
4431 /// the block, and IR generation actually generates the real body of the
4432 /// block pointer conversion.
4433 void
4435 CXXConversionDecl *Conv);
4436
4437 /// Define the "body" of the conversion from a lambda object to a
4438 /// block pointer.
4439 ///
4440 /// This routine doesn't actually define a sensible body; rather, it fills
4441 /// in the initialization expression needed to copy the lambda object into
4442 /// the block, and IR generation actually generates the real body of the
4443 /// block pointer conversion.
4445 CXXConversionDecl *Conv);
4446
4448 Expr *LangStr, SourceLocation LBraceLoc);
4450 SourceLocation RBraceLoc);
4451
4452 //===--------------------------------------------------------------------===//
4453 // C++ Classes
4454 //
4456 bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
4457 const CXXScopeSpec *SS = nullptr);
4459
4461 SourceLocation ColonLoc,
4462 const ParsedAttributesView &Attrs);
4463
4464 NamedDecl *
4466 MultiTemplateParamsArg TemplateParameterLists,
4467 Expr *BitfieldWidth, const VirtSpecifiers &VS,
4468 InClassInitStyle InitStyle);
4469
4472 SourceLocation EqualLoc,
4473 Expr *Init);
4474
4476 ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS,
4477 IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy,
4478 const DeclSpec &DS, SourceLocation IdLoc,
4479 SourceLocation LParenLoc, ArrayRef<Expr *> Args,
4480 SourceLocation RParenLoc, SourceLocation EllipsisLoc);
4481
4482 MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S,
4483 CXXScopeSpec &SS,
4484 IdentifierInfo *MemberOrBase,
4485 ParsedType TemplateTypeTy,
4486 const DeclSpec &DS, SourceLocation IdLoc,
4487 Expr *InitList, SourceLocation EllipsisLoc);
4488
4489 MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S,
4490 CXXScopeSpec &SS,
4491 IdentifierInfo *MemberOrBase,
4492 ParsedType TemplateTypeTy,
4493 const DeclSpec &DS, SourceLocation IdLoc,
4494 Expr *Init, SourceLocation EllipsisLoc);
4495
4497 SourceLocation IdLoc);
4498
4500 TypeSourceInfo *BaseTInfo, Expr *Init,
4501 CXXRecordDecl *ClassDecl,
4502 SourceLocation EllipsisLoc);
4503
4505 CXXRecordDecl *ClassDecl);
4506
4509
4511 CXXConstructorDecl *Constructor, bool AnyErrors,
4512 ArrayRef<CXXCtorInitializer *> Initializers = std::nullopt);
4513
4514 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
4515
4516 /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
4517 /// mark all the non-trivial destructors of its members and bases as
4518 /// referenced.
4521
4522 /// Mark destructors of virtual bases of this class referenced. In the Itanium
4523 /// C++ ABI, this is done when emitting a destructor for any non-abstract
4524 /// class. In the Microsoft C++ ABI, this is done any time a class's
4525 /// destructor is referenced.
4527 SourceLocation Location, CXXRecordDecl *ClassDecl,
4528 llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
4529
4530 /// Do semantic checks to allow the complete destructor variant to be emitted
4531 /// when the destructor is defined in another translation unit. In the Itanium
4532 /// C++ ABI, destructor variants are emitted together. In the MS C++ ABI, they
4533 /// can be emitted in separate TUs. To emit the complete variant, run a subset
4534 /// of the checks performed when emitting a regular destructor.
4536 CXXDestructorDecl *Dtor);
4537
4538 /// The list of classes whose vtables have been used within
4539 /// this translation unit, and the source locations at which the
4540 /// first use occurred.
4541 typedef std::pair<CXXRecordDecl *, SourceLocation> VTableUse;
4542
4543 /// The list of vtables that are required but have not yet been
4544 /// materialized.
4546
4547 /// The set of classes whose vtables have been used within
4548 /// this translation unit, and a bit that will be true if the vtable is
4549 /// required to be emitted (otherwise, it should be emitted only if needed
4550 /// by code generation).
4551 llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
4552
4553 /// Load any externally-stored vtable uses.
4555
4556 /// Note that the vtable for the given class was used at the
4557 /// given location.
4559 bool DefinitionRequired = false);
4560
4561 /// Mark the exception specifications of all virtual member functions
4562 /// in the given class as needed.
4564 const CXXRecordDecl *RD);
4565
4566 /// MarkVirtualMembersReferenced - Will mark all members of the given
4567 /// CXXRecordDecl referenced.
4569 bool ConstexprOnly = false);
4570
4571 /// Define all of the vtables that have been used in this
4572 /// translation unit and reference any virtual members used by those
4573 /// vtables.
4574 ///
4575 /// \returns true if any work was done, false otherwise.
4576 bool DefineUsedVTables();
4577
4579
4580 void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc,
4582 bool AnyErrors);
4583
4584 /// Check class-level dllimport/dllexport attribute. The caller must
4585 /// ensure that referenceDLLExportedClassMethods is called some point later
4586 /// when all outer classes of Class are complete.
4589
4591
4593 CXXRecordDecl *Class, Attr *ClassAttr,
4594 ClassTemplateSpecializationDecl *BaseTemplateSpec,
4595 SourceLocation BaseLoc);
4596
4598
4599 /// Check that the C++ class annoated with "trivial_abi" satisfies all the
4600 /// conditions that are needed for the attribute to have an effect.
4602
4604 Decl *TagDecl, SourceLocation LBrac,
4605 SourceLocation RBrac,
4606 const ParsedAttributesView &AttrList);
4609
4611 unsigned ActOnReenterTemplateScope(Decl *Template,
4612 llvm::function_ref<Scope *()> EnterScope);
4615 void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
4619
4620 bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result,
4621 ASTContext &Ctx,
4622 bool ErrorOnInvalidMessage);
4624 Expr *AssertExpr, Expr *AssertMessageExpr,
4625 SourceLocation RParenLoc);
4627 Expr *AssertExpr, Expr *AssertMessageExpr,
4628 SourceLocation RParenLoc, bool Failed);
4629 void DiagnoseStaticAssertDetails(const Expr *E);
4630
4631 Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
4632 MultiTemplateParamsArg TemplateParams);
4634 MultiTemplateParamsArg TemplateParams);
4635
4637 StorageClass &SC);
4638 void CheckConstructor(CXXConstructorDecl *Constructor);
4640 StorageClass &SC);
4641 bool CheckDestructor(CXXDestructorDecl *Destructor);
4645 StorageClass &SC);
4646
4648
4650 CXXSpecialMember CSM,
4651 SourceLocation DefaultLoc);
4653
4654 /// Kinds of defaulted comparison operator functions.
4655 enum class DefaultedComparisonKind : unsigned char {
4656 /// This is not a defaultable comparison operator.
4657 None,
4658 /// This is an operator== that should be implemented as a series of
4659 /// subobject comparisons.
4660 Equal,
4661 /// This is an operator<=> that should be implemented as a series of
4662 /// subobject comparisons.
4663 ThreeWay,
4664 /// This is an operator!= that should be implemented as a rewrite in terms
4665 /// of a == comparison.
4666 NotEqual,
4667 /// This is an <, <=, >, or >= that should be implemented as a rewrite in
4668 /// terms of a <=> comparison.
4669 Relational,
4670 };
4671
4675 FunctionDecl *Spaceship);
4678
4680 QualType R, bool IsLambda,
4681 DeclContext *DC = nullptr);
4683 DeclarationName Name, QualType R);
4685
4686 //===--------------------------------------------------------------------===//
4687 // C++ Derived Classes
4688 //
4689
4690 /// ActOnBaseSpecifier - Parsed a base specifier
4692 SourceRange SpecifierRange, bool Virtual,
4693 AccessSpecifier Access,
4694 TypeSourceInfo *TInfo,
4695 SourceLocation EllipsisLoc);
4696
4697 BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
4698 const ParsedAttributesView &Attrs, bool Virtual,
4699 AccessSpecifier Access, ParsedType basetype,
4700 SourceLocation BaseLoc,
4701 SourceLocation EllipsisLoc);
4702
4705 void ActOnBaseSpecifiers(Decl *ClassDecl,
4707
4710 CXXBasePaths &Paths);
4711
4712 // FIXME: I don't like this name.
4713 void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
4714
4716 SourceLocation Loc, SourceRange Range,
4717 CXXCastPath *BasePath = nullptr,
4718 bool IgnoreAccess = false);
4720 unsigned InaccessibleBaseID,
4721 unsigned AmbiguousBaseConvID,
4722 SourceLocation Loc, SourceRange Range,
4723 DeclarationName Name, CXXCastPath *BasePath,
4724 bool IgnoreAccess = false);
4725
4726 std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
4727
4729 const CXXMethodDecl *Old);
4730
4731 /// CheckOverridingFunctionReturnType - Checks whether the return types are
4732 /// covariant, according to C++ [class.virtual]p5.
4734 const CXXMethodDecl *Old);
4735
4736 // Check that the overriding method has no explicit object parameter.
4738 const CXXMethodDecl *Old);
4739
4740 bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
4741
4742 /// CheckOverrideControl - Check C++11 override control semantics.
4744
4745 /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
4746 /// not used in the declaration of an overriding method.
4748
4749 /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
4750 /// overrides a virtual member function marked 'final', according to
4751 /// C++11 [class.virtual]p4.
4753 const CXXMethodDecl *Old);
4754
4765
4766 struct TypeDiagnoser;
4767
4770 TypeDiagnoser &Diagnoser);
4771 template <typename... Ts>
4772 bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
4773 const Ts &...Args) {
4774 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
4775 return RequireNonAbstractType(Loc, T, Diagnoser);
4776 }
4777
4778 void DiagnoseAbstractType(const CXXRecordDecl *RD);
4779
4780 //===--------------------------------------------------------------------===//
4781 // C++ Overloaded Operators [C++ 13.5]
4782 //
4783
4785
4787
4788 /// ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression
4789 /// found in an explicit(bool) specifier.
4791
4792 /// tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
4793 /// Returns true if the explicit specifier is now resolved.
4795
4797
4798 // Emitting members of dllexported classes is delayed until the class
4799 // (including field initializers) is fully parsed.
4802
4805
4806 /// Helpers for dealing with blocks and functions.
4809
4812 }
4813
4815 SourceLocation StartLoc,
4817
4819
4821
4823 unsigned TagSpec, SourceLocation TagLoc,
4824 CXXScopeSpec &SS, IdentifierInfo *Name,
4825 SourceLocation NameLoc,
4827 MultiTemplateParamsArg TempParamLists);
4828
4830 SourceLocation DeclStart, Declarator &D,
4831 Expr *BitfieldWidth,
4832 InClassInitStyle InitStyle,
4833 AccessSpecifier AS,
4834 const ParsedAttr &MSPropertyAttr);
4835
4837
4839 /// The triviality of a method unaffected by "trivial_abi".
4841
4842 /// The triviality of a method affected by "trivial_abi".
4845
4848 bool Diagnose = false);
4849
4850 /// For a defaulted function, the kind of defaulted function that it is.
4852 unsigned SpecialMember : 8;
4853 unsigned Comparison : 8;
4854
4855 public:
4857 : SpecialMember(CXXInvalid),
4858 Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) {}
4860 : SpecialMember(CSM),
4861 Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) {}
4863 : SpecialMember(CXXInvalid), Comparison(llvm::to_underlying(Comp)) {}
4864
4865 bool isSpecialMember() const { return SpecialMember != CXXInvalid; }
4866 bool isComparison() const {
4867 return static_cast<DefaultedComparisonKind>(Comparison) !=
4868 DefaultedComparisonKind::None;
4869 }
4870
4871 explicit operator bool() const {
4872 return isSpecialMember() || isComparison();
4873 }
4874
4876 return static_cast<CXXSpecialMember>(SpecialMember);
4877 }
4879 return static_cast<DefaultedComparisonKind>(Comparison);
4880 }
4881
4882 /// Get the index of this function kind for use in diagnostics.
4883 unsigned getDiagnosticIndex() const {
4884 static_assert(CXXInvalid > CXXDestructor,
4885 "invalid should have highest index");
4886 static_assert((unsigned)DefaultedComparisonKind::None == 0,
4887 "none should be equal to zero");
4888 return SpecialMember + Comparison;
4889 }
4890 };
4891
4892 DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD);
4893
4894 /// Handle a C++11 empty-declaration and attribute-declaration.
4896 SourceLocation SemiLoc);
4897
4899 /// Diagnose issues that are non-constant or that are extensions.
4900 Diagnose,
4901 /// Identify whether this function satisfies the formal rules for constexpr
4902 /// functions in the current lanugage mode (with no extensions).
4904 };
4905
4907 CheckConstexprKind Kind);
4908
4910 void
4912 SmallVectorImpl<CXXMethodDecl *> &OverloadedMethods);
4913 void
4915 SmallVectorImpl<CXXMethodDecl *> &OverloadedMethods);
4916 void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc,
4917 Expr *defarg);
4919 SourceLocation ArgLoc);
4921 Expr *DefaultArg);
4923 SourceLocation EqualLoc);
4924 void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
4925 SourceLocation EqualLoc);
4926
4927 void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
4928 void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
4929 void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
4930
4931 void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind);
4935
4936 NamedDecl *
4938 MultiTemplateParamsArg TemplateParamLists);
4941 RecordDecl *ClassDecl,
4942 const IdentifierInfo *Name);
4943
4945
4946 /// Stack containing information needed when in C++2a an 'auto' is encountered
4947 /// in a function declaration parameter type specifier in order to invent a
4948 /// corresponding template parameter in the enclosing abbreviated function
4949 /// template. This information is also present in LambdaScopeInfo, stored in
4950 /// the FunctionScopes stack.
4952
4953 /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
4954 std::unique_ptr<CXXFieldCollector> FieldCollector;
4955
4957 /// Set containing all declared private fields that are not used.
4959
4961
4962 /// PureVirtualClassDiagSet - a set of class declarations which we have
4963 /// emitted a list of pure virtual functions. Used to prevent emitting the
4964 /// same list more than once.
4965 std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
4966
4970
4971 /// All the delegating constructors seen so far in the file, used for
4972 /// cycle detection at the end of the TU.
4974
4975 /// The C++ "std" namespace, where the standard library resides.
4977
4978 /// The C++ "std::initializer_list" template, which is defined in
4979 /// <initializer_list>.
4981
4982 // Contains the locations of the beginning of unparsed default
4983 // argument locations.
4984 llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
4985
4986 /// UndefinedInternals - all the used, undefined objects which require a
4987 /// definition in this translation unit.
4988 llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
4989
4990 typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
4992
4993 /// The C++ special members which we are currently in the process of
4994 /// declaring. If this process recursively triggers the declaration of the
4995 /// same special member, we should act as if it is not yet declared.
4997
4999
5000 void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
5001
5004 ParsingClassDepth++;
5006 }
5008 ParsingClassDepth--;
5010 }
5011
5012private:
5013 void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
5014 QualType ResultTy,
5015 ArrayRef<QualType> Args);
5016
5017 // A cache representing if we've fully checked the various comparison category
5018 // types stored in ASTContext. The bit-index corresponds to the integer value
5019 // of a ComparisonCategoryType enumerator.
5020 llvm::SmallBitVector FullyCheckedComparisonCategories;
5021
5022 ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
5023 CXXScopeSpec &SS,
5024 ParsedType TemplateTypeTy,
5025 IdentifierInfo *MemberOrBase);
5026
5027 /// Check if there is a field shadowing.
5028 void CheckShadowInheritedFields(const SourceLocation &Loc,
5029 DeclarationName FieldName,
5030 const CXXRecordDecl *RD,
5031 bool DeclIsField = true);
5032
5033 ///@}
5034
5035 //
5036 //
5037 // -------------------------------------------------------------------------
5038 //
5039 //
5040
5041 /// \name C++ Exception Specifications
5042 /// Implementations are in SemaExceptionSpec.cpp
5043 ///@{
5044
5045public:
5046 /// All the overriding functions seen during a class definition
5047 /// that had their exception spec checks delayed, plus the overridden
5048 /// function.
5051
5052 /// All the function redeclarations seen during a class definition that had
5053 /// their exception spec checks delayed, plus the prior declaration they
5054 /// should be checked against. Except during error recovery, the new decl
5055 /// should always be a friend declaration, as that's the only valid way to
5056 /// redeclare a special member before its class is complete.
5059
5060 /// Determine if we're in a case where we need to (incorrectly) eagerly
5061 /// parse an exception specification to work around a libstdc++ bug.
5063
5064 /// Check the given noexcept-specifier, convert its expression, and compute
5065 /// the appropriate ExceptionSpecificationType.
5066 ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr,
5068
5069 CanThrowResult canThrow(const Stmt *E);
5070 /// Determine whether the callee of a particular function call can throw.
5071 /// E, D and Loc are all optional.
5072 static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
5075 const FunctionProtoType *FPT);
5082 SourceLocation OldLoc,
5083 const FunctionProtoType *New,
5084 SourceLocation NewLoc);
5086 const PartialDiagnostic &NoteID,
5087 const FunctionProtoType *Old,
5088 SourceLocation OldLoc,
5089 const FunctionProtoType *New,
5090 SourceLocation NewLoc);
5091 bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
5093 const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID,
5094 const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID,
5095 const FunctionProtoType *Superset, bool SkipSupersetFirstParameter,
5096 SourceLocation SuperLoc, const FunctionProtoType *Subset,
5097 bool SkipSubsetFirstParameter, SourceLocation SubLoc);
5099 const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID,
5100 const FunctionProtoType *Target, bool SkipTargetFirstParameter,
5101 SourceLocation TargetLoc, const FunctionProtoType *Source,
5102 bool SkipSourceFirstParameter, SourceLocation SourceLoc);
5103
5104 bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
5105
5106 /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
5107 /// spec is a subset of base spec.
5109 const CXXMethodDecl *Old);
5110
5111 ///@}
5112
5113 //
5114 //
5115 // -------------------------------------------------------------------------
5116 //
5117 //
5118
5119 /// \name Expressions
5120 /// Implementations are in SemaExpr.cpp
5121 ///@{
5122
5123public:
5124 /// Describes how the expressions currently being parsed are
5125 /// evaluated at run-time, if at all.
5127 /// The current expression and its subexpressions occur within an
5128 /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
5129 /// \c sizeof, where the type of the expression may be significant but
5130 /// no code will be generated to evaluate the value of the expression at
5131 /// run time.
5133
5134 /// The current expression occurs within a braced-init-list within
5135 /// an unevaluated operand. This is mostly like a regular unevaluated
5136 /// context, except that we still instantiate constexpr functions that are
5137 /// referenced here so that we can perform narrowing checks correctly.
5139
5140 /// The current expression occurs within a discarded statement.
5141 /// This behaves largely similarly to an unevaluated operand in preventing
5142 /// definitions from being required, but not in other ways.
5144
5145 /// The current expression occurs within an unevaluated
5146 /// operand that unconditionally permits abstract references to
5147 /// fields, such as a SIZE operator in MS-style inline assembly.
5149
5150 /// The current context is "potentially evaluated" in C++11 terms,
5151 /// but the expression is evaluated at compile-time (like the values of
5152 /// cases in a switch statement).
5154
5155 /// In addition of being constant evaluated, the current expression
5156 /// occurs in an immediate function context - either a consteval function
5157 /// or a consteval if statement.
5159
5160 /// The current expression is potentially evaluated at run time,
5161 /// which means that code may be generated to evaluate the value of the
5162 /// expression at run time.
5164
5165 /// The current expression is potentially evaluated, but any
5166 /// declarations referenced inside that expression are only used if
5167 /// in fact the current expression is used.
5168 ///
5169 /// This value is used when parsing default function arguments, for which
5170 /// we would like to provide diagnostics (e.g., passing non-POD arguments
5171 /// through varargs) but do not want to mark declarations as "referenced"
5172 /// until the default argument is used.
5174 };
5175
5176 /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
5177 /// to a variable (constant) that may or may not be odr-used in this Expr, and
5178 /// we won't know until all lvalue-to-rvalue and discarded value conversions
5179 /// have been applied to all subexpressions of the enclosing full expression.
5180 /// This is cleared at the end of each full expression.
5183
5184 using ImmediateInvocationCandidate = llvm::PointerIntPair<ConstantExpr *, 1>;
5185
5186 /// Data structure used to record current or nested
5187 /// expression evaluation contexts.
5189 /// The expression evaluation context.
5191
5192 /// Whether the enclosing context needed a cleanup.
5194
5195 /// The number of active cleanup objects when we entered
5196 /// this expression evaluation context.
5198
5199 /// The number of typos encountered during this expression evaluation
5200 /// context (i.e. the number of TypoExprs created).
5201 unsigned NumTypos;
5202
5204
5205 /// The lambdas that are present within this context, if it
5206 /// is indeed an unevaluated context.
5208
5209 /// The declaration that provides context for lambda expressions
5210 /// and block literals if the normal declaration context does not
5211 /// suffice, e.g., in a default function argument.
5213
5214 /// If we are processing a decltype type, a set of call expressions
5215 /// for which we have deferred checking the completeness of the return type.
5217
5218 /// If we are processing a decltype type, a set of temporary binding
5219 /// expressions for which we have deferred checking the destructor.
5221
5223
5224 /// Expressions appearing as the LHS of a volatile assignment in this
5225 /// context. We produce a warning for these when popping the context if
5226 /// they are not discarded-value expressions nor unevaluated operands.
5228
5229 /// Set of candidates for starting an immediate invocation.
5232
5233 /// Set of DeclRefExprs referencing a consteval function when used in a
5234 /// context not already known to be immediately invoked.
5236
5237 /// P2718R0 - Lifetime extension in range-based for loops.
5238 /// MaterializeTemporaryExprs in for-range-init expressions which need to
5239 /// extend lifetime. Add MaterializeTemporaryExpr* if the value of
5240 /// InLifetimeExtendingContext is true.
5242
5243 /// \brief Describes whether we are in an expression constext which we have
5244 /// to handle differently.
5248 EK_Other
5249 } ExprContext;
5250
5251 // A context can be nested in both a discarded statement context and
5252 // an immediate function context, so they need to be tracked independently.
5256
5257 bool IsCurrentlyCheckingDefaultArgumentOrInitializer = false;
5258
5259 // We are in a constant context, but we also allow
5260 // non constant expressions, for example for array bounds (which may be
5261 // VLAs).
5262 bool InConditionallyConstantEvaluateContext = false;
5263
5264 /// Whether we are currently in a context in which all temporaries must be
5265 /// lifetime-extended, even if they're not bound to a reference (for
5266 /// example, in a for-range initializer).
5267 bool InLifetimeExtendingContext = false;
5268
5269 /// Whether we are currently in a context in which all temporaries must be
5270 /// materialized.
5271 ///
5272 /// [class.temporary]/p2:
5273 /// The materialization of a temporary object is generally delayed as long
5274 /// as possible in order to avoid creating unnecessary temporary objects.
5275 ///
5276 /// Temporary objects are materialized:
5277 /// (2.1) when binding a reference to a prvalue ([dcl.init.ref],
5278 /// [expr.type.conv], [expr.dynamic.cast], [expr.static.cast],
5279 /// [expr.const.cast], [expr.cast]),
5280 ///
5281 /// (2.2) when performing member access on a class prvalue ([expr.ref],
5282 /// [expr.mptr.oper]),
5283 ///
5284 /// (2.3) when performing an array-to-pointer conversion or subscripting
5285 /// on an array prvalue ([conv.array], [expr.sub]),
5286 ///
5287 /// (2.4) when initializing an object of type
5288 /// std​::​initializer_list<T> from a braced-init-list
5289 /// ([dcl.init.list]),
5290 ///
5291 /// (2.5) for certain unevaluated operands ([expr.typeid], [expr.sizeof])
5292 ///
5293 /// (2.6) when a prvalue that has type other than cv void appears as a
5294 /// discarded-value expression ([expr.context]).
5295 bool InMaterializeTemporaryObjectContext = false;
5296
5297 // When evaluating immediate functions in the initializer of a default
5298 // argument or default member initializer, this is the declaration whose
5299 // default initializer is being evaluated and the location of the call
5300 // or constructor definition.
5303 DeclContext *Context)
5304 : Loc(Loc), Decl(Decl), Context(Context) {
5305 assert(Decl && Context && "invalid initialization context");
5306 }
5307
5309 ValueDecl *Decl = nullptr;
5310 DeclContext *Context = nullptr;
5311 };
5312 std::optional<InitializationContext> DelayedDefaultInitializationContext;
5313
5315 unsigned NumCleanupObjects,
5316 CleanupInfo ParentCleanup,
5317 Decl *ManglingContextDecl,
5318 ExpressionKind ExprContext)
5319 : Context(Context), ParentCleanup(ParentCleanup),
5320 NumCleanupObjects(NumCleanupObjects), NumTypos(0),
5321 ManglingContextDecl(ManglingContextDecl), ExprContext(ExprContext),
5322 InDiscardedStatement(false), InImmediateFunctionContext(false),
5323 InImmediateEscalatingFunctionContext(false) {}
5324
5325 bool isUnevaluated() const {
5326 return Context == ExpressionEvaluationContext::Unevaluated ||
5327 Context == ExpressionEvaluationContext::UnevaluatedAbstract ||
5328 Context == ExpressionEvaluationContext::UnevaluatedList;
5329 }
5330
5331 bool isConstantEvaluated() const {
5332 return Context == ExpressionEvaluationContext::ConstantEvaluated ||
5333 Context == ExpressionEvaluationContext::ImmediateFunctionContext;
5334 }
5335
5337 return Context == ExpressionEvaluationContext::ImmediateFunctionContext ||
5338 (Context == ExpressionEvaluationContext::DiscardedStatement &&
5339 InImmediateFunctionContext) ||
5340 // C++23 [expr.const]p14:
5341 // An expression or conversion is in an immediate function
5342 // context if it is potentially evaluated and either:
5343 // * its innermost enclosing non-block scope is a function
5344 // parameter scope of an immediate function, or
5345 // * its enclosing statement is enclosed by the compound-
5346 // statement of a consteval if statement.
5347 (Context == ExpressionEvaluationContext::PotentiallyEvaluated &&
5348 InImmediateFunctionContext);
5349 }
5350
5352 return Context == ExpressionEvaluationContext::DiscardedStatement ||
5353 (Context ==
5354 ExpressionEvaluationContext::ImmediateFunctionContext &&
5355 InDiscardedStatement);
5356 }
5357 };
5358
5360 assert(!ExprEvalContexts.empty() &&
5361 "Must be in an expression evaluation context");
5362 return ExprEvalContexts.back();
5363 };
5364
5365 /// Increment when we find a reference; decrement when we find an ignored
5366 /// assignment. Ultimately the value is 0 if every reference is an ignored
5367 /// assignment.
5368 llvm::DenseMap<const VarDecl *, int> RefsMinusAssignments;
5369
5370 /// Used to control the generation of ExprWithCleanups.
5372
5373 /// ExprCleanupObjects - This is the stack of objects requiring
5374 /// cleanup that are created by the current full expression.
5376
5377 // AssignmentAction - This is used by all the assignment diagnostic functions
5378 // to represent what is actually causing the operation
5389
5390 bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
5391 // A version of DiagnoseUseOfDecl that should be used if overload resolution
5392 // has been used to find this declaration, which means we don't have to bother
5393 // checking the trailing requires clause.
5395 return DiagnoseUseOfDecl(
5396 D, Loc, /*UnknownObjCClass=*/nullptr, /*ObjCPropertyAccess=*/false,
5397 /*AvoidPartialAvailabilityChecks=*/false, /*ClassReceiver=*/nullptr,
5398 /*SkipTrailingRequiresClause=*/true);
5399 }
5400
5402 const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
5403 bool ObjCPropertyAccess = false,
5404 bool AvoidPartialAvailabilityChecks = false,
5405 ObjCInterfaceDecl *ClassReciever = nullptr,
5406 bool SkipTrailingRequiresClause = false);
5408
5410 ArrayRef<Expr *> Args);
5411
5413 ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
5422
5424
5428
5430
5432
5433 // Functions for marking a declaration referenced. These functions also
5434 // contain the relevant logic for marking if a reference to a function or
5435 // variable is an odr-use (in the C++11 sense). There are separate variants
5436 // for expressions referring to a decl; these exist because odr-use marking
5437 // needs to be delayed for some constant variables when we build one of the
5438 // named expressions.
5439 //
5440 // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
5441 // should usually be true. This only needs to be set to false if the lack of
5442 // odr-use cannot be determined from the current context (for instance,
5443 // because the name denotes a virtual function and was written without an
5444 // explicit nested-name-specifier).
5445 void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
5447 bool MightBeOdrUse = true);
5449 void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
5453 unsigned CapturingScopeIndex);
5454
5456 void CleanupVarDeclMarking();
5457
5463
5464 /// Try to capture the given variable.
5465 ///
5466 /// \param Var The variable to capture.
5467 ///
5468 /// \param Loc The location at which the capture occurs.
5469 ///
5470 /// \param Kind The kind of capture, which may be implicit (for either a
5471 /// block or a lambda), or explicit by-value or by-reference (for a lambda).
5472 ///
5473 /// \param EllipsisLoc The location of the ellipsis, if one is provided in
5474 /// an explicit lambda capture.
5475 ///
5476 /// \param BuildAndDiagnose Whether we are actually supposed to add the
5477 /// captures or diagnose errors. If false, this routine merely check whether
5478 /// the capture can occur without performing the capture itself or complaining
5479 /// if the variable cannot be captured.
5480 ///
5481 /// \param CaptureType Will be set to the type of the field used to capture
5482 /// this variable in the innermost block or lambda. Only valid when the
5483 /// variable can be captured.
5484 ///
5485 /// \param DeclRefType Will be set to the type of a reference to the capture
5486 /// from within the current scope. Only valid when the variable can be
5487 /// captured.
5488 ///
5489 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5490 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5491 /// This is useful when enclosing lambdas must speculatively capture
5492 /// variables that may or may not be used in certain specializations of
5493 /// a nested generic lambda.
5494 ///
5495 /// \returns true if an error occurred (i.e., the variable cannot be
5496 /// captured) and false if the capture succeeded.
5498 TryCaptureKind Kind, SourceLocation EllipsisLoc,
5499 bool BuildAndDiagnose, QualType &CaptureType,
5500 QualType &DeclRefType,
5501 const unsigned *const FunctionScopeIndexToStopAt);
5502
5503 /// Try to capture the given variable.
5506 SourceLocation EllipsisLoc = SourceLocation());
5507
5508 /// Checks if the variable must be captured.
5510
5511 /// Given a variable, determine the type that a reference to that
5512 /// variable will have in the given scope.
5514
5515 /// Mark all of the declarations referenced within a particular AST node as
5516 /// referenced. Used when template instantiation instantiates a non-dependent
5517 /// type -- entities referenced by the type are now referenced.
5520 Expr *E, bool SkipLocalVariables = false,
5521 ArrayRef<const Expr *> StopAt = std::nullopt);
5522
5523 /// Try to convert an expression \p E to type \p Ty. Returns the result of the
5524 /// conversion.
5526
5527 /// Conditionally issue a diagnostic based on the statements's reachability
5528 /// analysis.
5529 ///
5530 /// \param Stmts If Stmts is non-empty, delay reporting the diagnostic until
5531 /// the function body is parsed, and then do a basic reachability analysis to
5532 /// determine if the statement is reachable. If it is unreachable, the
5533 /// diagnostic will not be emitted.
5535 const PartialDiagnostic &PD);
5536
5537 /// Conditionally issue a diagnostic based on the current
5538 /// evaluation context.
5539 ///
5540 /// \param Statement If Statement is non-null, delay reporting the
5541 /// diagnostic until the function body is parsed, and then do a basic
5542 /// reachability analysis to determine if the statement is reachable.
5543 /// If it is unreachable, the diagnostic will not be emitted.
5544 bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
5545 const PartialDiagnostic &PD);
5546 /// Similar, but diagnostic is only produced if all the specified statements
5547 /// are reachable.
5549 const PartialDiagnostic &PD);
5550
5551 // Primary Expressions.
5552 SourceRange getExprRange(Expr *E) const;
5553
5555 SourceLocation TemplateKWLoc, UnqualifiedId &Id,
5556 bool HasTrailingLParen, bool IsAddressOfOperand,
5557 CorrectionCandidateCallback *CCC = nullptr,
5558 bool IsInlineAsmIdentifier = false,
5559 Token *KeywordReplacement = nullptr);
5560
5563 DeclarationNameInfo &NameInfo,
5564 const TemplateArgumentListInfo *&TemplateArgs);
5565
5567
5568 bool
5571 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
5572 ArrayRef<Expr *> Args = std::nullopt,
5573 DeclContext *LookupCtx = nullptr,
5574 TypoExpr **Out = nullptr);
5575
5577 IdentifierInfo *II);
5579
5581 IdentifierInfo *II,
5582 bool AllowBuiltinCreation = false);
5583
5584 /// If \p D cannot be odr-used in the current expression evaluation context,
5585 /// return a reason explaining why. Otherwise, return NOUR_None.
5587
5589 SourceLocation Loc,
5590 const CXXScopeSpec *SS = nullptr);
5591 DeclRefExpr *
5593 const DeclarationNameInfo &NameInfo,
5594 const CXXScopeSpec *SS = nullptr,
5595 NamedDecl *FoundD = nullptr,
5596 SourceLocation TemplateKWLoc = SourceLocation(),
5597 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5598 DeclRefExpr *
5600 const DeclarationNameInfo &NameInfo,
5601 NestedNameSpecifierLoc NNS, NamedDecl *FoundD = nullptr,
5602 SourceLocation TemplateKWLoc = SourceLocation(),
5603 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5604
5605 bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R,
5606 bool HasTrailingLParen);
5607
5610 const DeclarationNameInfo &NameInfo,
5611 bool IsAddressOfOperand, const Scope *S,
5612 TypeSourceInfo **RecoveryTSI = nullptr);
5613
5615 bool NeedsADL,
5616 bool AcceptInvalidDecl = false);
5618 const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
5619 NamedDecl *FoundD = nullptr,
5620 const TemplateArgumentListInfo *TemplateArgs = nullptr,
5621 bool AcceptInvalidDecl = false);
5622
5623 // ExpandFunctionLocalPredefinedMacros - Returns a new vector of Tokens,
5624 // where Tokens representing function local predefined macros (such as
5625 // __FUNCTION__) are replaced (expanded) with string-literal Tokens.
5627
5631
5633 SourceLocation LParen,
5634 SourceLocation RParen,
5635 TypeSourceInfo *TSI);
5637 SourceLocation LParen,
5638 SourceLocation RParen,
5639 ParsedType ParsedTy);
5640
5642
5643 ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
5645 Scope *UDLScope = nullptr);
5648 MultiExprArg Val);
5649
5650 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
5651 /// fragments (e.g. "foo" "bar" L"baz").
5653 Scope *UDLScope = nullptr);
5654
5656
5657 /// ControllingExprOrType is either an opaque pointer coming out of a
5658 /// ParsedType or an Expr *. FIXME: it'd be better to split this interface
5659 /// into two so we don't take a void *, but that's awkward because one of
5660 /// the operands is either a ParsedType or an Expr *, which doesn't lend
5661 /// itself to generic code very well.
5663 SourceLocation DefaultLoc,
5664 SourceLocation RParenLoc,
5665 bool PredicateIsExpr,
5666 void *ControllingExprOrType,
5667 ArrayRef<ParsedType> ArgTypes,
5668 ArrayRef<Expr *> ArgExprs);
5669 /// ControllingExprOrType is either a TypeSourceInfo * or an Expr *. FIXME:
5670 /// it'd be better to split this interface into two so we don't take a
5671 /// void *, but see the FIXME on ActOnGenericSelectionExpr as to why that
5672 /// isn't a trivial change.
5674 SourceLocation DefaultLoc,
5675 SourceLocation RParenLoc,
5676 bool PredicateIsExpr,
5677 void *ControllingExprOrType,
5679 ArrayRef<Expr *> Exprs);
5680
5681 // Binary/Unary Operators. 'Tok' is the token for the operator.
5683 Expr *InputExpr, bool IsAfterAmp = false);
5685 Expr *Input, bool IsAfterAmp = false);
5687 Expr *Input, bool IsAfterAmp = false);
5688
5691 const Expr *Op,
5692 const CXXMethodDecl *MD);
5693
5695
5696 bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty,
5697 SourceLocation OpLoc, SourceRange R);
5698 bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo,
5699 SourceLocation OpLoc, SourceRange R);
5700
5702 SourceLocation OpLoc,
5703 UnaryExprOrTypeTrait ExprKind,
5704 SourceRange R);
5706 UnaryExprOrTypeTrait ExprKind);
5708 UnaryExprOrTypeTrait ExprKind,
5709 bool IsType, void *TyOrEx,
5710 SourceRange ArgRange);
5711
5713 bool CheckVecStepExpr(Expr *E);
5714
5717 SourceRange ExprRange,
5718 UnaryExprOrTypeTrait ExprKind,
5719 StringRef KWName);
5720
5722 tok::TokenKind Kind, Expr *Input);
5723
5725 MultiExprArg ArgExprs,
5726 SourceLocation RLoc);
5728 Expr *Idx, SourceLocation RLoc);
5729
5731 Expr *ColumnIdx,
5732 SourceLocation RBLoc);
5733
5735 Expr *LowerBound,
5736 SourceLocation ColonLocFirst,
5737 SourceLocation ColonLocSecond,
5738 Expr *Length, Expr *Stride,
5739 SourceLocation RBLoc);
5741 SourceLocation RParenLoc,
5742 ArrayRef<Expr *> Dims,
5743 ArrayRef<SourceRange> Brackets);
5744
5745 /// Data structure for iterator expression.
5747 IdentifierInfo *DeclIdent = nullptr;
5754 };
5755
5757 SourceLocation LLoc, SourceLocation RLoc,
5759
5761 const FunctionProtoType *Proto,
5762 ArrayRef<Expr *> Args, SourceLocation RParenLoc,
5763 bool ExecConfig = false);
5765 const Expr *ArgExpr);
5766
5767 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
5768 /// This provides the location of the left/right parens and a list of comma
5769 /// locations.
5771 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5772 Expr *ExecConfig = nullptr);
5774 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5775 Expr *ExecConfig = nullptr,
5776 bool IsExecConfig = false,
5777 bool AllowRecovery = false);
5779 MultiExprArg CallArgs);
5780
5782
5784 BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc,
5785 ArrayRef<Expr *> Arg, SourceLocation RParenLoc,
5786 Expr *Config = nullptr, bool IsExecConfig = false,
5787 ADLCallKind UsesADL = ADLCallKind::NotADL);
5788
5790 ParsedType &Ty, SourceLocation RParenLoc,
5791 Expr *CastExpr);
5792
5794
5795 /// Build an altivec or OpenCL literal.
5797 SourceLocation RParenLoc, Expr *E,
5798 TypeSourceInfo *TInfo);
5799
5801
5803 SourceLocation RParenLoc, Expr *InitExpr);
5804
5806 TypeSourceInfo *TInfo,
5807 SourceLocation RParenLoc,
5808 Expr *LiteralExpr);
5809
5810 ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
5811 SourceLocation RBraceLoc);
5812
5813 ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
5814 SourceLocation RBraceLoc);
5815
5817 Expr *LHSExpr, Expr *RHSExpr);
5819 Expr *LHSExpr, Expr *RHSExpr);
5821 Expr *LHSExpr, Expr *RHSExpr);
5823 UnresolvedSetImpl &Functions);
5824
5825 void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
5826
5827 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
5828 /// in the case of a the GNU conditional expr extension.
5830 SourceLocation ColonLoc, Expr *CondExpr,
5831 Expr *LHSExpr, Expr *RHSExpr);
5832
5833 /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
5835 LabelDecl *TheDecl);
5836
5837 void ActOnStartStmtExpr();
5838 ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt,
5839 SourceLocation RPLoc);
5841 SourceLocation RPLoc, unsigned TemplateDepth);
5842 // Handle the final expression in a statement expression.
5844 void ActOnStmtExprError();
5845
5846 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
5849 bool isBrackets; // true if [expr], false if .ident
5850 union {
5853 } U;
5854 };
5855
5856 /// __builtin_offsetof(type, a.b[123][456].c)
5858 TypeSourceInfo *TInfo,
5859 ArrayRef<OffsetOfComponent> Components,
5860 SourceLocation RParenLoc);
5863 ParsedType ParsedArgTy,
5864 ArrayRef<OffsetOfComponent> Components,
5865 SourceLocation RParenLoc);
5866
5867 // __builtin_choose_expr(constExpr, expr1, expr2)
5868 ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr,
5869 Expr *LHSExpr, Expr *RHSExpr,
5870 SourceLocation RPLoc);
5871
5872 // __builtin_va_arg(expr, type)
5874 SourceLocation RPLoc);
5876 TypeSourceInfo *TInfo, SourceLocation RPLoc);
5877
5878 // __builtin_LINE(), __builtin_FUNCTION(), __builtin_FUNCSIG(),
5879 // __builtin_FILE(), __builtin_COLUMN(), __builtin_source_location()
5881 SourceLocation BuiltinLoc,
5882 SourceLocation RPLoc);
5883
5884 // Build a potentially resolved SourceLocExpr.
5886 SourceLocation BuiltinLoc, SourceLocation RPLoc,
5887 DeclContext *ParentContext);
5888
5889 // __null
5891
5892 bool CheckCaseExpression(Expr *E);
5893
5894 //===------------------------- "Block" Extension ------------------------===//
5895
5896 /// ActOnBlockStart - This callback is invoked when a block literal is
5897 /// started.
5898 void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
5899
5900 /// ActOnBlockArguments - This callback allows processing of block arguments.
5901 /// If there are no arguments, this is still invoked.
5902 void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
5903 Scope *CurScope);
5904
5905 /// ActOnBlockError - If there is an error parsing a block, this callback
5906 /// is invoked to pop the information about the block from the action impl.
5907 void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
5908
5909 /// ActOnBlockStmtExpr - This is called when the body of a block statement
5910 /// literal was successfully completed. ^(int x){...}
5912 Scope *CurScope);
5913
5914 //===---------------------------- Clang Extensions ----------------------===//
5915
5916 /// __builtin_convertvector(...)
5918 SourceLocation BuiltinLoc,
5919 SourceLocation RParenLoc);
5920
5921 //===---------------------------- OpenCL Features -----------------------===//
5922
5923 /// __builtin_astype(...)
5924 ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
5925 SourceLocation BuiltinLoc,
5926 SourceLocation RParenLoc);
5928 SourceLocation BuiltinLoc,
5929 SourceLocation RParenLoc);
5930
5931 /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
5933 ArrayRef<Expr *> SubExprs,
5934 QualType T = QualType());
5935
5936 // Note that LK_String is intentionally after the other literals, as
5937 // this is used for diagnostics logic.
5945 LK_None
5948
5950 NestedNameSpecifier *Qualifier,
5951 NamedDecl *FoundDecl,
5952 NamedDecl *Member);
5953
5954 /// CheckCallReturnType - Checks that a call expression's return type is
5955 /// complete. Returns true on failure. The location passed in is the location
5956 /// that best represents the call.
5957 bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
5958 CallExpr *CE, FunctionDecl *FD);
5959
5960 /// Emit a warning for all pending noderef expressions that we recorded.
5961 void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec);
5962
5964
5965 /// Instantiate or parse a C++ default argument expression as necessary.
5966 /// Return true on error.
5968 ParmVarDecl *Param, Expr *Init = nullptr,
5969 bool SkipImmediateInvocations = true);
5970
5971 /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
5972 /// the default expr if needed.
5974 ParmVarDecl *Param, Expr *Init = nullptr);
5975
5976 /// Wrap the expression in a ConstantExpr if it is a potential immediate
5977 /// invocation.
5979
5981
5982 bool IsInvalidSMECallConversion(QualType FromType, QualType ToType);
5983
5985 const DeclContext *DC = getCurLexicalContext();
5986 // A category implicitly has the attribute of the interface.
5987 if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
5988 DC = CatD->getClassInterface();
5989 return DC;
5990 }
5991
5992 /// Abstract base class used for diagnosing integer constant
5993 /// expression violations.
5995 public:
5997
5998 VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) {}
5999
6000 virtual SemaDiagnosticBuilder
6001 diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T);
6003 SourceLocation Loc) = 0;
6004 virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc);
6006 };
6007
6011 };
6012
6013 /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
6014 /// and reports the appropriate diagnostics. Returns false on success.
6015 /// Can optionally return the value of the expression.
6017 VerifyICEDiagnoser &Diagnoser,
6018 AllowFoldKind CanFold = NoFold);
6020 unsigned DiagID,
6021 AllowFoldKind CanFold = NoFold);
6023 llvm::APSInt *Result = nullptr,
6024 AllowFoldKind CanFold = NoFold);
6026 AllowFoldKind CanFold = NoFold) {
6027 return VerifyIntegerConstantExpression(E, nullptr, CanFold);
6028 }
6029
6030 /// DiagnoseAssignmentAsCondition - Given that an expression is
6031 /// being used as a boolean condition, warn if it's an assignment.
6033
6034 /// Redundant parentheses over an equality comparison can indicate
6035 /// that the user intended an assignment used as condition.
6037
6039 public:
6040 FullExprArg() : E(nullptr) {}
6041 FullExprArg(Sema &actions) : E(nullptr) {}
6042
6043 ExprResult release() { return E; }
6044
6045 Expr *get() const { return E; }
6046
6047 Expr *operator->() { return E; }
6048
6049 private:
6050 // FIXME: No need to make the entire Sema class a friend when it's just
6051 // Sema::MakeFullExpr that needs access to the constructor below.
6052 friend class Sema;
6053
6054 explicit FullExprArg(Expr *expr) : E(expr) {}
6055
6056 Expr *E;
6057 };
6058
6060 return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
6061 }
6063 return FullExprArg(
6064 ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
6065 }
6067 ExprResult FE =
6068 ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
6069 /*DiscardedValue*/ true);
6070 return FullExprArg(FE.get());
6071 }
6072
6074 Decl *ConditionVar;
6076 bool Invalid;
6077 std::optional<bool> KnownValue;
6078
6079 friend class Sema;
6080 ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
6081 bool IsConstexpr)
6082 : ConditionVar(ConditionVar), Condition(Condition), Invalid(false) {
6083 if (IsConstexpr && Condition.get()) {
6084 if (std::optional<llvm::APSInt> Val =
6085 Condition.get()->getIntegerConstantExpr(S.Context)) {
6086 KnownValue = !!(*Val);
6087 }
6088 }
6089 }
6090 explicit ConditionResult(bool Invalid)
6091 : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
6092 KnownValue(std::nullopt) {}
6093
6094 public:
6096 bool isInvalid() const { return Invalid; }
6097 std::pair<VarDecl *, Expr *> get() const {
6098 return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
6099 Condition.get());
6100 }
6101 std::optional<bool> getKnownValue() const { return KnownValue; }
6102 };
6104
6105 /// CheckBooleanCondition - Diagnose problems involving the use of
6106 /// the given expression as a boolean condition (e.g. in an if
6107 /// statement). Also performs the standard function and array
6108 /// decays, possibly changing the input variable.
6109 ///
6110 /// \param Loc - A location associated with the condition, e.g. the
6111 /// 'if' keyword.
6112 /// \return true iff there were any errors
6114 bool IsConstexpr = false);
6115
6116 enum class ConditionKind {
6117 Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
6118 ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
6119 Switch ///< An integral condition for a 'switch' statement.
6120 };
6121
6122 ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr,
6123 ConditionKind CK, bool MissingOK = false);
6124
6125 QualType CheckConditionalOperands( // C99 6.5.15
6126 ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
6127 ExprObjectKind &OK, SourceLocation QuestionLoc);
6128
6130 SourceLocation QuestionLoc);
6131
6132 bool DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr,
6133 SourceLocation QuestionLoc);
6134
6135 /// type checking for vector binary operators.
6137 SourceLocation Loc, bool IsCompAssign,
6138 bool AllowBothBool, bool AllowBoolConversion,
6139 bool AllowBoolOperation, bool ReportInvalid);
6143 SourceLocation Loc,
6144 BinaryOperatorKind Opc);
6146 SourceLocation Loc,
6147 BinaryOperatorKind Opc);
6149 SourceLocation Loc);
6150
6151 /// Context in which we're performing a usual arithmetic conversion.
6153 /// An arithmetic operation.
6155 /// A bitwise operation.
6157 /// A comparison.
6159 /// A conditional (?:) operator.
6161 /// A compound assignment expression.
6163 };
6164
6165 // type checking for sizeless vector binary operators.
6167 SourceLocation Loc, bool IsCompAssign,
6168 ArithConvKind OperationKind);
6169
6170 /// Type checking for matrix binary operators.
6172 SourceLocation Loc,
6173 bool IsCompAssign);
6175 SourceLocation Loc, bool IsCompAssign);
6176
6177 bool isValidSveBitcast(QualType srcType, QualType destType);
6178 bool isValidRVVBitcast(QualType srcType, QualType destType);
6179
6181
6182 bool areVectorTypesSameSize(QualType srcType, QualType destType);
6183 bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
6184 bool isLaxVectorConversion(QualType srcType, QualType destType);
6185 bool anyAltivecTypes(QualType srcType, QualType destType);
6186
6187 // type checking C++ declaration initializers (C++ [dcl.init]).
6188
6191 ExprValueKind &VK, CXXCastPath &Path);
6192
6193 /// Force an expression with unknown-type to an expression of the
6194 /// given type.
6196
6197 /// Type-check an expression that's being passed to an
6198 /// __unknown_anytype parameter.
6200 QualType &paramType);
6201
6202 // CheckMatrixCast - Check type constraints for matrix casts.
6203 // We allow casting between matrixes of the same dimensions i.e. when they
6204 // have the same number of rows and column. Returns true if the cast is
6205 // invalid.
6206 bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy,
6207 CastKind &Kind);
6208
6209 // CheckVectorCast - check type constraints for vectors.
6210 // Since vectors are an extension, there are no C standard reference for this.
6211 // We allow casting between vectors and integer datatypes of the same size.
6212 // returns true if the cast is invalid
6213 bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
6214 CastKind &Kind);
6215
6216 /// Prepare `SplattedExpr` for a vector splat operation, adding
6217 /// implicit casts if necessary.
6218 ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
6219
6220 // CheckExtVectorCast - check type constraints for extended vectors.
6221 // Since vectors are an extension, there are no C standard reference for this.
6222 // We allow casting between vectors and integer datatypes of the same size,
6223 // or vectors and the element type of that vector.
6224 // returns the cast expr
6226 CastKind &Kind);
6227
6230 }
6231
6232 // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
6233 // functions and arrays to their respective pointers (C99 6.3.2.1).
6235
6236 /// CallExprUnaryConversions - a special case of an unary conversion
6237 /// performed on a function designator of a call expression.
6239
6240 // DefaultFunctionArrayConversion - converts functions and arrays
6241 // to their respective pointers (C99 6.3.2.1).
6243
6244 // DefaultFunctionArrayLvalueConversion - converts functions and
6245 // arrays to their respective pointers and performs the
6246 // lvalue-to-rvalue conversion.
6248 bool Diagnose = true);
6249
6250 // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
6251 // the operand. This function is a no-op if the operand has a function type
6252 // or an array type.
6254
6255 // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
6256 // do not have a prototype. Integer promotions are performed on each
6257 // argument, and arguments that have type float are promoted to double.
6259
6261 const FunctionProtoType *Proto,
6262 Expr *Fn);
6263
6264 // Used for determining in which context a type is allowed to be passed to a
6265 // vararg function.
6273
6274 // Determines which VarArgKind fits an expression.
6276
6277 /// Check to see if the given expression is a valid argument to a variadic
6278 /// function, issuing a diagnostic if not.
6279 void checkVariadicArgument(const Expr *E, VariadicCallType CT);
6280
6281 /// GatherArgumentsForCall - Collector argument expressions for various
6282 /// form of call prototypes.
6284 const FunctionProtoType *Proto,
6285 unsigned FirstParam, ArrayRef<Expr *> Args,
6286 SmallVectorImpl<Expr *> &AllArgs,
6288 bool AllowExplicit = false,
6289 bool IsListInitialization = false);
6290
6291 // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
6292 // will create a runtime trap if the resulting type is not a POD type.
6294 FunctionDecl *FDecl);
6295
6296 // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
6297 // operands and then handles various conversions that are common to binary
6298 // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
6299 // routine returns the first non-arithmetic type found. The client is
6300 // responsible for emitting appropriate error diagnostics.
6302 SourceLocation Loc, ArithConvKind ACK);
6303
6304 /// AssignConvertType - All of the 'assignment' semantic checks return this
6305 /// enum to indicate whether the assignment was allowed. These checks are
6306 /// done for simple assignments, as well as initialization, return from
6307 /// function, argument passing, etc. The query is phrased in terms of a
6308 /// source and destination type.
6310 /// Compatible - the types are compatible according to the standard.
6312
6313 /// PointerToInt - The assignment converts a pointer to an int, which we
6314 /// accept as an extension.
6316
6317 /// IntToPointer - The assignment converts an int to a pointer, which we
6318 /// accept as an extension.
6320
6321 /// FunctionVoidPointer - The assignment is between a function pointer and
6322 /// void*, which the standard doesn't allow, but we accept as an extension.
6324
6325 /// IncompatiblePointer - The assignment is between two pointers types that
6326 /// are not compatible, but we accept them as an extension.
6328
6329 /// IncompatibleFunctionPointer - The assignment is between two function
6330 /// pointers types that are not compatible, but we accept them as an
6331 /// extension.
6333
6334 /// IncompatibleFunctionPointerStrict - The assignment is between two
6335 /// function pointer types that are not identical, but are compatible,
6336 /// unless compiled with -fsanitize=cfi, in which case the type mismatch
6337 /// may trip an indirect call runtime check.
6339
6340 /// IncompatiblePointerSign - The assignment is between two pointers types
6341 /// which point to integers which have a different sign, but are otherwise
6342 /// identical. This is a subset of the above, but broken out because it's by
6343 /// far the most common case of incompatible pointers.
6345
6346 /// CompatiblePointerDiscardsQualifiers - The assignment discards
6347 /// c/v/r qualifiers, which we accept as an extension.
6349
6350 /// IncompatiblePointerDiscardsQualifiers - The assignment
6351 /// discards qualifiers that we don't permit to be discarded,
6352 /// like address spaces.
6354
6355 /// IncompatibleNestedPointerAddressSpaceMismatch - The assignment
6356 /// changes address spaces in nested pointer types which is not allowed.
6357 /// For instance, converting __private int ** to __generic int ** is
6358 /// illegal even though __private could be converted to __generic.
6360
6361 /// IncompatibleNestedPointerQualifiers - The assignment is between two
6362 /// nested pointer types, and the qualifiers other than the first two
6363 /// levels differ e.g. char ** -> const char **, but we accept them as an
6364 /// extension.
6366
6367 /// IncompatibleVectors - The assignment is between two vector types that
6368 /// have the same size, which we accept as an extension.
6370
6371 /// IntToBlockPointer - The assignment converts an int to a block
6372 /// pointer. We disallow this.
6374
6375 /// IncompatibleBlockPointer - The assignment is between two block
6376 /// pointers types that are not compatible.
6378
6379 /// IncompatibleObjCQualifiedId - The assignment is between a qualified
6380 /// id type and something else (that is incompatible with it). For example,
6381 /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
6383
6384 /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
6385 /// object with __weak qualifier.
6387
6388 /// Incompatible - We reject this conversion outright, it is invalid to
6389 /// represent it in the AST.
6392
6393 /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
6394 /// assignment conversion type specified by ConvTy. This returns true if the
6395 /// conversion was invalid or false if the conversion was accepted.
6397 QualType DstType, QualType SrcType,
6398 Expr *SrcExpr, AssignmentAction Action,
6399 bool *Complained = nullptr);
6400
6401 /// CheckAssignmentConstraints - Perform type checking for assignment,
6402 /// argument passing, variable initialization, and function return values.
6403 /// C99 6.5.16.
6405 QualType LHSType,
6406 QualType RHSType);
6407
6408 /// Check assignment constraints and optionally prepare for a conversion of
6409 /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
6410 /// is true.
6412 ExprResult &RHS, CastKind &Kind,
6413 bool ConvertRHS = true);
6414
6415 /// Check assignment constraints for an assignment of RHS to LHSType.
6416 ///
6417 /// \param LHSType The destination type for the assignment.
6418 /// \param RHS The source expression for the assignment.
6419 /// \param Diagnose If \c true, diagnostics may be produced when checking
6420 /// for assignability. If a diagnostic is produced, \p RHS will be
6421 /// set to ExprError(). Note that this function may still return
6422 /// without producing a diagnostic, even for an invalid assignment.
6423 /// \param DiagnoseCFAudited If \c true, the target is a function parameter
6424 /// in an audited Core Foundation API and does not need to be checked
6425 /// for ARC retain issues.
6426 /// \param ConvertRHS If \c true, \p RHS will be updated to model the
6427 /// conversions necessary to perform the assignment. If \c false,
6428 /// \p Diagnose must also be \c false.
6430 QualType LHSType, ExprResult &RHS, bool Diagnose = true,
6431 bool DiagnoseCFAudited = false, bool ConvertRHS = true);
6432
6433 // If the lhs type is a transparent union, check whether we
6434 // can initialize the transparent union with the given expression.
6436 ExprResult &RHS);
6437
6438 /// the following "Check" methods will return a valid/converted QualType
6439 /// or a null QualType (indicating an error diagnostic was issued).
6440
6441 /// type checking binary operators (subroutines of CreateBuiltinBinOp).
6443 ExprResult &RHS);
6445 ExprResult &RHS);
6446
6448 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
6449 bool IsDivide);
6450 QualType CheckRemainderOperands( // C99 6.5.5
6451 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6452 bool IsCompAssign = false);
6453 QualType CheckAdditionOperands( // C99 6.5.6
6454 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6455 BinaryOperatorKind Opc, QualType *CompLHSTy = nullptr);
6457 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6458 QualType *CompLHSTy = nullptr);
6459 QualType CheckShiftOperands( // C99 6.5.7
6460 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6461 BinaryOperatorKind Opc, bool IsCompAssign = false);
6463 QualType CheckCompareOperands( // C99 6.5.8/9
6464 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6465 BinaryOperatorKind Opc);
6466 QualType CheckBitwiseOperands( // C99 6.5.[10...12]
6467 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6468 BinaryOperatorKind Opc);
6469 QualType CheckLogicalOperands( // C99 6.5.[13,14]
6470 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6471 BinaryOperatorKind Opc);
6472 // CheckAssignmentOperands is used for both simple and compound assignment.
6473 // For simple assignment, pass both expressions and a null converted type.
6474 // For compound assignment, pass both expressions and the converted type.
6475 QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
6476 Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType,
6477 BinaryOperatorKind Opc);
6478
6479 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
6480 bool Diagnose = true);
6481
6482 /// To be used for checking whether the arguments being passed to
6483 /// function exceeds the number of parameters expected for it.
6484 static bool TooManyArguments(size_t NumParams, size_t NumArgs,
6485 bool PartialOverloading = false) {
6486 // We check whether we're just after a comma in code-completion.
6487 if (NumArgs > 0 && PartialOverloading)
6488 return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
6489 return NumArgs > NumParams;
6490 }
6491
6492 /// Whether the AST is currently being rebuilt to correct immediate
6493 /// invocations. Immediate invocation candidates and references to consteval
6494 /// functions aren't tracked when this is set.
6496
6501 }
6502
6503 /// Determines whether we are currently in a context that
6504 /// is not evaluated as per C++ [expr] p5.
6507 }
6508
6511 }
6512
6514 assert(!ExprEvalContexts.empty() &&
6515 "Must be in an expression evaluation context");
6516 return ExprEvalContexts.back().InLifetimeExtendingContext;
6517 }
6518
6521 return (Ctx.Context ==
6524 }
6525
6526 std::optional<ExpressionEvaluationContextRecord::InitializationContext>
6528 assert(!ExprEvalContexts.empty() &&
6529 "Must be in an expression evaluation context");
6530 for (const auto &Ctx : llvm::reverse(ExprEvalContexts)) {
6532 Ctx.DelayedDefaultInitializationContext)
6533 return Ctx.DelayedDefaultInitializationContext;
6534 if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
6535 Ctx.isUnevaluated())
6536 break;
6537 }
6538 return std::nullopt;
6539 }
6540
6541 std::optional<ExpressionEvaluationContextRecord::InitializationContext>
6543 assert(!ExprEvalContexts.empty() &&
6544 "Must be in an expression evaluation context");
6545 std::optional<ExpressionEvaluationContextRecord::InitializationContext> Res;
6546 for (auto &Ctx : llvm::reverse(ExprEvalContexts)) {
6548 !Ctx.DelayedDefaultInitializationContext && Res)
6549 break;
6550 if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
6551 Ctx.isUnevaluated())
6552 break;
6553 Res = Ctx.DelayedDefaultInitializationContext;
6554 }
6555 return Res;
6556 }
6557
6558 /// keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext
6559 /// flag from previous context.
6561 if (ExprEvalContexts.size() > 2 &&
6563 .InLifetimeExtendingContext) {
6564 auto &LastRecord = ExprEvalContexts.back();
6565 auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2];
6566 LastRecord.InLifetimeExtendingContext =
6567 PrevRecord.InLifetimeExtendingContext;
6568 }
6569 }
6570
6571 /// keepInMaterializeTemporaryObjectContext - Pull down
6572 /// InMaterializeTemporaryObjectContext flag from previous context.
6574 if (ExprEvalContexts.size() > 2 &&
6576 .InMaterializeTemporaryObjectContext) {
6577 auto &LastRecord = ExprEvalContexts.back();
6578 auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2];
6579 LastRecord.InMaterializeTemporaryObjectContext =
6580 PrevRecord.InMaterializeTemporaryObjectContext;
6581 }
6582 }
6583
6586 }
6587
6588 /// Returns a field in a CXXRecordDecl that has the same name as the decl \p
6589 /// SelfAssigned when inside a CXXMethodDecl.
6590 const FieldDecl *
6592
6594
6595 template <typename... Ts>
6597 const Ts &...Args) {
6598 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
6599 return RequireCompleteType(Loc, T, CompleteTypeKind::Normal, Diagnoser);
6600 }
6601
6602 template <typename... Ts>
6603 bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID,
6604 const Ts &...Args) {
6605 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
6607 }
6608
6609 /// Abstract class used to diagnose incomplete types.
6612
6613 virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
6614 virtual ~TypeDiagnoser() {}
6615 };
6616
6617 template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
6618 protected:
6619 unsigned DiagID;
6620 std::tuple<const Ts &...> Args;
6621
6622 template <std::size_t... Is>
6624 std::index_sequence<Is...>) const {
6625 // Apply all tuple elements to the builder in order.
6626 bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
6627 (void)Dummy;
6628 }
6629
6630 public:
6631 BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
6632 : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
6633 assert(DiagID != 0 && "no diagnostic for type diagnoser");
6634 }
6635
6636 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
6637 const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
6638 emit(DB, std::index_sequence_for<Ts...>());
6639 DB << T;
6640 }
6641 };
6642
6643 /// A derivative of BoundTypeDiagnoser for which the diagnostic's type
6644 /// parameter is preceded by a 0/1 enum that is 1 if the type is sizeless.
6645 /// For example, a diagnostic with no other parameters would generally have
6646 /// the form "...%select{incomplete|sizeless}0 type %1...".
6647 template <typename... Ts>
6649 public:
6650 SizelessTypeDiagnoser(unsigned DiagID, const Ts &...Args)
6651 : BoundTypeDiagnoser<Ts...>(DiagID, Args...) {}
6652
6653 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
6654 const SemaDiagnosticBuilder &DB = S.Diag(Loc, this->DiagID);
6655 this->emit(DB, std::index_sequence_for<Ts...>());
6656 DB << T->isSizelessType() << T;
6657 }
6658 };
6659
6660 /// Check an argument list for placeholders that we won't try to
6661 /// handle later.
6663
6664 /// The C++ "std::source_location::__impl" struct, defined in
6665 /// <source_location>.
6667
6668 /// A stack of expression evaluation contexts.
6670
6671 // Set of failed immediate invocations to avoid double diagnosing.
6673
6674 /// List of SourceLocations where 'self' is implicitly retained inside a
6675 /// block.
6678
6679private:
6680 static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
6681
6682 /// Methods for marking which expressions involve dereferencing a pointer
6683 /// marked with the 'noderef' attribute. Expressions are checked bottom up as
6684 /// they are parsed, meaning that a noderef pointer may not be accessed. For
6685 /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
6686 /// `*p`, but need to check that `address of` is called on it. This requires
6687 /// keeping a container of all pending expressions and checking if the address
6688 /// of them are eventually taken.
6689 void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
6690 void CheckAddressOfNoDeref(const Expr *E);
6691
6692 ///@}
6693
6694 //
6695 //
6696 // -------------------------------------------------------------------------
6697 //
6698 //
6699
6700 /// \name C++ Expressions
6701 /// Implementations are in SemaExprCXX.cpp
6702 ///@{
6703
6704public:
6705 /// The C++ "std::bad_alloc" class, which is defined by the C++
6706 /// standard library.
6708
6709 /// The C++ "std::align_val_t" enum class, which is defined by the C++
6710 /// standard library.
6712
6713 /// The C++ "type_info" declaration, which is defined in <typeinfo>.
6715
6716 /// A flag to remember whether the implicit forms of operator new and delete
6717 /// have been declared.
6719
6720 /// Delete-expressions to be analyzed at the end of translation unit
6721 ///
6722 /// This list contains class members, and locations of delete-expressions
6723 /// that could not be proven as to whether they mismatch with new-expression
6724 /// used in initializer of the field.
6725 llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
6726
6728 assert(!ExprEvalContexts.empty() &&
6729 "Must be in an expression evaluation context");
6730 return ExprEvalContexts.back().InMaterializeTemporaryObjectContext;
6731 }
6732
6734 SourceLocation NameLoc,
6735 IdentifierInfo &Name);
6736
6738 Scope *S, CXXScopeSpec &SS,
6739 bool EnteringContext);
6741 Scope *S, CXXScopeSpec &SS,
6742 ParsedType ObjectType, bool EnteringContext);
6743
6745 ParsedType ObjectType);
6746
6747 ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc,
6748 TypeSourceInfo *Operand, SourceLocation RParenLoc);
6749 ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc,
6750 Expr *Operand, SourceLocation RParenLoc);
6751
6752 /// ActOnCXXTypeid - Parse typeid( something ).
6754 bool isType, void *TyOrExpr,
6755 SourceLocation RParenLoc);
6756
6757 ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc,
6758 TypeSourceInfo *Operand, SourceLocation RParenLoc);
6759 ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc,
6760 Expr *Operand, SourceLocation RParenLoc);
6761
6762 /// ActOnCXXUuidof - Parse __uuidof( something ).
6764 bool isType, void *TyOrExpr,
6765 SourceLocation RParenLoc);
6766
6767 //// ActOnCXXThis - Parse 'this' pointer.
6769
6770 /// Build a CXXThisExpr and mark it referenced in the current context.
6771 Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
6772 void MarkThisReferenced(CXXThisExpr *This);
6773
6774 /// Try to retrieve the type of the 'this' pointer.
6775 ///
6776 /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
6778
6779 /// When non-NULL, the C++ 'this' expression is allowed despite the
6780 /// current context not being a non-static member function. In such cases,
6781 /// this provides the type used for 'this'.
6783
6784 /// RAII object used to temporarily allow the C++ 'this' expression
6785 /// to be used, with the given qualifiers on the current class type.
6787 Sema &S;
6788 QualType OldCXXThisTypeOverride;
6789 bool Enabled;
6790
6791 public:
6792 /// Introduce a new scope where 'this' may be allowed (when enabled),
6793 /// using the given declaration (which is either a class template or a
6794 /// class) along with the given qualifiers.
6795 /// along with the qualifiers placed on '*this'.
6796 CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals,
6797 bool Enabled = true);
6798
6800 };
6801
6802 /// Make sure the value of 'this' is actually available in the current
6803 /// context, if it is a potentially evaluated context.
6804 ///
6805 /// \param Loc The location at which the capture of 'this' occurs.
6806 ///
6807 /// \param Explicit Whether 'this' is explicitly captured in a lambda
6808 /// capture list.
6809 ///
6810 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
6811 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
6812 /// This is useful when enclosing lambdas must speculatively capture
6813 /// 'this' that may or may not be used in certain specializations of
6814 /// a nested generic lambda (depending on whether the name resolves to
6815 /// a non-static member function or a static function).
6816 /// \return returns 'true' if failed, 'false' if success.
6818 SourceLocation Loc, bool Explicit = false, bool BuildAndDiagnose = true,
6819 const unsigned *const FunctionScopeIndexToStopAt = nullptr,
6820 bool ByCopy = false);
6821
6822 /// Determine whether the given type is the type of *this that is used
6823 /// outside of the body of a member function for a type that is currently
6824 /// being defined.
6826
6827 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
6829
6830 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
6832
6835 SourceLocation AtLoc, SourceLocation RParen);
6836
6837 /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
6839
6840 //// ActOnCXXThrow - Parse throw expressions.
6843 bool IsThrownVarInScope);
6844 bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
6845
6846 /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
6847 /// Can be interpreted either as function-style casting ("int(x)")
6848 /// or class type construction ("ClassType(x,y,z)")
6849 /// or creation of a value-initialized type ("int()").
6851 SourceLocation LParenOrBraceLoc,
6852 MultiExprArg Exprs,
6853 SourceLocation RParenOrBraceLoc,
6854 bool ListInitialization);
6855
6857 SourceLocation LParenLoc,
6858 MultiExprArg Exprs,
6859 SourceLocation RParenLoc,
6860 bool ListInitialization);
6861
6862 /// ActOnCXXNew - Parsed a C++ 'new' expression.
6863 ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
6864 SourceLocation PlacementLParen,
6865 MultiExprArg PlacementArgs,
6866 SourceLocation PlacementRParen,
6867 SourceRange TypeIdParens, Declarator &D,
6868 Expr *Initializer);
6870 BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen,
6871 MultiExprArg PlacementArgs, SourceLocation PlacementRParen,
6872 SourceRange TypeIdParens, QualType AllocType,
6873 TypeSourceInfo *AllocTypeInfo, std::optional<Expr *> ArraySize,
6874 SourceRange DirectInitRange, Expr *Initializer);
6875
6876 /// Determine whether \p FD is an aligned allocation or deallocation
6877 /// function that is unavailable.
6879
6880 /// Produce diagnostics if \p FD is an aligned allocation or deallocation
6881 /// function that is unavailable.
6883 SourceLocation Loc);
6884
6885 bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
6886 SourceRange R);
6887
6888 /// The scope in which to find allocation functions.
6890 /// Only look for allocation functions in the global scope.
6892 /// Only look for allocation functions in the scope of the
6893 /// allocated class.
6895 /// Look for allocation functions in both the global scope
6896 /// and in the scope of the allocated class.
6897 AFS_Both
6899
6900 /// Finds the overloads of operator new and delete that are appropriate
6901 /// for the allocation.
6903 AllocationFunctionScope NewScope,
6904 AllocationFunctionScope DeleteScope,
6905 QualType AllocType, bool IsArray,
6906 bool &PassAlignment, MultiExprArg PlaceArgs,
6907 FunctionDecl *&OperatorNew,
6908 FunctionDecl *&OperatorDelete,
6909 bool Diagnose = true);
6912 ArrayRef<QualType> Params);
6913
6915 DeclarationName Name, FunctionDecl *&Operator,
6916 bool Diagnose = true, bool WantSize = false,
6917 bool WantAligned = false);
6919 bool CanProvideSize,
6920 bool Overaligned,
6921 DeclarationName Name);
6923 CXXRecordDecl *RD);
6924
6925 /// ActOnCXXDelete - Parsed a C++ 'delete' expression
6926 ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
6927 bool ArrayForm, Expr *Operand);
6929 bool IsDelete, bool CallCanBeVirtual,
6930 bool WarnOnNonAbstractTypes,
6931 SourceLocation DtorLoc);
6932
6934 Expr *Operand, SourceLocation RParen);
6936 SourceLocation RParen);
6937
6939 SourceLocation OpLoc,
6940 tok::TokenKind OpKind,
6941 ParsedType &ObjectType,
6942 bool &MayBePseudoDestructor);
6943
6945 Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind,
6946 const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc,
6947 SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType);
6948
6950 Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind,
6951 CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc,
6952 SourceLocation TildeLoc, UnqualifiedId &SecondTypeName);
6953
6955 SourceLocation OpLoc,
6956 tok::TokenKind OpKind,
6957 SourceLocation TildeLoc,
6958 const DeclSpec &DS);
6959
6960 /// MaybeCreateExprWithCleanups - If the current full-expression
6961 /// requires any cleanups, surround it with a ExprWithCleanups node.
6962 /// Otherwise, just returns the passed-in expression.
6966
6967 ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
6968 return ActOnFinishFullExpr(
6969 Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
6970 }
6972 bool DiscardedValue, bool IsConstexpr = false,
6973 bool IsTemplateArgument = false);
6975
6977
6978 bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id,
6979 bool IsUDSuffix);
6980
6982
6983 ConditionResult ActOnConditionVariable(Decl *ConditionVar,
6984 SourceLocation StmtLoc,
6985 ConditionKind CK);
6986
6988 SourceLocation StmtLoc, ConditionKind CK);
6989
6990 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
6991 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
6992
6994
6997 const ImplicitConversionSequence &ICS,
6998 AssignmentAction Action,
7001 const StandardConversionSequence &SCS,
7002 AssignmentAction Action,
7004
7005 bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N);
7006
7007 /// Parsed one of the type trait support pseudo-functions.
7010 SourceLocation RParenLoc);
7013 SourceLocation RParenLoc);
7014
7015 /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
7016 /// pseudo-functions.
7018 ParsedType LhsTy, Expr *DimExpr,
7019 SourceLocation RParen);
7020
7022 TypeSourceInfo *TSInfo, Expr *DimExpr,
7023 SourceLocation RParen);
7024
7025 /// ActOnExpressionTrait - Parsed one of the unary type trait support
7026 /// pseudo-functions.
7028 Expr *Queried, SourceLocation RParen);
7029
7031 Expr *Queried, SourceLocation RParen);
7032
7034 ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc,
7035 bool isIndirect);
7037 ExprResult &RHS,
7038 SourceLocation QuestionLoc);
7039
7041 ExprResult &LHS, ExprResult &RHS,
7042 SourceLocation QuestionLoc);
7043
7045 ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK,
7046 ExprObjectKind &OK, SourceLocation questionLoc);
7047
7049 bool ConvertArgs = true);
7051 ExprResult &E2, bool ConvertArgs = true) {
7052 Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
7053 QualType Composite =
7054 FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
7055 E1 = E1Tmp;
7056 E2 = E2Tmp;
7057 return Composite;
7058 }
7059
7060 /// MaybeBindToTemporary - If the passed in expression has a record type with
7061 /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
7062 /// it simply returns the passed in expression.
7064
7065 /// IgnoredValueConversions - Given that an expression's result is
7066 /// syntactically ignored, perform any conversions that are
7067 /// required.
7069
7071
7072 /// Process any TypoExprs in the given Expr and its children,
7073 /// generating diagnostics as appropriate and returning a new Expr if there
7074 /// were typos that were all successfully corrected and ExprError if one or
7075 /// more typos could not be corrected.
7076 ///
7077 /// \param E The Expr to check for TypoExprs.
7078 ///
7079 /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
7080 /// initializer.
7081 ///
7082 /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
7083 /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
7084 ///
7085 /// \param Filter A function applied to a newly rebuilt Expr to determine if
7086 /// it is an acceptable/usable result from a single combination of typo
7087 /// corrections. As long as the filter returns ExprError, different
7088 /// combinations of corrections will be tried until all are exhausted.
7090 Expr *E, VarDecl *InitDecl = nullptr,
7091 bool RecoverUncorrectedTypos = false,
7092 llvm::function_ref<ExprResult(Expr *)> Filter =
7093 [](Expr *E) -> ExprResult { return E; });
7094
7096 ExprResult ER, VarDecl *InitDecl = nullptr,
7097 bool RecoverUncorrectedTypos = false,
7098 llvm::function_ref<ExprResult(Expr *)> Filter =
7099 [](Expr *E) -> ExprResult { return E; }) {
7100 return ER.isInvalid()
7101 ? ER
7102 : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
7103 RecoverUncorrectedTypos, Filter);
7104 }
7105
7106 /// Describes the result of an "if-exists" condition check.
7108 /// The symbol exists.
7110
7111 /// The symbol does not exist.
7113
7114 /// The name is a dependent name, so the results will differ
7115 /// from one instantiation to the next.
7117
7118 /// An error occurred.
7119 IER_Error
7121
7124 const DeclarationNameInfo &TargetNameInfo);
7125
7127 SourceLocation KeywordLoc,
7128 bool IsIfExists, CXXScopeSpec &SS,
7129 UnqualifiedId &Name);
7130
7133 ArrayRef<ParmVarDecl *> LocalParameters,
7134 Scope *BodyScope);
7138 CXXScopeSpec &SS,
7139 SourceLocation NameLoc,
7140 IdentifierInfo *TypeName,
7141 TemplateIdAnnotation *TemplateId);
7143 SourceLocation NoexceptLoc);
7145 Expr *E, SourceLocation NoexceptLoc, CXXScopeSpec &SS,
7146 TemplateIdAnnotation *TypeConstraint, unsigned Depth);
7149 Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc,
7153 bool IsSatisfied, SourceLocation NoexceptLoc,
7160 BuildNestedRequirement(StringRef InvalidConstraintEntity,
7161 const ASTConstraintSatisfaction &Satisfaction);
7164 SourceLocation LParenLoc,
7165 ArrayRef<ParmVarDecl *> LocalParameters,
7166 SourceLocation RParenLoc,
7168 SourceLocation ClosingBraceLoc);
7169
7170private:
7171 ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
7172 bool IsDelete);
7173
7174 void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
7175 void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
7176 bool DeleteWasArrayForm);
7177
7178 ///@}
7179
7180 //
7181 //
7182 // -------------------------------------------------------------------------
7183 //
7184 //
7185
7186 /// \name Member Access Expressions
7187 /// Implementations are in SemaExprMember.cpp
7188 ///@{
7189
7190public:
7192 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R,
7193 const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
7194 UnresolvedLookupExpr *AsULE = nullptr);
7196 BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7197 LookupResult &R,
7198 const TemplateArgumentListInfo *TemplateArgs,
7199 bool IsDefiniteInstance, const Scope *S);
7200
7202 Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc,
7203 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7204 NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
7205 const TemplateArgumentListInfo *TemplateArgs);
7206
7208 tok::TokenKind OpKind, CXXScopeSpec &SS,
7209 SourceLocation TemplateKWLoc,
7210 UnqualifiedId &Member, Decl *ObjCImpDecl);
7211
7213 Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS,
7214 SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl,
7215 bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo,
7217 const TemplateArgumentListInfo *TemplateArgs = nullptr);
7218 MemberExpr *
7219 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
7220 NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
7221 ValueDecl *Member, DeclAccessPair FoundDecl,
7222 bool HadMultipleCandidates,
7223 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
7225 const TemplateArgumentListInfo *TemplateArgs = nullptr);
7226
7227 bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
7228 const CXXScopeSpec &SS,
7229 const LookupResult &R);
7230
7231 // This struct is for use by ActOnMemberAccess to allow
7232 // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
7233 // changing the access operator from a '.' to a '->' (to see if that is the
7234 // change needed to fix an error about an unknown member, e.g. when the class
7235 // defines a custom operator->).
7240 };
7241
7243 Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
7244 CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7245 NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
7246 const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
7247 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
7248
7251 bool IsArrow, const CXXScopeSpec &SS,
7252 SourceLocation TemplateKWLoc,
7253 NamedDecl *FirstQualifierInScope, LookupResult &R,
7254 const TemplateArgumentListInfo *TemplateArgs,
7255 const Scope *S, bool SuppressQualifierCheck = false,
7256 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
7257
7258 ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
7259 SourceLocation OpLoc,
7260 const CXXScopeSpec &SS, FieldDecl *Field,
7261 DeclAccessPair FoundDecl,
7262 const DeclarationNameInfo &MemberNameInfo);
7263
7265
7267 const CXXScopeSpec &SS, SourceLocation nameLoc,
7268 IndirectFieldDecl *indirectField,
7269 DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
7270 Expr *baseObjectExpr = nullptr, SourceLocation opLoc = SourceLocation());
7271
7272private:
7273 void CheckMemberAccessOfNoDeref(const MemberExpr *E);
7274
7275 ///@}
7276
7277 //
7278 //
7279 // -------------------------------------------------------------------------
7280 //
7281 //
7282
7283 /// \name Initializers
7284 /// Implementations are in SemaInit.cpp
7285 ///@{
7286
7287public:
7288 /// Stack of types that correspond to the parameter entities that are
7289 /// currently being copy-initialized. Can be empty.
7291
7292 llvm::DenseMap<unsigned, CXXDeductionGuideDecl *>
7294
7295 bool IsStringInit(Expr *Init, const ArrayType *AT);
7296
7298 const InitializedEntity &Entity, InitListExpr *From);
7299
7301 SourceLocation EqualOrColonLoc,
7302 bool GNUSyntax, ExprResult Init);
7303
7304 /// Check that the lifetime of the initializer (and its subobjects) is
7305 /// sufficient for initializing the entity, and perform lifetime extension
7306 /// (when permitted) if not.
7308
7311 bool BoundToLvalueReference);
7312
7313 /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
7314 /// it as an xvalue. In C++98, the result will still be a prvalue, because
7315 /// we don't have xvalues there.
7317
7321
7325 SourceLocation EqualLoc, ExprResult Init,
7326 bool TopLevelOfInitList = false,
7327 bool AllowExplicit = false);
7328
7330 TypeSourceInfo *TInfo, const InitializedEntity &Entity,
7331 const InitializationKind &Kind, MultiExprArg Init);
7332
7333 ///@}
7334
7335 //
7336 //
7337 // -------------------------------------------------------------------------
7338 //
7339 //
7340
7341 /// \name C++ Lambda Expressions
7342 /// Implementations are in SemaLambda.cpp
7343 ///@{
7344
7345public:
7346 /// Create a new lambda closure type.
7348 TypeSourceInfo *Info,
7349 unsigned LambdaDependencyKind,
7350 LambdaCaptureDefault CaptureDefault);
7351
7352 /// Number lambda for linkage purposes if necessary.
7354 std::optional<CXXRecordDecl::LambdaNumbering>
7355 NumberingOverride = std::nullopt);
7356
7357 /// Endow the lambda scope info with the relevant properties.
7358 void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
7359 SourceRange IntroducerRange,
7360 LambdaCaptureDefault CaptureDefault,
7361 SourceLocation CaptureDefaultLoc, bool ExplicitParams,
7362 bool Mutable);
7363
7366
7368 CXXMethodDecl *CallOperator, CXXRecordDecl *Class,
7369 TemplateParameterList *TemplateParams);
7370
7372 CXXMethodDecl *Method, SourceLocation LambdaLoc,
7373 SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
7374 TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
7376 bool HasExplicitResultType);
7377
7379
7380 /// Perform initialization analysis of the init-capture and perform
7381 /// any implicit conversions such as an lvalue-to-rvalue conversion if
7382 /// not being used to initialize a reference.
7384 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7387 Loc, ByRef, EllipsisLoc, std::nullopt, Id,
7389 }
7391 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7392 std::optional<unsigned> NumExpansions, IdentifierInfo *Id,
7393 bool DirectInit, Expr *&Init);
7394
7395 /// Create a dummy variable within the declcontext of the lambda's
7396 /// call operator, for name lookup purposes for a lambda init capture.
7397 ///
7398 /// CodeGen handles emission of lambda captures, ignoring these dummy
7399 /// variables appropriately.
7401 SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
7402 IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx);
7403
7404 /// Add an init-capture to a lambda scope.
7405 void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef);
7406
7407 /// Note that we have finished the explicit captures for the
7408 /// given lambda.
7410
7411 /// Deduce a block or lambda's return type based on the return
7412 /// statements present in the body.
7414
7415 /// Once the Lambdas capture are known, we can start to create the closure,
7416 /// call operator method, and keep track of the captures.
7417 /// We do the capture lookup here, but they are not actually captured until
7418 /// after we know what the qualifiers of the call operator are.
7420 Scope *CurContext);
7421
7422 /// This is called after parsing the explicit template parameter list
7423 /// on a lambda (if it exists) in C++2a.
7425 SourceLocation LAngleLoc,
7426 ArrayRef<NamedDecl *> TParams,
7427 SourceLocation RAngleLoc,
7428 ExprResult RequiresClause);
7429
7431 SourceLocation MutableLoc);
7432
7434 Scope *LambdaScope,
7436
7437 /// ActOnStartOfLambdaDefinition - This is called just before we start
7438 /// parsing the body of a lambda; it analyzes the explicit captures and
7439 /// arguments, and sets up various data-structures for the body of the
7440 /// lambda.
7442 Declarator &ParamInfo, const DeclSpec &DS);
7443
7444 /// ActOnLambdaError - If there is an error parsing a lambda, this callback
7445 /// is invoked to pop the information about the lambda.
7446 void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
7447 bool IsInstantiation = false);
7448
7449 /// ActOnLambdaExpr - This is called when the body of a lambda expression
7450 /// was successfully completed.
7452
7453 /// Does copying/destroying the captured variable have side effects?
7454 bool CaptureHasSideEffects(const sema::Capture &From);
7455
7456 /// Diagnose if an explicit lambda capture is unused. Returns true if a
7457 /// diagnostic is emitted.
7458 bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
7459 const sema::Capture &From);
7460
7461 /// Build a FieldDecl suitable to hold the given capture.
7463
7464 /// Initialize the given capture with a suitable expression.
7466 SourceLocation ImplicitCaptureLoc,
7467 bool IsOpenMPMapping = false);
7468
7469 /// Complete a lambda-expression having processed and attached the
7470 /// lambda body.
7473
7474 /// Get the return type to use for a lambda's conversion function(s) to
7475 /// function pointer type, given the type of the call operator.
7476 QualType
7478 CallingConv CC);
7479
7481 SourceLocation ConvLocation,
7482 CXXConversionDecl *Conv, Expr *Src);
7483
7485 : private FunctionScopeRAII {
7486 public:
7488 Sema &SemasRef, FunctionDecl *FD, MultiLevelTemplateArgumentList MLTAL,
7490 bool ShouldAddDeclsFromParentScope = true);
7491 };
7492
7493 /// Compute the mangling number context for a lambda expression or
7494 /// block literal. Also return the extra mangling decl if any.
7495 ///
7496 /// \param DC - The DeclContext containing the lambda expression or
7497 /// block literal.
7498 std::tuple<MangleNumberingContext *, Decl *>
7500
7501 ///@}
7502
7503 //
7504 //
7505 // -------------------------------------------------------------------------
7506 //
7507 //
7508
7509 /// \name Name Lookup
7510 ///
7511 /// These routines provide name lookup that is used during semantic
7512 /// analysis to resolve the various kinds of names (identifiers,
7513 /// overloaded operator names, constructor names, etc.) into zero or
7514 /// more declarations within a particular scope. The major entry
7515 /// points are LookupName, which performs unqualified name lookup,
7516 /// and LookupQualifiedName, which performs qualified name lookup.
7517 ///
7518 /// All name lookup is performed based on some specific criteria,
7519 /// which specify what names will be visible to name lookup and how
7520 /// far name lookup should work. These criteria are important both
7521 /// for capturing language semantics (certain lookups will ignore
7522 /// certain names, for example) and for performance, since name
7523 /// lookup is often a bottleneck in the compilation of C++. Name
7524 /// lookup criteria is specified via the LookupCriteria enumeration.
7525 ///
7526 /// The results of name lookup can vary based on the kind of name
7527 /// lookup performed, the current language, and the translation
7528 /// unit. In C, for example, name lookup will either return nothing
7529 /// (no entity found) or a single declaration. In C++, name lookup
7530 /// can additionally refer to a set of overloaded functions or
7531 /// result in an ambiguity. All of the possible results of name
7532 /// lookup are captured by the LookupResult class, which provides
7533 /// the ability to distinguish among them.
7534 ///
7535 /// Implementations are in SemaLookup.cpp
7536 ///@{
7537
7538public:
7539 /// Tracks whether we are in a context where typo correction is
7540 /// disabled.
7542
7543 /// The number of typos corrected by CorrectTypo.
7545
7546 typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
7547 typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
7548
7549 /// A cache containing identifiers for which typo correction failed and
7550 /// their locations, so that repeated attempts to correct an identifier in a
7551 /// given location are ignored if typo correction already failed for it.
7553
7554 /// SpecialMemberOverloadResult - The overloading result for a special member
7555 /// function.
7556 ///
7557 /// This is basically a wrapper around PointerIntPair. The lowest bits of the
7558 /// integer are used to determine whether overload resolution succeeded.
7560 public:
7561 enum Kind { NoMemberOrDeleted, Ambiguous, Success };
7562
7563 private:
7564 llvm::PointerIntPair<CXXMethodDecl *, 2> Pair;
7565
7566 public:
7569 : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
7570
7571 CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
7572 void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
7573
7574 Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
7575 void setKind(Kind K) { Pair.setInt(K); }
7576 };
7577
7578 class SpecialMemberOverloadResultEntry : public llvm::FastFoldingSetNode,
7580 public:
7581 SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
7582 : FastFoldingSetNode(ID) {}
7583 };
7584
7585 /// A cache of special member function overload resolution results
7586 /// for C++ records.
7587 llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
7588
7589 /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
7590 /// `TransformTypos` in order to keep track of any TypoExprs that are created
7591 /// recursively during typo correction and wipe them away if the correction
7592 /// fails.
7594
7596
7597 // Members have to be NamespaceDecl* or TranslationUnitDecl*.
7598 // TODO: make this is a typesafe union.
7601
7602 /// Describes the kind of name lookup to perform.
7604 /// Ordinary name lookup, which finds ordinary names (functions,
7605 /// variables, typedefs, etc.) in C and most kinds of names
7606 /// (functions, variables, members, types, etc.) in C++.
7608 /// Tag name lookup, which finds the names of enums, classes,
7609 /// structs, and unions.
7611 /// Label name lookup.
7613 /// Member name lookup, which finds the names of
7614 /// class/struct/union members.
7616 /// Look up of an operator name (e.g., operator+) for use with
7617 /// operator overloading. This lookup is similar to ordinary name
7618 /// lookup, but will ignore any declarations that are class members.
7620 /// Look up a name following ~ in a destructor name. This is an ordinary
7621 /// lookup, but prefers tags to typedefs.
7623 /// Look up of a name that precedes the '::' scope resolution
7624 /// operator in C++. This lookup completely ignores operator, object,
7625 /// function, and enumerator names (C++ [basic.lookup.qual]p1).
7627 /// Look up a namespace name within a C++ using directive or
7628 /// namespace alias definition, ignoring non-namespace names (C++
7629 /// [basic.lookup.udir]p1).
7631 /// Look up all declarations in a scope with the given name,
7632 /// including resolved using declarations. This is appropriate
7633 /// for checking redeclarations for a using declaration.
7635 /// Look up an ordinary name that is going to be redeclared as a
7636 /// name with linkage. This lookup ignores any declarations that
7637 /// are outside of the current scope unless they have linkage. See
7638 /// C99 6.2.2p4-5 and C++ [basic.link]p6.
7640 /// Look up a friend of a local class. This lookup does not look
7641 /// outside the innermost non-class scope. See C++11 [class.friend]p11.
7643 /// Look up the name of an Objective-C protocol.
7645 /// Look up implicit 'self' parameter of an objective-c method.
7647 /// Look up the name of an OpenMP user-defined reduction operation.
7649 /// Look up the name of an OpenMP user-defined mapper.
7651 /// Look up any declaration with any name.
7654
7655 /// The possible outcomes of name lookup for a literal operator.
7657 /// The lookup resulted in an error.
7659 /// The lookup found no match but no diagnostic was issued.
7661 /// The lookup found a single 'cooked' literal operator, which
7662 /// expects a normal literal to be built and passed to it.
7664 /// The lookup found a single 'raw' literal operator, which expects
7665 /// a string literal containing the spelling of the literal token.
7667 /// The lookup found an overload set of literal operator templates,
7668 /// which expect the characters of the spelling of the literal token to be
7669 /// passed as a non-type template argument pack.
7671 /// The lookup found an overload set of literal operator templates,
7672 /// which expect the character type and characters of the spelling of the
7673 /// string literal token to be passed as template arguments.
7675 };
7676
7677 SpecialMemberOverloadResult
7679 bool VolatileArg, bool RValueThis, bool ConstThis,
7680 bool VolatileThis);
7681
7682 typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
7683 typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
7685
7686 /// Specifies whether (or how) name lookup is being performed for a
7687 /// redeclaration (vs. a reference).
7689 /// The lookup is a reference to this name that is not for the
7690 /// purpose of redeclaring the name.
7692 /// The lookup results will be used for redeclaration of a name,
7693 /// if an entity by that name already exists and is visible.
7695 /// The lookup results will be used for redeclaration of a name
7696 /// with external linkage; non-visible lookup results with external linkage
7697 /// may also be found.
7700
7702 // A declaration with an owning module for linkage can never link against
7703 // anything that is not visible. We don't need to check linkage here; if
7704 // the context has internal linkage, redeclaration lookup won't find things
7705 // from other TUs, and we can't safely compute linkage yet in general.
7706 if (cast<Decl>(CurContext)
7707 ->getOwningModuleForLinkage(/*IgnoreLinkage*/ true))
7710 }
7711
7712 /// Look up a name, looking for a single declaration. Return
7713 /// null if the results were absent, ambiguous, or overloaded.
7714 ///
7715 /// It is preferable to use the elaborated form and explicitly handle
7716 /// ambiguity and overloaded.
7718 SourceLocation Loc, LookupNameKind NameKind,
7720 bool LookupBuiltin(LookupResult &R);
7721 void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID);
7722 bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation = false,
7723 bool ForceNoCPlusPlus = false);
7724 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
7725 bool InUnqualifiedLookup = false);
7726 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
7727 CXXScopeSpec &SS);
7729 bool AllowBuiltinCreation = false,
7730 bool EnteringContext = false);
7735
7737 UnresolvedSetImpl &Functions);
7738
7740 SourceLocation GnuLabelLoc = SourceLocation());
7741
7745 unsigned Quals);
7747 bool RValueThis, unsigned ThisQuals);
7749 unsigned Quals);
7751 bool RValueThis, unsigned ThisQuals);
7753
7754 /// Force the declaration of any implicitly-declared members of this
7755 /// class.
7757
7758 /// Make a merged definition of an existing hidden definition \p ND
7759 /// visible at the specified location.
7761
7762 /// Get the set of additional modules that should be checked during
7763 /// name lookup. A module and its imports become visible when instanting a
7764 /// template defined within it.
7766
7767 bool hasVisibleMergedDefinition(const NamedDecl *Def);
7769
7770 /// Determine if the template parameter \p D has a visible default argument.
7771 bool
7773 llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7774 /// Determine if the template parameter \p D has a reachable default argument.
7776 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7777 /// Determine if the template parameter \p D has a reachable default argument.
7781
7782 /// Determine if there is a visible declaration of \p D that is an explicit
7783 /// specialization declaration for a specialization of a template. (For a
7784 /// member specialization, use hasVisibleMemberSpecialization.)
7786 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7787 /// Determine if there is a reachable declaration of \p D that is an explicit
7788 /// specialization declaration for a specialization of a template. (For a
7789 /// member specialization, use hasReachableMemberSpecialization.)
7791 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7792
7793 /// Determine if there is a visible declaration of \p D that is a member
7794 /// specialization declaration (as opposed to an instantiated declaration).
7796 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7797 /// Determine if there is a reachable declaration of \p D that is a member
7798 /// specialization declaration (as opposed to an instantiated declaration).
7800 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7801
7802 bool isModuleVisible(const Module *M, bool ModulePrivate = false);
7803
7804 /// Determine whether any declaration of an entity is visible.
7805 bool
7807 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
7808 return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
7809 }
7810
7813 /// Determine whether any declaration of an entity is reachable.
7814 bool
7816 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
7817 return isReachable(D) || hasReachableDeclarationSlow(D, Modules);
7818 }
7820 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7821
7822 void diagnoseTypo(const TypoCorrection &Correction,
7823 const PartialDiagnostic &TypoDiag,
7824 bool ErrorRecovery = true);
7825
7826 void diagnoseTypo(const TypoCorrection &Correction,
7827 const PartialDiagnostic &TypoDiag,
7828 const PartialDiagnostic &PrevNote,
7829 bool ErrorRecovery = true);
7830
7832 SourceLocation InstantiationLoc, ArrayRef<Expr *> Args,
7833 AssociatedNamespaceSet &AssociatedNamespaces,
7834 AssociatedClassSet &AssociatedClasses);
7835
7837
7840 bool AllowRaw, bool AllowTemplate,
7841 bool AllowStringTemplate, bool DiagnoseMissing,
7842 StringLiteral *StringLit = nullptr);
7843
7845 ArrayRef<Expr *> Args, ADLResult &Functions);
7846
7849 bool IncludeGlobalScope = true,
7850 bool LoadExternal = true);
7853 bool IncludeGlobalScope = true,
7854 bool IncludeDependentBases = false,
7855 bool LoadExternal = true);
7856
7858 CTK_NonError, // CorrectTypo used in a non error recovery situation.
7859 CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
7861
7863 Sema::LookupNameKind LookupKind, Scope *S,
7865 CorrectTypoKind Mode,
7866 DeclContext *MemberContext = nullptr,
7867 bool EnteringContext = false,
7868 const ObjCObjectPointerType *OPT = nullptr,
7869 bool RecordFailure = true);
7870
7872 const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
7875 CorrectTypoKind Mode, DeclContext *MemberContext = nullptr,
7876 bool EnteringContext = false, const ObjCObjectPointerType *OPT = nullptr);
7877
7878 /// Kinds of missing import. Note, the values of these enumerators correspond
7879 /// to %select values in diagnostics.
7882 Definition,
7886 };
7887
7888 /// Diagnose that the specified declaration needs to be visible but
7889 /// isn't, and suggest a module import that would resolve the problem.
7891 MissingImportKind MIK, bool Recover = true);
7893 SourceLocation DeclLoc, ArrayRef<Module *> Modules,
7894 MissingImportKind MIK, bool Recover);
7895
7897 std::unique_ptr<TypoCorrectionConsumer> Consumer;
7900 TypoExprState();
7901 TypoExprState(TypoExprState &&other) noexcept;
7902 TypoExprState &operator=(TypoExprState &&other) noexcept;
7903 };
7904
7905 const TypoExprState &getTypoExprState(TypoExpr *TE) const;
7906
7907 /// Clears the state of the given TypoExpr.
7908 void clearDelayedTypo(TypoExpr *TE);
7909
7910 /// Called on #pragma clang __debug dump II
7912
7913 /// Called on #pragma clang __debug dump E
7914 void ActOnPragmaDump(Expr *E);
7915
7916private:
7917 // The set of known/encountered (unique, canonicalized) NamespaceDecls.
7918 //
7919 // The boolean value will be true to indicate that the namespace was loaded
7920 // from an AST/PCH file, or false otherwise.
7921 llvm::MapVector<NamespaceDecl *, bool> KnownNamespaces;
7922
7923 /// Whether we have already loaded known namespaces from an extenal
7924 /// source.
7925 bool LoadedExternalKnownNamespaces;
7926
7927 bool CppLookupName(LookupResult &R, Scope *S);
7928
7929 bool isUsableModule(const Module *M);
7930
7931 /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
7932 /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
7933 /// should be skipped entirely.
7934 std::unique_ptr<TypoCorrectionConsumer> makeTypoCorrectionConsumer(
7935 const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
7937 DeclContext *MemberContext, bool EnteringContext,
7938 const ObjCObjectPointerType *OPT, bool ErrorRecovery);
7939
7940 /// The set of unhandled TypoExprs and their associated state.
7941 llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
7942
7943 /// Creates a new TypoExpr AST node.
7944 TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
7947
7948 /// Cache for module units which is usable for current module.
7949 llvm::DenseSet<const Module *> UsableModuleUnitsCache;
7950
7951 /// Record the typo correction failure and return an empty correction.
7952 TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
7953 bool RecordFailure = true) {
7954 if (RecordFailure)
7955 TypoCorrectionFailures[Typo].insert(TypoLoc);
7956 return TypoCorrection();
7957 }
7958
7959 bool isAcceptableSlow(const NamedDecl *D, AcceptableKind Kind);
7960
7961 /// Determine whether two declarations should be linked together, given that
7962 /// the old declaration might not be visible and the new declaration might
7963 /// not have external linkage.
7964 bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
7965 const NamedDecl *New) {
7966 if (isVisible(Old))
7967 return true;
7968 // See comment in below overload for why it's safe to compute the linkage
7969 // of the new declaration here.
7970 if (New->isExternallyDeclarable()) {
7971 assert(Old->isExternallyDeclarable() &&
7972 "should not have found a non-externally-declarable previous decl");
7973 return true;
7974 }
7975 return false;
7976 }
7977 bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
7978
7979 ///@}
7980
7981 //
7982 //
7983 // -------------------------------------------------------------------------
7984 //
7985 //
7986
7987 /// \name Modules
7988 /// Implementations are in SemaModule.cpp
7989 ///@{
7990
7991public:
7992 /// Get the module unit whose scope we are currently within.
7994 return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
7995 }
7996
7997 /// Is the module scope we are an implementation unit?
7999 return ModuleScopes.empty()
8000 ? false
8001 : ModuleScopes.back().Module->isModuleImplementation();
8002 }
8003
8004 // When loading a non-modular PCH files, this is used to restore module
8005 // visibility.
8007 VisibleModules.setVisible(Mod, ImportLoc);
8008 }
8009
8010 enum class ModuleDeclKind {
8011 Interface, ///< 'export module X;'
8012 Implementation, ///< 'module X;'
8013 PartitionInterface, ///< 'export module X:Y;'
8014 PartitionImplementation, ///< 'module X:Y;'
8015 };
8016
8017 /// An enumeration to represent the transition of states in parsing module
8018 /// fragments and imports. If we are not parsing a C++20 TU, or we find
8019 /// an error in state transition, the state is set to NotACXX20Module.
8021 FirstDecl, ///< Parsing the first decl in a TU.
8022 GlobalFragment, ///< after 'module;' but before 'module X;'
8023 ImportAllowed, ///< after 'module X;' but before any non-import decl.
8024 ImportFinished, ///< after any non-import decl.
8025 PrivateFragmentImportAllowed, ///< after 'module :private;' but before any
8026 ///< non-import decl.
8027 PrivateFragmentImportFinished, ///< after 'module :private;' but a
8028 ///< non-import decl has already been seen.
8029 NotACXX20Module ///< Not a C++20 TU, or an invalid state was found.
8030 };
8031
8032 /// The parser has processed a module-declaration that begins the definition
8033 /// of a module interface or implementation.
8035 SourceLocation ModuleLoc, ModuleDeclKind MDK,
8036 ModuleIdPath Path, ModuleIdPath Partition,
8037 ModuleImportState &ImportState);
8038
8039 /// The parser has processed a global-module-fragment declaration that begins
8040 /// the definition of the global module fragment of the current module unit.
8041 /// \param ModuleLoc The location of the 'module' keyword.
8043
8044 /// The parser has processed a private-module-fragment declaration that begins
8045 /// the definition of the private module fragment of the current module unit.
8046 /// \param ModuleLoc The location of the 'module' keyword.
8047 /// \param PrivateLoc The location of the 'private' keyword.
8049 SourceLocation PrivateLoc);
8050
8051 /// The parser has processed a module import declaration.
8052 ///
8053 /// \param StartLoc The location of the first token in the declaration. This
8054 /// could be the location of an '@', 'export', or 'import'.
8055 /// \param ExportLoc The location of the 'export' keyword, if any.
8056 /// \param ImportLoc The location of the 'import' keyword.
8057 /// \param Path The module toplevel name as an access path.
8058 /// \param IsPartition If the name is for a partition.
8060 SourceLocation ExportLoc,
8061 SourceLocation ImportLoc, ModuleIdPath Path,
8062 bool IsPartition = false);
8064 SourceLocation ExportLoc,
8065 SourceLocation ImportLoc, Module *M,
8066 ModuleIdPath Path = {});
8067
8068 /// The parser has processed a module import translated from a
8069 /// #include or similar preprocessing directive.
8070 void ActOnAnnotModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
8071 void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
8072
8073 /// The parsed has entered a submodule.
8074 void ActOnAnnotModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
8075 /// The parser has left a submodule.
8076 void ActOnAnnotModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
8077
8078 /// Create an implicit import of the given module at the given
8079 /// source location, for error recovery, if possible.
8080 ///
8081 /// This routine is typically used when an entity found by name lookup
8082 /// is actually hidden within a module that we know about but the user
8083 /// has forgotten to import.
8084 void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
8085 Module *Mod);
8086
8087 Decl *ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc,
8088 SourceLocation LBraceLoc);
8089 Decl *ActOnFinishExportDecl(Scope *S, Decl *ExportDecl,
8090 SourceLocation RBraceLoc);
8091
8092private:
8093 /// The parser has begun a translation unit to be compiled as a C++20
8094 /// Header Unit, helper for ActOnStartOfTranslationUnit() only.
8095 void HandleStartOfHeaderUnit();
8096
8097 struct ModuleScope {
8098 SourceLocation BeginLoc;
8099 clang::Module *Module = nullptr;
8100 VisibleModuleSet OuterVisibleModules;
8101 };
8102 /// The modules we're currently parsing.
8104
8105 /// For an interface unit, this is the implicitly imported interface unit.
8106 clang::Module *ThePrimaryInterface = nullptr;
8107
8108 /// The explicit global module fragment of the current translation unit.
8109 /// The explicit Global Module Fragment, as specified in C++
8110 /// [module.global.frag].
8111 clang::Module *TheGlobalModuleFragment = nullptr;
8112
8113 /// The implicit global module fragments of the current translation unit.
8114 ///
8115 /// The contents in the implicit global module fragment can't be discarded.
8116 clang::Module *TheImplicitGlobalModuleFragment = nullptr;
8117
8118 /// Namespace definitions that we will export when they finish.
8119 llvm::SmallPtrSet<const NamespaceDecl *, 8> DeferredExportedNamespaces;
8120
8121 /// In a C++ standard module, inline declarations require a definition to be
8122 /// present at the end of a definition domain. This set holds the decls to
8123 /// be checked at the end of the TU.
8124 llvm::SmallPtrSet<const FunctionDecl *, 8> PendingInlineFuncDecls;
8125
8126 /// Helper function to judge if we are in module purview.
8127 /// Return false if we are not in a module.
8128 bool isCurrentModulePurview() const;
8129
8130 /// Enter the scope of the explicit global module fragment.
8131 Module *PushGlobalModuleFragment(SourceLocation BeginLoc);
8132 /// Leave the scope of the explicit global module fragment.
8133 void PopGlobalModuleFragment();
8134
8135 /// Enter the scope of an implicit global module fragment.
8136 Module *PushImplicitGlobalModuleFragment(SourceLocation BeginLoc);
8137 /// Leave the scope of an implicit global module fragment.
8138 void PopImplicitGlobalModuleFragment();
8139
8140 VisibleModuleSet VisibleModules;
8141
8142 ///@}
8143
8144 //
8145 //
8146 // -------------------------------------------------------------------------
8147 //
8148 //
8149
8150 /// \name C++ Overloading
8151 /// Implementations are in SemaOverload.cpp
8152 ///@{
8153
8154public:
8155 /// Whether deferrable diagnostics should be deferred.
8156 bool DeferDiags = false;
8157
8158 /// RAII class to control scope of DeferDiags.
8160 Sema &S;
8161 bool SavedDeferDiags = false;
8162
8163 public:
8164 DeferDiagsRAII(Sema &S, bool DeferDiags)
8165 : S(S), SavedDeferDiags(S.DeferDiags) {
8166 S.DeferDiags = DeferDiags;
8167 }
8168 ~DeferDiagsRAII() { S.DeferDiags = SavedDeferDiags; }
8169 };
8170
8171 /// Flag indicating if Sema is building a recovery call expression.
8172 ///
8173 /// This flag is used to avoid building recovery call expressions
8174 /// if Sema is already doing so, which would cause infinite recursions.
8176
8178 /// This is a legitimate overload: the existing declarations are
8179 /// functions or function templates with different signatures.
8181
8182 /// This is not an overload because the signature exactly matches
8183 /// an existing declaration.
8185
8186 /// This is not an overload because the lookup results contain a
8187 /// non-function.
8191 const LookupResult &OldDecls, NamedDecl *&OldDecl,
8192 bool UseMemberUsingDeclRules);
8193 bool IsOverload(FunctionDecl *New, FunctionDecl *Old,
8194 bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs = true);
8195
8196 // Checks whether MD constitutes an override the base class method BaseMD.
8197 // When checking for overrides, the object object members are ignored.
8198 bool IsOverride(FunctionDecl *MD, FunctionDecl *BaseMD,
8199 bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs = true);
8200
8201 enum class AllowedExplicit {
8202 /// Allow no explicit functions to be used.
8203 None,
8204 /// Allow explicit conversion functions but not explicit constructors.
8206 /// Allow both explicit conversion functions and explicit constructors.
8207 All
8208 };
8209
8211 Expr *From, QualType ToType, bool SuppressUserConversions,
8212 AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle,
8213 bool AllowObjCWritebackConversion);
8214
8216 AssignmentAction Action,
8217 bool AllowExplicit = false);
8218
8219 bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
8220 bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
8221 bool IsComplexPromotion(QualType FromType, QualType ToType);
8222 bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
8223 bool InOverloadResolution, QualType &ConvertedType,
8224 bool &IncompatibleObjC);
8225 bool isObjCPointerConversion(QualType FromType, QualType ToType,
8226 QualType &ConvertedType, bool &IncompatibleObjC);
8227 bool isObjCWritebackConversion(QualType FromType, QualType ToType,
8228 QualType &ConvertedType);
8229 bool IsBlockPointerConversion(QualType FromType, QualType ToType,
8230 QualType &ConvertedType);
8231
8234 unsigned *ArgPos = nullptr,
8235 bool Reversed = false);
8236
8238 const FunctionProtoType *NewType,
8239 unsigned *ArgPos = nullptr,
8240 bool Reversed = false);
8241
8242 bool FunctionNonObjectParamTypesAreEqual(const FunctionDecl *OldFunction,
8243 const FunctionDecl *NewFunction,
8244 unsigned *ArgPos = nullptr,
8245 bool Reversed = false);
8246
8248 QualType ToType);
8249
8250 bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind,
8251 CXXCastPath &BasePath, bool IgnoreBaseAccess,
8252 bool Diagnose = true);
8253 bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
8254 bool InOverloadResolution,
8255 QualType &ConvertedType);
8256 bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind,
8257 CXXCastPath &BasePath,
8258 bool IgnoreBaseAccess);
8259 bool IsQualificationConversion(QualType FromType, QualType ToType,
8260 bool CStyle, bool &ObjCLifetimeConversion);
8261 bool IsFunctionConversion(QualType FromType, QualType ToType,
8262 QualType &ResultTy);
8264
8266 FunctionDecl *Fun);
8268 Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl,
8269 CXXMethodDecl *Method);
8270
8273
8274 /// Contexts in which a converted constant expression is required.
8275 enum CCEKind {
8276 CCEK_CaseValue, ///< Expression in a case label.
8277 CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
8278 CCEK_TemplateArg, ///< Value of a non-type template parameter.
8279 CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
8280 CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
8281 CCEK_Noexcept, ///< Condition in a noexcept(bool) specifier.
8282 CCEK_StaticAssertMessageSize, ///< Call to size() in a static assert
8283 ///< message.
8284 CCEK_StaticAssertMessageData, ///< Call to data() in a static assert
8285 ///< message.
8286 };
8287
8289 CCEKind CCE,
8290 NamedDecl *Dest = nullptr);
8291
8293 llvm::APSInt &Value, CCEKind CCE);
8295 APValue &Value, CCEKind CCE,
8296 NamedDecl *Dest = nullptr);
8297
8300 CCEKind CCE, bool RequireInt,
8301 const APValue &PreNarrowingValue);
8302
8303 /// Abstract base class used to perform a contextual implicit
8304 /// conversion from an expression to any type passing a filter.
8306 public:
8309
8310 ContextualImplicitConverter(bool Suppress = false,
8311 bool SuppressConversion = false)
8312 : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
8313
8314 /// Determine whether the specified type is a valid destination type
8315 /// for this conversion.
8316 virtual bool match(QualType T) = 0;
8317
8318 /// Emits a diagnostic complaining that the expression does not have
8319 /// integral or enumeration type.
8321 QualType T) = 0;
8322
8323 /// Emits a diagnostic when the expression has incomplete class type.
8324 virtual SemaDiagnosticBuilder
8326
8327 /// Emits a diagnostic when the only matching conversion function
8328 /// is explicit.
8330 SourceLocation Loc,
8331 QualType T,
8332 QualType ConvTy) = 0;
8333
8334 /// Emits a note for the explicit conversion function.
8335 virtual SemaDiagnosticBuilder
8337
8338 /// Emits a diagnostic when there are multiple possible conversion
8339 /// functions.
8341 QualType T) = 0;
8342
8343 /// Emits a note for one of the candidate conversions.
8344 virtual SemaDiagnosticBuilder
8346
8347 /// Emits a diagnostic when we picked a conversion function
8348 /// (for cases when we are not allowed to pick a conversion function).
8350 SourceLocation Loc,
8351 QualType T,
8352 QualType ConvTy) = 0;
8353
8355 };
8356
8358 bool AllowScopedEnumerations;
8359
8360 public:
8361 ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress,
8362 bool SuppressConversion)
8363 : ContextualImplicitConverter(Suppress, SuppressConversion),
8364 AllowScopedEnumerations(AllowScopedEnumerations) {}
8365
8366 /// Match an integral or (possibly scoped) enumeration type.
8367 bool match(QualType T) override;
8368
8370 QualType T) override {
8371 return diagnoseNotInt(S, Loc, T);
8372 }
8373
8374 /// Emits a diagnostic complaining that the expression does not have
8375 /// integral or enumeration type.
8377 QualType T) = 0;
8378 };
8379
8380 /// Perform a contextual implicit conversion.
8383 ContextualImplicitConverter &Converter);
8384
8385 /// ReferenceCompareResult - Expresses the result of comparing two
8386 /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
8387 /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
8389 /// Ref_Incompatible - The two types are incompatible, so direct
8390 /// reference binding is not possible.
8392 /// Ref_Related - The two types are reference-related, which means
8393 /// that their unqualified forms (T1 and T2) are either the same
8394 /// or T1 is a base class of T2.
8396 /// Ref_Compatible - The two types are reference-compatible.
8399
8400 // Fake up a scoped enumeration that still contextually converts to bool.
8402 /// The conversions that would be performed on an lvalue of type T2 when
8403 /// binding a reference of type T1 to it, as determined when evaluating
8404 /// whether T1 is reference-compatible with T2.
8406 Qualification = 0x1,
8407 NestedQualification = 0x2,
8409 DerivedToBase = 0x8,
8410 ObjC = 0x10,
8411 ObjCLifetime = 0x20,
8412
8413 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
8414 };
8415 };
8417
8420 ReferenceConversions *Conv = nullptr);
8421
8424 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8425 bool PartialOverloading = false, bool AllowExplicit = true,
8426 bool AllowExplicitConversion = false,
8427 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
8428 ConversionSequenceList EarlyConversions = std::nullopt,
8430 bool AggregateCandidateDeduction = false);
8432 const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
8433 OverloadCandidateSet &CandidateSet,
8434 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
8435 bool SuppressUserConversions = false, bool PartialOverloading = false,
8436 bool FirstArgumentIsBase = false);
8437 void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType,
8438 Expr::Classification ObjectClassification,
8439 ArrayRef<Expr *> Args,
8440 OverloadCandidateSet &CandidateSet,
8441 bool SuppressUserConversion = false,
8443 void
8444 AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
8445 CXXRecordDecl *ActingContext, QualType ObjectType,
8446 Expr::Classification ObjectClassification,
8447 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
8448 bool SuppressUserConversions = false,
8449 bool PartialOverloading = false,
8450 ConversionSequenceList EarlyConversions = std::nullopt,
8453 FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
8454 CXXRecordDecl *ActingContext,
8455 TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType,
8456 Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
8457 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8458 bool PartialOverloading = false, OverloadCandidateParamOrder PO = {});
8460 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
8461 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
8462 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8463 bool PartialOverloading = false, bool AllowExplicit = true,
8464 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
8466 bool AggregateCandidateDeduction = false);
8468 FunctionTemplateDecl *FunctionTemplate, ArrayRef<QualType> ParamTypes,
8469 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
8470 ConversionSequenceList &Conversions, bool SuppressUserConversions,
8471 CXXRecordDecl *ActingContext = nullptr, QualType ObjectType = QualType(),
8472 Expr::Classification ObjectClassification = {},
8475 CXXConversionDecl *Conversion, DeclAccessPair FoundDecl,
8476 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
8477 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
8478 bool AllowExplicit, bool AllowResultConversion = true);
8480 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
8481 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
8482 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
8483 bool AllowExplicit, bool AllowResultConversion = true);
8484 void AddSurrogateCandidate(CXXConversionDecl *Conversion,
8485 DeclAccessPair FoundDecl,
8486 CXXRecordDecl *ActingContext,
8487 const FunctionProtoType *Proto, Expr *Object,
8488 ArrayRef<Expr *> Args,
8489 OverloadCandidateSet &CandidateSet);
8491 const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
8492 OverloadCandidateSet &CandidateSet,
8493 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
8495 SourceLocation OpLoc, ArrayRef<Expr *> Args,
8496 OverloadCandidateSet &CandidateSet,
8498 void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
8499 OverloadCandidateSet &CandidateSet,
8500 bool IsAssignmentOperator = false,
8501 unsigned NumContextualBoolArguments = 0);
8503 SourceLocation OpLoc, ArrayRef<Expr *> Args,
8504 OverloadCandidateSet &CandidateSet);
8506 DeclarationName Name, SourceLocation Loc, ArrayRef<Expr *> Args,
8507 TemplateArgumentListInfo *ExplicitTemplateArgs,
8508 OverloadCandidateSet &CandidateSet, bool PartialOverloading = false);
8509
8510 /// Check the enable_if expressions on the given function. Returns the first
8511 /// failing attribute, or NULL if they were all successful.
8512 EnableIfAttr *CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc,
8513 ArrayRef<Expr *> Args,
8514 bool MissingImplicitThis = false);
8515
8516 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
8517 /// non-ArgDependent DiagnoseIfAttrs.
8518 ///
8519 /// Argument-dependent diagnose_if attributes should be checked each time a
8520 /// function is used as a direct callee of a function call.
8521 ///
8522 /// Returns true if any errors were emitted.
8523 bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
8524 const Expr *ThisArg,
8525 ArrayRef<const Expr *> Args,
8526 SourceLocation Loc);
8527
8528 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
8529 /// ArgDependent DiagnoseIfAttrs.
8530 ///
8531 /// Argument-independent diagnose_if attributes should be checked on every use
8532 /// of a function.
8533 ///
8534 /// Returns true if any errors were emitted.
8535 bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
8536 SourceLocation Loc);
8537
8538 /// Determine if \p A and \p B are equivalent internal linkage declarations
8539 /// from different modules, and thus an ambiguity error can be downgraded to
8540 /// an extension warning.
8541 bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
8542 const NamedDecl *B);
8544 SourceLocation Loc, const NamedDecl *D,
8545 ArrayRef<const NamedDecl *> Equiv);
8546
8547 // Emit as a 'note' the specific overload candidate
8549 const NamedDecl *Found, const FunctionDecl *Fn,
8551 QualType DestType = QualType(), bool TakingAddress = false);
8552
8553 // Emit as a series of 'note's all template and non-templates identified by
8554 // the expression Expr
8555 void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
8556 bool TakingAddress = false);
8557
8558 /// Returns whether the given function's address can be taken or not,
8559 /// optionally emitting a diagnostic if the address can't be taken.
8560 ///
8561 /// Returns false if taking the address of the function is illegal.
8562 bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
8563 bool Complain = false,
8564 SourceLocation Loc = SourceLocation());
8565
8566 // [PossiblyAFunctionType] --> [Return]
8567 // NonFunctionType --> NonFunctionType
8568 // R (A) --> R(A)
8569 // R (*)(A) --> R (A)
8570 // R (&)(A) --> R (A)
8571 // R (S::*)(A) --> R (A)
8572 QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
8573
8574 FunctionDecl *
8575 ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType,
8576 bool Complain, DeclAccessPair &Found,
8577 bool *pHadMultipleCandidates = nullptr);
8578
8579 FunctionDecl *
8580 resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult);
8581
8583 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
8584
8586 OverloadExpr *ovl, bool Complain = false, DeclAccessPair *Found = nullptr,
8587 TemplateSpecCandidateSet *FailedTSC = nullptr);
8588
8590 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
8591 bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
8592 QualType DestTypeForComplaining = QualType(),
8593 unsigned DiagIDForComplaining = 0);
8594
8595 void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
8596 ArrayRef<Expr *> Args,
8597 OverloadCandidateSet &CandidateSet,
8598 bool PartialOverloading = false);
8600 LookupResult &R, TemplateArgumentListInfo *ExplicitTemplateArgs,
8601 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet);
8602
8603 // An enum used to represent the different possible results of building a
8604 // range-based for loop.
8610
8612 SourceLocation RangeLoc,
8613 const DeclarationNameInfo &NameInfo,
8614 LookupResult &MemberLookup,
8615 OverloadCandidateSet *CandidateSet,
8616 Expr *Range, ExprResult *CallExpr);
8617
8619 Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc,
8620 MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig,
8621 bool AllowTypoCorrection = true, bool CalleesAddressIsTaken = false);
8622
8624 MultiExprArg Args, SourceLocation RParenLoc,
8625 OverloadCandidateSet *CandidateSet,
8627
8631 const UnresolvedSetImpl &Fns,
8632 bool PerformADL = true);
8633
8636 const UnresolvedSetImpl &Fns, Expr *input,
8637 bool RequiresADL = true);
8638
8641 const UnresolvedSetImpl &Fns,
8642 ArrayRef<Expr *> Args, bool RequiresADL = true);
8644 const UnresolvedSetImpl &Fns, Expr *LHS,
8645 Expr *RHS, bool RequiresADL = true,
8646 bool AllowRewrittenCandidates = true,
8647 FunctionDecl *DefaultedFn = nullptr);
8649 const UnresolvedSetImpl &Fns,
8650 Expr *LHS, Expr *RHS,
8651 FunctionDecl *DefaultedFn);
8652
8654 SourceLocation RLoc, Expr *Base,
8655 MultiExprArg Args);
8656
8658 Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args,
8659 SourceLocation RParenLoc, Expr *ExecConfig = nullptr,
8660 bool IsExecConfig = false, bool AllowRecovery = false);
8662 SourceLocation LParenLoc,
8663 MultiExprArg Args,
8664 SourceLocation RParenLoc);
8665
8667 SourceLocation OpLoc,
8668 bool *NoArrowOperatorFound = nullptr);
8669
8671 CXXConversionDecl *Method,
8672 bool HadMultipleCandidates);
8673
8676 SourceLocation LitEndLoc,
8677 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
8678
8680 FunctionDecl *Fn);
8682 DeclAccessPair FoundDecl,
8683 FunctionDecl *Fn);
8684
8685private:
8686 /// - Returns a selector which best matches given argument list or
8687 /// nullptr if none could be found
8688 ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
8689 bool IsInstance,
8691
8692 ///@}
8693
8694 //
8695 //
8696 // -------------------------------------------------------------------------
8697 //
8698 //
8699
8700 /// \name Pseudo-Object
8701 /// Implementations are in SemaPseudoObject.cpp
8702 ///@{
8703
8704public:
8707
8710
8712 UnaryOperatorKind Opcode, Expr *Op);
8714 BinaryOperatorKind Opcode, Expr *LHS,
8715 Expr *RHS);
8718
8719 ///@}
8720
8721 //
8722 //
8723 // -------------------------------------------------------------------------
8724 //
8725 //
8726
8727 /// \name Statements
8728 /// Implementations are in SemaStmt.cpp
8729 ///@{
8730
8731public:
8732 /// Stack of active SEH __finally scopes. Can be empty.
8734
8735 StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
8737
8739 bool HasLeadingEmptyMacro = false);
8740
8742 SourceLocation EndLoc);
8744
8745 /// DiagnoseUnusedExprResult - If the statement passed in is an expression
8746 /// whose result is unused, warn.
8747 void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID);
8748
8749 void ActOnStartOfCompoundStmt(bool IsStmtExpr);
8753 ArrayRef<Stmt *> Elts, bool isStmtExpr);
8754
8756
8759 SourceLocation DotDotDotLoc, ExprResult RHS,
8760 SourceLocation ColonLoc);
8761 void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
8762
8764 SourceLocation ColonLoc, Stmt *SubStmt,
8765 Scope *CurScope);
8767 SourceLocation ColonLoc, Stmt *SubStmt);
8768
8770 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
8772 Stmt *SubStmt);
8773
8774 /// Check whether the given statement can have musttail applied to it,
8775 /// issuing a diagnostic and returning false if not. In the success case,
8776 /// the statement is rewritten to remove implicit nodes from the return
8777 /// value.
8778 bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA);
8779
8781 SourceLocation LParenLoc, Stmt *InitStmt,
8782 ConditionResult Cond, SourceLocation RParenLoc,
8783 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
8785 SourceLocation LParenLoc, Stmt *InitStmt,
8786 ConditionResult Cond, SourceLocation RParenLoc,
8787 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
8788
8790
8792 SourceLocation LParenLoc, Stmt *InitStmt,
8793 ConditionResult Cond,
8794 SourceLocation RParenLoc);
8796 Stmt *Body);
8797
8798 /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
8799 /// integer not in the range of enum values.
8800 void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
8801 Expr *SrcExpr);
8802
8804 ConditionResult Cond, SourceLocation RParenLoc,
8805 Stmt *Body);
8807 SourceLocation WhileLoc, SourceLocation CondLParen,
8808 Expr *Cond, SourceLocation CondRParen);
8809
8811 Stmt *First, ConditionResult Second,
8812 FullExprArg Third, SourceLocation RParenLoc,
8813 Stmt *Body);
8814
8816
8818 Expr *collection);
8820 Expr *collection,
8821 SourceLocation RParenLoc);
8822 StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
8823
8825 /// Initial building of a for-range statement.
8827 /// Instantiation or recovery rebuild of a for-range statement. Don't
8828 /// attempt any typo-correction.
8830 /// Determining whether a for-range statement could be built. Avoid any
8831 /// unnecessary or irreversible actions.
8834
8836 Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc,
8837 Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection,
8838 SourceLocation RParenLoc, BuildForRangeKind Kind,
8839 ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps = {});
8841 SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt,
8842 SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End,
8843 Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc,
8844 BuildForRangeKind Kind,
8845 ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps = {});
8846 StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
8847
8848 StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
8849 LabelDecl *TheDecl);
8850 StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
8851 SourceLocation StarLoc, Expr *DestExp);
8852 StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
8853 StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
8854
8857
8858 enum Status : uint8_t { None, MoveEligible, MoveEligibleAndCopyElidable };
8860
8861 bool isMoveEligible() const { return S != None; };
8862 bool isCopyElidable() const { return S == MoveEligibleAndCopyElidable; }
8863 };
8865 NamedReturnInfo getNamedReturnInfo(
8867 NamedReturnInfo getNamedReturnInfo(const VarDecl *VD);
8868 const VarDecl *getCopyElisionCandidate(NamedReturnInfo &Info,
8869 QualType ReturnType);
8870
8873 const NamedReturnInfo &NRInfo, Expr *Value,
8874 bool SupressSimplerImplicitMoves = false);
8875
8877
8879 SourceLocation ReturnLoc, Expr *RetExpr,
8880 const AutoType *AT);
8881
8882 StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
8883 Scope *CurScope);
8884 StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
8885 bool AllowRecovery = false);
8887 NamedReturnInfo &NRInfo,
8888 bool SupressSimplerImplicitMoves);
8889
8891 Decl *Parm, Stmt *Body);
8892
8894
8896 MultiStmtArg Catch, Stmt *Finally);
8897
8900 Scope *CurScope);
8902 Expr *operand);
8904 Stmt *SynchBody);
8905
8907
8909 Stmt *HandlerBlock);
8911 ArrayRef<Stmt *> Handlers);
8912
8913 StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
8914 SourceLocation TryLoc, Stmt *TryBlock,
8915 Stmt *Handler);
8917 Stmt *Block);
8922
8924 bool IsIfExists,
8925 NestedNameSpecifierLoc QualifierLoc,
8926 DeclarationNameInfo NameInfo,
8927 Stmt *Nested);
8929 bool IsIfExists, CXXScopeSpec &SS,
8930 UnqualifiedId &Name, Stmt *Nested);
8931
8932 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
8933 CapturedRegionKind Kind, unsigned NumParams);
8934 typedef std::pair<StringRef, QualType> CapturedParamNameType;
8935 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
8936 CapturedRegionKind Kind,
8938 unsigned OpenMPCaptureLevel = 0);
8942 SourceLocation Loc,
8943 unsigned NumParams);
8944
8945private:
8946 /// Check whether the given statement can have musttail applied to it,
8947 /// issuing a diagnostic and returning false if not.
8948 bool checkMustTailAttr(const Stmt *St, const Attr &MTA);
8949
8950 /// Check if the given expression contains 'break' or 'continue'
8951 /// statement that produces control flow different from GCC.
8952 void CheckBreakContinueBinding(Expr *E);
8953
8954 ///@}
8955
8956 //
8957 //
8958 // -------------------------------------------------------------------------
8959 //
8960 //
8961
8962 /// \name `inline asm` Statement
8963 /// Implementations are in SemaStmtAsm.cpp
8964 ///@{
8965
8966public:
8967 StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
8968 bool IsVolatile, unsigned NumOutputs,
8969 unsigned NumInputs, IdentifierInfo **Names,
8970 MultiExprArg Constraints, MultiExprArg Exprs,
8971 Expr *AsmString, MultiExprArg Clobbers,
8972 unsigned NumLabels, SourceLocation RParenLoc);
8973
8975 llvm::InlineAsmIdentifierInfo &Info);
8977 SourceLocation TemplateKWLoc,
8979 bool IsUnevaluatedContext);
8980 bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset,
8981 SourceLocation AsmLoc);
8983 SourceLocation AsmLoc);
8985 ArrayRef<Token> AsmToks, StringRef AsmString,
8986 unsigned NumOutputs, unsigned NumInputs,
8987 ArrayRef<StringRef> Constraints,
8988 ArrayRef<StringRef> Clobbers,
8989 ArrayRef<Expr *> Exprs, SourceLocation EndLoc);
8990 LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
8991 SourceLocation Location, bool AlwaysCreate);
8992
8993 ///@}
8994
8995 //
8996 //
8997 // -------------------------------------------------------------------------
8998 //
8999 //
9000
9001 /// \name Statement Attribute Handling
9002 /// Implementations are in SemaStmtAttr.cpp
9003 ///@{
9004
9005public:
9006 bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
9007 const AttributeCommonInfo &A);
9008 bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
9009 const AttributeCommonInfo &A);
9010
9011 CodeAlignAttr *BuildCodeAlignAttr(const AttributeCommonInfo &CI, Expr *E);
9013
9014 /// Process the attributes before creating an attributed statement. Returns
9015 /// the semantic attributes that have been processed.
9016 void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs,
9018
9020 SourceRange Range);
9022 const IdentifierInfo *AttrName,
9023 SourceRange Range);
9024
9025 ///@}
9026
9027 //
9028 //
9029 // -------------------------------------------------------------------------
9030 //
9031 //
9032
9033 /// \name C++ Templates
9034 /// Implementations are in SemaTemplate.cpp
9035 ///@{
9036
9037public:
9038 // Saves the current floating-point pragma stack and clear it in this Sema.
9040 public:
9042 : S(S), SavedStack(std::move(S.FpPragmaStack)) {
9043 S.FpPragmaStack.Stack.clear();
9044 }
9045 ~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); }
9046
9047 private:
9048 Sema &S;
9050 };
9051
9053 CurFPFeatures = FPO;
9054 FpPragmaStack.CurrentValue = FPO.getChangesFrom(FPOptions(LangOpts));
9055 }
9056
9058 return llvm::ArrayRef(InventedParameterInfos.begin() +
9061 }
9062
9063 /// The number of SFINAE diagnostics that have been trapped.
9065
9068 FunctionScopes.end());
9069 }
9070
9071 typedef llvm::MapVector<const FunctionDecl *,
9072 std::unique_ptr<LateParsedTemplate>>
9075
9076 /// Determine the number of levels of enclosing template parameters. This is
9077 /// only usable while parsing. Note that this does not include dependent
9078 /// contexts in which no template parameters have yet been declared, such as
9079 /// in a terse function template or generic lambda before the first 'auto' is
9080 /// encountered.
9081 unsigned getTemplateDepth(Scope *S) const;
9082
9084 bool AllowFunctionTemplates = true,
9085 bool AllowDependent = true);
9087 bool AllowFunctionTemplates = true,
9088 bool AllowDependent = true,
9089 bool AllowNonTemplateFunctions = false);
9090 /// Try to interpret the lookup result D as a template-name.
9091 ///
9092 /// \param D A declaration found by name lookup.
9093 /// \param AllowFunctionTemplates Whether function templates should be
9094 /// considered valid results.
9095 /// \param AllowDependent Whether unresolved using declarations (that might
9096 /// name templates) should be considered valid results.
9098 bool AllowFunctionTemplates = true,
9099 bool AllowDependent = true);
9100
9102 /// Whether and why a template name is required in this lookup.
9104 public:
9105 /// Template name is required if TemplateKWLoc is valid.
9107 : TemplateKW(TemplateKWLoc) {}
9108 /// Template name is unconditionally required.
9110
9112 return TemplateKW.value_or(SourceLocation());
9113 }
9114 bool hasTemplateKeyword() const {
9115 return getTemplateKeywordLoc().isValid();
9116 }
9117 bool isRequired() const { return TemplateKW != SourceLocation(); }
9118 explicit operator bool() const { return isRequired(); }
9119
9120 private:
9121 std::optional<SourceLocation> TemplateKW;
9122 };
9123
9125 /// This is not assumed to be a template name.
9126 None,
9127 /// This is assumed to be a template name because lookup found nothing.
9129 /// This is assumed to be a template name because lookup found one or more
9130 /// functions (but no function templates).
9132 };
9133 bool LookupTemplateName(
9134 LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType,
9135 bool EnteringContext, bool &MemberOfUnknownSpecialization,
9136 RequiredTemplateKind RequiredTemplate = SourceLocation(),
9137 AssumedTemplateKind *ATK = nullptr, bool AllowTypoCorrection = true);
9138
9140 bool hasTemplateKeyword,
9141 const UnqualifiedId &Name,
9142 ParsedType ObjectType, bool EnteringContext,
9143 TemplateTy &Template,
9144 bool &MemberOfUnknownSpecialization,
9145 bool Disambiguation = false);
9146
9147 /// Try to resolve an undeclared template name as a type template.
9148 ///
9149 /// Sets II to the identifier corresponding to the template name, and updates
9150 /// Name to a corresponding (typo-corrected) type template name and TNK to
9151 /// the corresponding kind, if possible.
9153 TemplateNameKind &TNK,
9154 SourceLocation NameLoc,
9155 IdentifierInfo *&II);
9156
9158 SourceLocation NameLoc,
9159 bool Diagnose = true);
9160
9161 /// Determine whether a particular identifier might be the name in a C++1z
9162 /// deduction-guide declaration.
9163 bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name,
9164 SourceLocation NameLoc, CXXScopeSpec &SS,
9165 ParsedTemplateTy *Template = nullptr);
9166
9168 SourceLocation IILoc, Scope *S,
9169 const CXXScopeSpec *SS,
9170 TemplateTy &SuggestedTemplate,
9171 TemplateNameKind &SuggestedKind);
9172
9173 bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
9174 NamedDecl *Instantiation,
9175 bool InstantiatedFromMember,
9176 const NamedDecl *Pattern,
9177 const NamedDecl *PatternDef,
9179 bool Complain = true);
9180
9181 /// DiagnoseTemplateParameterShadow - Produce a diagnostic complaining
9182 /// that the template parameter 'PrevDecl' is being shadowed by a new
9183 /// declaration at location Loc. Returns true to indicate that this is
9184 /// an error, and false otherwise.
9185 ///
9186 /// \param Loc The location of the declaration that shadows a template
9187 /// parameter.
9188 ///
9189 /// \param PrevDecl The template parameter that the declaration shadows.
9190 ///
9191 /// \param SupportedForCompatibility Whether to issue the diagnostic as
9192 /// a warning for compatibility with older versions of clang.
9193 /// Ignored when MSVC compatibility is enabled.
9195 bool SupportedForCompatibility = false);
9197
9199 SourceLocation EllipsisLoc,
9200 SourceLocation KeyLoc,
9201 IdentifierInfo *ParamName,
9202 SourceLocation ParamNameLoc, unsigned Depth,
9203 unsigned Position, SourceLocation EqualLoc,
9204 ParsedType DefaultArg, bool HasTypeConstraint);
9205
9207
9208 bool ActOnTypeConstraint(const CXXScopeSpec &SS,
9210 TemplateTypeParmDecl *ConstrainedParameter,
9211 SourceLocation EllipsisLoc);
9212 bool BuildTypeConstraint(const CXXScopeSpec &SS,
9214 TemplateTypeParmDecl *ConstrainedParameter,
9215 SourceLocation EllipsisLoc,
9216 bool AllowUnexpandedPack);
9217
9219 DeclarationNameInfo NameInfo,
9220 ConceptDecl *NamedConcept, NamedDecl *FoundDecl,
9221 const TemplateArgumentListInfo *TemplateArgs,
9222 TemplateTypeParmDecl *ConstrainedParameter,
9223 SourceLocation EllipsisLoc);
9224
9226 NonTypeTemplateParmDecl *NewConstrainedParm,
9227 NonTypeTemplateParmDecl *OrigConstrainedParm,
9228 SourceLocation EllipsisLoc);
9229
9231
9233 SourceLocation Loc);
9235
9237 unsigned Depth, unsigned Position,
9238 SourceLocation EqualLoc,
9239 Expr *DefaultArg);
9241 Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params,
9242 SourceLocation EllipsisLoc, IdentifierInfo *ParamName,
9243 SourceLocation ParamNameLoc, unsigned Depth, unsigned Position,
9244 SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg);
9245
9247 unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc,
9248 SourceLocation LAngleLoc, ArrayRef<NamedDecl *> Params,
9249 SourceLocation RAngleLoc, Expr *RequiresClause);
9250
9251 /// The context in which we are checking a template parameter list.
9262
9264 TemplateParameterList *OldParams,
9266 SkipBodyInfo *SkipBody = nullptr);
9268 SourceLocation DeclStartLoc, SourceLocation DeclLoc,
9269 const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
9270 ArrayRef<TemplateParameterList *> ParamLists, bool IsFriend,
9271 bool &IsMemberSpecialization, bool &Invalid,
9272 bool SuppressDiagnostic = false);
9273
9275 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
9276 CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
9277 const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
9278 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
9279 SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists,
9280 TemplateParameterList **OuterTemplateParamLists,
9281 SkipBodyInfo *SkipBody = nullptr);
9282
9285
9287
9289
9291 SourceLocation TemplateLoc,
9292 TemplateArgumentListInfo &TemplateArgs);
9293
9296 TemplateTy Template, IdentifierInfo *TemplateII,
9297 SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
9298 ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc,
9299 bool IsCtorOrDtorName = false, bool IsClassName = false,
9300 ImplicitTypenameContext AllowImplicitTypename =
9302
9303 /// Parsed an elaborated-type-specifier that refers to a template-id,
9304 /// such as \c class T::template apply<U>.
9306 TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc,
9307 CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD,
9308 SourceLocation TemplateLoc, SourceLocation LAngleLoc,
9309 ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc);
9310
9313 SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
9315
9316 /// Get the specialization of the given variable template corresponding to
9317 /// the specified argument list, or a null-but-valid result if the arguments
9318 /// are dependent.
9320 SourceLocation TemplateLoc,
9321 SourceLocation TemplateNameLoc,
9322 const TemplateArgumentListInfo &TemplateArgs);
9323
9324 /// Form a reference to the specialization of the given variable template
9325 /// corresponding to the specified argument list, or a null-but-valid result
9326 /// if the arguments are dependent.
9328 const DeclarationNameInfo &NameInfo,
9329 VarTemplateDecl *Template, NamedDecl *FoundD,
9330 SourceLocation TemplateLoc,
9331 const TemplateArgumentListInfo *TemplateArgs);
9332
9334 CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
9335 const DeclarationNameInfo &ConceptNameInfo,
9336 NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
9337 const TemplateArgumentListInfo *TemplateArgs);
9338
9340
9342 SourceLocation TemplateKWLoc, LookupResult &R,
9343 bool RequiresADL,
9344 const TemplateArgumentListInfo *TemplateArgs);
9345
9348 const DeclarationNameInfo &NameInfo,
9349 const TemplateArgumentListInfo *TemplateArgs);
9350
9352 SourceLocation TemplateKWLoc,
9353 const UnqualifiedId &Name,
9354 ParsedType ObjectType,
9355 bool EnteringContext, TemplateTy &Template,
9356 bool AllowInjectedClassName = false);
9357
9359 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
9360 SourceLocation ModulePrivateLoc, CXXScopeSpec &SS,
9362 MultiTemplateParamsArg TemplateParameterLists,
9363 SkipBodyInfo *SkipBody = nullptr);
9364
9366 TemplateDecl *PrimaryTemplate,
9367 unsigned NumExplicitArgs,
9373
9375 MultiTemplateParamsArg TemplateParameterLists,
9376 Declarator &D);
9377
9379 SourceLocation NewLoc,
9380 TemplateSpecializationKind ActOnExplicitInstantiationNewTSK,
9381 NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK,
9382 SourceLocation PrevPtOfInstantiation, bool &SuppressNew);
9383
9385 FunctionDecl *FD, const TemplateArgumentListInfo *ExplicitTemplateArgs,
9387
9389 FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
9390 LookupResult &Previous, bool QualifiedFriend = false);
9393
9395 Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
9396 unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS,
9397 TemplateTy Template, SourceLocation TemplateNameLoc,
9398 SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
9399 SourceLocation RAngleLoc, const ParsedAttributesView &Attr);
9400
9402 SourceLocation TemplateLoc,
9403 unsigned TagSpec, SourceLocation KWLoc,
9404 CXXScopeSpec &SS, IdentifierInfo *Name,
9405 SourceLocation NameLoc,
9406 const ParsedAttributesView &Attr);
9407
9409 SourceLocation TemplateLoc,
9410 Declarator &D);
9411
9413 TemplateDecl *Template, SourceLocation TemplateLoc,
9414 SourceLocation RAngleLoc, Decl *Param,
9415 ArrayRef<TemplateArgument> SugaredConverted,
9416 ArrayRef<TemplateArgument> CanonicalConverted, bool &HasDefaultArg);
9417
9419
9420 /// Specifies the context in which a particular template
9421 /// argument is being checked.
9423 /// The template argument was specified in the code or was
9424 /// instantiated with some deduced template arguments.
9426
9427 /// The template argument was deduced via template argument
9428 /// deduction.
9430
9431 /// The template argument was deduced from an array bound
9432 /// via template argument deduction.
9435
9436 bool
9438 NamedDecl *Template, SourceLocation TemplateLoc,
9439 SourceLocation RAngleLoc, unsigned ArgumentPackIndex,
9440 SmallVectorImpl<TemplateArgument> &SugaredConverted,
9441 SmallVectorImpl<TemplateArgument> &CanonicalConverted,
9443
9444 /// Check that the given template arguments can be provided to
9445 /// the given template, converting the arguments along the way.
9446 ///
9447 /// \param Template The template to which the template arguments are being
9448 /// provided.
9449 ///
9450 /// \param TemplateLoc The location of the template name in the source.
9451 ///
9452 /// \param TemplateArgs The list of template arguments. If the template is
9453 /// a template template parameter, this function may extend the set of
9454 /// template arguments to also include substituted, defaulted template
9455 /// arguments.
9456 ///
9457 /// \param PartialTemplateArgs True if the list of template arguments is
9458 /// intentionally partial, e.g., because we're checking just the initial
9459 /// set of template arguments.
9460 ///
9461 /// \param Converted Will receive the converted, canonicalized template
9462 /// arguments.
9463 ///
9464 /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
9465 /// contain the converted forms of the template arguments as written.
9466 /// Otherwise, \p TemplateArgs will not be modified.
9467 ///
9468 /// \param ConstraintsNotSatisfied If provided, and an error occurred, will
9469 /// receive true if the cause for the error is the associated constraints of
9470 /// the template not being satisfied by the template arguments.
9471 ///
9472 /// \returns true if an error occurred, false otherwise.
9474 TemplateDecl *Template, SourceLocation TemplateLoc,
9475 TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs,
9476 SmallVectorImpl<TemplateArgument> &SugaredConverted,
9477 SmallVectorImpl<TemplateArgument> &CanonicalConverted,
9478 bool UpdateArgsWithConversions = true,
9479 bool *ConstraintsNotSatisfied = nullptr);
9480
9483 SmallVectorImpl<TemplateArgument> &SugaredConverted,
9484 SmallVectorImpl<TemplateArgument> &CanonicalConverted);
9485
9488 QualType InstantiatedParamType, Expr *Arg,
9489 TemplateArgument &SugaredConverted,
9490 TemplateArgument &CanonicalConverted,
9493 TemplateParameterList *Params,
9494 TemplateArgumentLoc &Arg);
9495
9497 std::optional<SourceRange> ParamRange = {});
9498 void NoteTemplateParameterLocation(const NamedDecl &Decl);
9499
9501 const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc);
9503 BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg,
9504 SourceLocation Loc);
9505
9506 /// Enumeration describing how template parameter lists are compared
9507 /// for equality.
9509 /// We are matching the template parameter lists of two templates
9510 /// that might be redeclarations.
9511 ///
9512 /// \code
9513 /// template<typename T> struct X;
9514 /// template<typename T> struct X;
9515 /// \endcode
9517
9518 /// We are matching the template parameter lists of two template
9519 /// template parameters as part of matching the template parameter lists
9520 /// of two templates that might be redeclarations.
9521 ///
9522 /// \code
9523 /// template<template<int I> class TT> struct X;
9524 /// template<template<int Value> class Other> struct X;
9525 /// \endcode
9527
9528 /// We are matching the template parameter lists of a template
9529 /// template argument against the template parameter lists of a template
9530 /// template parameter.
9531 ///
9532 /// \code
9533 /// template<template<int Value> class Metafun> struct X;
9534 /// template<int Value> struct integer_c;
9535 /// X<integer_c> xic;
9536 /// \endcode
9538
9539 /// We are determining whether the template-parameters are equivalent
9540 /// according to C++ [temp.over.link]/6. This comparison does not consider
9541 /// constraints.
9542 ///
9543 /// \code
9544 /// template<C1 T> void f(T);
9545 /// template<C2 T> void f(T);
9546 /// \endcode
9548 };
9549
9550 // A struct to represent the 'new' declaration, which is either itself just
9551 // the named decl, or the important information we need about it in order to
9552 // do constraint comparisons.
9554 const NamedDecl *ND = nullptr;
9555 const DeclContext *DC = nullptr;
9556 const DeclContext *LexicalDC = nullptr;
9557 SourceLocation Loc;
9558
9559 public:
9562 const DeclContext *LexicalDeclCtx,
9563 SourceLocation Loc)
9564
9565 : DC(DeclCtx), LexicalDC(LexicalDeclCtx), Loc(Loc) {
9566 assert(DC && LexicalDC &&
9567 "Constructor only for cases where we have the information to put "
9568 "in here");
9569 }
9570
9571 // If this was constructed with no information, we cannot do substitution
9572 // for constraint comparison, so make sure we can check that.
9573 bool isInvalid() const { return !ND && !DC; }
9574
9575 const NamedDecl *getDecl() const { return ND; }
9576
9577 bool ContainsDecl(const NamedDecl *ND) const { return this->ND == ND; }
9578
9580 return ND ? ND->getLexicalDeclContext() : LexicalDC;
9581 }
9582
9584 return ND ? ND->getDeclContext() : DC;
9585 }
9586
9587 SourceLocation getLocation() const { return ND ? ND->getLocation() : Loc; }
9588 };
9589
9591 const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New,
9592 const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain,
9594 SourceLocation TemplateArgLoc = SourceLocation());
9595
9597 TemplateParameterList *New, TemplateParameterList *Old, bool Complain,
9599 SourceLocation TemplateArgLoc = SourceLocation()) {
9600 return TemplateParameterListsAreEqual(nullptr, New, nullptr, Old, Complain,
9601 Kind, TemplateArgLoc);
9602 }
9603
9604 bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
9605
9606 /// Called when the parser has parsed a C++ typename
9607 /// specifier, e.g., "typename T::type".
9608 ///
9609 /// \param S The scope in which this typename type occurs.
9610 /// \param TypenameLoc the location of the 'typename' keyword
9611 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
9612 /// \param II the identifier we're retrieving (e.g., 'type' in the example).
9613 /// \param IdLoc the location of the identifier.
9614 /// \param IsImplicitTypename context where T::type refers to a type.
9616 Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS,
9617 const IdentifierInfo &II, SourceLocation IdLoc,
9619
9620 /// Called when the parser has parsed a C++ typename
9621 /// specifier that ends in a template-id, e.g.,
9622 /// "typename MetaFun::template apply<T1, T2>".
9623 ///
9624 /// \param S The scope in which this typename type occurs.
9625 /// \param TypenameLoc the location of the 'typename' keyword
9626 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
9627 /// \param TemplateLoc the location of the 'template' keyword, if any.
9628 /// \param TemplateName The template name.
9629 /// \param TemplateII The identifier used to name the template.
9630 /// \param TemplateIILoc The location of the template name.
9631 /// \param LAngleLoc The location of the opening angle bracket ('<').
9632 /// \param TemplateArgs The template arguments.
9633 /// \param RAngleLoc The location of the closing angle bracket ('>').
9635 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
9636 const CXXScopeSpec &SS, SourceLocation TemplateLoc,
9638 SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
9639 ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc);
9640
9642 SourceLocation KeywordLoc,
9643 NestedNameSpecifierLoc QualifierLoc,
9644 const IdentifierInfo &II, SourceLocation IILoc,
9645 TypeSourceInfo **TSI, bool DeducedTSTContext);
9646
9648 SourceLocation KeywordLoc,
9649 NestedNameSpecifierLoc QualifierLoc,
9650 const IdentifierInfo &II, SourceLocation IILoc,
9651 bool DeducedTSTContext = true);
9652
9654 SourceLocation Loc,
9655 DeclarationName Name);
9657
9659 bool
9661
9662 std::string
9664 const TemplateArgumentList &Args);
9665
9666 std::string
9668 const TemplateArgument *Args,
9669 unsigned NumArgs);
9670
9674
9676 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
9677 const DeclarationNameInfo &NameInfo, bool isAddressOfOperand,
9678 const TemplateArgumentListInfo *TemplateArgs);
9679
9682 SourceLocation TemplateKWLoc,
9683 const DeclarationNameInfo &NameInfo,
9684 const TemplateArgumentListInfo *TemplateArgs);
9685
9686 // Calculates whether the expression Constraint depends on an enclosing
9687 // template, for the purposes of [temp.friend] p9.
9688 // TemplateDepth is the 'depth' of the friend function, which is used to
9689 // compare whether a declaration reference is referring to a containing
9690 // template, or just the current friend function. A 'lower' TemplateDepth in
9691 // the AST refers to a 'containing' template. As the constraint is
9692 // uninstantiated, this is relative to the 'top' of the TU.
9693 bool
9695 unsigned TemplateDepth,
9696 const Expr *Constraint);
9697
9698 /// Declare implicit deduction guides for a class template if we've
9699 /// not already done so.
9701 SourceLocation Loc);
9703 TemplateDecl *Template, MutableArrayRef<QualType> ParamTypes,
9704 SourceLocation Loc);
9705
9706 /// Find the failed Boolean condition within a given Boolean
9707 /// constant expression, and describe it with a string.
9708 std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond);
9709
9711
9713 MultiTemplateParamsArg TemplateParameterLists,
9714 IdentifierInfo *Name, SourceLocation NameLoc,
9715 Expr *ConstraintExpr);
9716
9718 bool &AddToScope);
9719
9720 TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
9721 const CXXScopeSpec &SS, IdentifierInfo *Name,
9722 SourceLocation TagLoc, SourceLocation NameLoc);
9723
9725 CachedTokens &Toks);
9728
9729 /// We've found a use of a templated declaration that would trigger an
9730 /// implicit instantiation. Check that any relevant explicit specializations
9731 /// and partial specializations are visible/reachable, and diagnose if not.
9734
9735 ///@}
9736
9737 //
9738 //
9739 // -------------------------------------------------------------------------
9740 //
9741 //
9742
9743 /// \name C++ Template Argument Deduction
9744 /// Implementations are in SemaTemplateDeduction.cpp
9745 ///@{
9746
9747public:
9748 /// When true, access checking violations are treated as SFINAE
9749 /// failures rather than hard errors.
9751
9752 /// RAII class used to determine whether SFINAE has
9753 /// trapped any errors that occur during template argument
9754 /// deduction.
9756 Sema &SemaRef;
9757 unsigned PrevSFINAEErrors;
9758 bool PrevInNonInstantiationSFINAEContext;
9759 bool PrevAccessCheckingSFINAE;
9760 bool PrevLastDiagnosticIgnored;
9761
9762 public:
9763 explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
9764 : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
9765 PrevInNonInstantiationSFINAEContext(
9766 SemaRef.InNonInstantiationSFINAEContext),
9767 PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
9768 PrevLastDiagnosticIgnored(
9769 SemaRef.getDiagnostics().isLastDiagnosticIgnored()) {
9770 if (!SemaRef.isSFINAEContext())
9771 SemaRef.InNonInstantiationSFINAEContext = true;
9772 SemaRef.AccessCheckingSFINAE = AccessCheckingSFINAE;
9773 }
9774
9776 SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
9778 PrevInNonInstantiationSFINAEContext;
9779 SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
9781 PrevLastDiagnosticIgnored);
9782 }
9783
9784 /// Determine whether any SFINAE errors have been trapped.
9785 bool hasErrorOccurred() const {
9786 return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
9787 }
9788 };
9789
9790 /// RAII class used to indicate that we are performing provisional
9791 /// semantic analysis to determine the validity of a construct, so
9792 /// typo-correction and diagnostics in the immediate context (not within
9793 /// implicitly-instantiated templates) should be suppressed.
9795 Sema &SemaRef;
9796 // FIXME: Using a SFINAETrap for this is a hack.
9797 SFINAETrap Trap;
9798 bool PrevDisableTypoCorrection;
9799
9800 public:
9801 explicit TentativeAnalysisScope(Sema &SemaRef)
9802 : SemaRef(SemaRef), Trap(SemaRef, true),
9803 PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
9804 SemaRef.DisableTypoCorrection = true;
9805 }
9807 SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
9808 }
9809 };
9810
9811 /// For each declaration that involved template argument deduction, the
9812 /// set of diagnostics that were suppressed during that template argument
9813 /// deduction.
9814 ///
9815 /// FIXME: Serialize this structure to the AST file.
9816 typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1>>
9819
9821
9823 QualType NTTPType,
9824 SourceLocation Loc);
9825
9826 /// Get a template argument mapping the given template parameter to itself,
9827 /// e.g. for X in \c template<int X>, this would return an expression template
9828 /// argument referencing X.
9830 SourceLocation Location);
9831
9832 /// Adjust the type \p ArgFunctionType to match the calling convention,
9833 /// noreturn, and optionally the exception specification of \p FunctionType.
9834 /// Deduction often wants to ignore these properties when matching function
9835 /// types.
9837 bool AdjustExceptionSpec = false);
9838
9841 ArrayRef<TemplateArgument> TemplateArgs,
9843
9846 ArrayRef<TemplateArgument> TemplateArgs,
9848
9853 bool NumberOfArgumentsMustMatch);
9854
9857 TemplateArgumentListInfo &ExplicitTemplateArgs,
9861
9862 /// brief A function argument from which we performed template argument
9863 // deduction for a call.
9865 OriginalCallArg(QualType OriginalParamType, bool DecomposedParam,
9866 unsigned ArgIdx, QualType OriginalArgType)
9867 : OriginalParamType(OriginalParamType),
9868 DecomposedParam(DecomposedParam), ArgIdx(ArgIdx),
9869 OriginalArgType(OriginalArgType) {}
9870
9873 unsigned ArgIdx;
9875 };
9876
9880 unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
9882 SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
9883 bool PartialOverloading = false,
9884 llvm::function_ref<bool()> CheckNonDependent = [] { return false; });
9885
9888 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
9890 bool PartialOverloading, bool AggregateDeductionCandidate,
9891 QualType ObjectType, Expr::Classification ObjectClassification,
9892 llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
9893
9896 TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ArgFunctionType,
9898 bool IsAddressOfFunction = false);
9899
9902 Expr::Classification ObjectClassification, QualType ToType,
9904
9907 TemplateArgumentListInfo *ExplicitTemplateArgs,
9910 bool IsAddressOfFunction = false);
9911
9912 /// Substitute Replacement for \p auto in \p TypeWithAuto
9913 QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
9914 /// Substitute Replacement for auto in TypeWithAuto
9916 QualType Replacement);
9917
9918 // Substitute auto in TypeWithAuto for a Dependent auto type
9920
9921 // Substitute auto in TypeWithAuto for a Dependent auto type
9924
9925 /// Completely replace the \c auto in \p TypeWithAuto by
9926 /// \p Replacement. This does not retain any \c auto type sugar.
9927 QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
9929 QualType Replacement);
9930
9934 bool DependentDeduction = false,
9935 bool IgnoreConstraints = false,
9936 TemplateSpecCandidateSet *FailedTSC = nullptr);
9939 bool Diagnose = true);
9940
9942 SourceLocation Loc);
9943
9948
9951
9955
9958
9961
9962 void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
9963 unsigned Depth, llvm::SmallBitVector &Used);
9964
9965 void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
9966 bool OnlyDeduced, unsigned Depth,
9967 llvm::SmallBitVector &Used);
9968 void
9970 llvm::SmallBitVector &Deduced) {
9972 }
9973 static void
9976 llvm::SmallBitVector &Deduced);
9977
9980 TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
9981 QualType RawObj1Ty = {}, QualType RawObj2Ty = {}, bool Reversed = false);
9982
9983 UnresolvedSetIterator
9984 getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd,
9985 TemplateSpecCandidateSet &FailedCandidates,
9986 SourceLocation Loc, const PartialDiagnostic &NoneDiag,
9987 const PartialDiagnostic &AmbigDiag,
9988 const PartialDiagnostic &CandidateDiag,
9989 bool Complain = true, QualType TargetType = QualType());
9990
9991 ///@}
9992
9993 //
9994 //
9995 // -------------------------------------------------------------------------
9996 //
9997 //
9998
9999 /// \name C++ Template Instantiation
10000 /// Implementations are in SemaTemplateInstantiate.cpp
10001 ///@{
10002
10003public:
10004 /// A helper class for building up ExtParameterInfos.
10007 bool HasInteresting = false;
10008
10009 public:
10010 /// Set the ExtParameterInfo for the parameter at the given index,
10011 ///
10012 void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
10013 assert(Infos.size() <= index);
10014 Infos.resize(index);
10015 Infos.push_back(info);
10016
10017 if (!HasInteresting)
10018 HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
10019 }
10020
10021 /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
10022 /// ExtParameterInfo array we've built up.
10024 getPointerOrNull(unsigned numParams) {
10025 if (!HasInteresting)
10026 return nullptr;
10027 Infos.resize(numParams);
10028 return Infos.data();
10029 }
10030 };
10031
10032 /// The current instantiation scope used to store local
10033 /// variables.
10035
10036 typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
10038
10039 /// A mapping from parameters with unparsed default arguments to the
10040 /// set of instantiations of each parameter.
10041 ///
10042 /// This mapping is a temporary data structure used when parsing
10043 /// nested class templates or nested classes of class templates,
10044 /// where we might end up instantiating an inner class before the
10045 /// default arguments of its methods have been parsed.
10047
10048 /// A context in which code is being synthesized (where a source location
10049 /// alone is not sufficient to identify the context). This covers template
10050 /// instantiation and various forms of implicitly-generated functions.
10052 /// The kind of template instantiation we are performing
10054 /// We are instantiating a template declaration. The entity is
10055 /// the declaration we're instantiating (e.g., a CXXRecordDecl).
10057
10058 /// We are instantiating a default argument for a template
10059 /// parameter. The Entity is the template parameter whose argument is
10060 /// being instantiated, the Template is the template, and the
10061 /// TemplateArgs/NumTemplateArguments provide the template arguments as
10062 /// specified.
10064
10065 /// We are instantiating a default argument for a function.
10066 /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
10067 /// provides the template arguments as specified.
10069
10070 /// We are substituting explicit template arguments provided for
10071 /// a function template. The entity is a FunctionTemplateDecl.
10073
10074 /// We are substituting template argument determined as part of
10075 /// template argument deduction for either a class template
10076 /// partial specialization or a function template. The
10077 /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
10078 /// a TemplateDecl.
10080
10081 /// We are substituting into a lambda expression.
10083
10084 /// We are substituting prior template arguments into a new
10085 /// template parameter. The template parameter itself is either a
10086 /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
10088
10089 /// We are checking the validity of a default template argument that
10090 /// has been used when naming a template-id.
10092
10093 /// We are computing the exception specification for a defaulted special
10094 /// member function.
10096
10097 /// We are instantiating the exception specification for a function
10098 /// template which was deferred until it was needed.
10100
10101 /// We are instantiating a requirement of a requires expression.
10103
10104 /// We are checking the satisfaction of a nested requirement of a requires
10105 /// expression.
10107
10108 /// We are declaring an implicit special member function.
10110
10111 /// We are declaring an implicit 'operator==' for a defaulted
10112 /// 'operator<=>'.
10114
10115 /// We are defining a synthesized function (such as a defaulted special
10116 /// member).
10118
10119 // We are checking the constraints associated with a constrained entity or
10120 // the constraint expression of a concept. This includes the checks that
10121 // atomic constraints have the type 'bool' and that they can be constant
10122 // evaluated.
10124
10125 // We are substituting template arguments into a constraint expression.
10127
10128 // We are normalizing a constraint expression.
10130
10131 // Instantiating a Requires Expression parameter clause.
10133
10134 // We are substituting into the parameter mapping of an atomic constraint
10135 // during normalization.
10137
10138 /// We are rewriting a comparison operator in terms of an operator<=>.
10140
10141 /// We are initializing a structured binding.
10143
10144 /// We are marking a class as __dllexport.
10146
10147 /// We are building an implied call from __builtin_dump_struct. The
10148 /// arguments are in CallArgs.
10150
10151 /// Added for Template instantiation observation.
10152 /// Memoization means we are _not_ instantiating a template because
10153 /// it is already instantiated (but we entered a context where we
10154 /// would have had to if it was not already instantiated).
10156
10157 /// We are building deduction guides for a class.
10159 } Kind;
10160
10161 /// Was the enclosing context a non-instantiation SFINAE context?
10163
10164 /// The point of instantiation or synthesis within the source code.
10166
10167 /// The entity that is being synthesized.
10169
10170 /// The template (or partial specialization) in which we are
10171 /// performing the instantiation, for substitutions of prior template
10172 /// arguments.
10174
10175 union {
10176 /// The list of template arguments we are substituting, if they
10177 /// are not part of the entity.
10179
10180 /// The list of argument expressions in a synthesized call.
10181 const Expr *const *CallArgs;
10182 };
10183
10184 // FIXME: Wrap this union around more members, or perhaps store the
10185 // kind-specific members in the RAII object owning the context.
10186 union {
10187 /// The number of template arguments in TemplateArgs.
10189
10190 /// The number of expressions in CallArgs.
10191 unsigned NumCallArgs;
10192
10193 /// The special member being declared or defined.
10195 };
10196
10198 assert(Kind != DeclaringSpecialMember);
10199 return {TemplateArgs, NumTemplateArgs};
10200 }
10201
10202 /// The template deduction info object associated with the
10203 /// substitution or checking of explicit or deduced template arguments.
10205
10206 /// The source range that covers the construct that cause
10207 /// the instantiation, e.g., the template-id that causes a class
10208 /// template instantiation.
10210
10212 : Kind(TemplateInstantiation),
10213 SavedInNonInstantiationSFINAEContext(false), Entity(nullptr),
10214 Template(nullptr), TemplateArgs(nullptr), NumTemplateArgs(0),
10215 DeductionInfo(nullptr) {}
10216
10217 /// Determines whether this template is an actual instantiation
10218 /// that should be counted toward the maximum instantiation depth.
10219 bool isInstantiationRecord() const;
10220 };
10221
10222 /// A stack object to be created when performing template
10223 /// instantiation.
10224 ///
10225 /// Construction of an object of type \c InstantiatingTemplate
10226 /// pushes the current instantiation onto the stack of active
10227 /// instantiations. If the size of this stack exceeds the maximum
10228 /// number of recursive template instantiations, construction
10229 /// produces an error and evaluates true.
10230 ///
10231 /// Destruction of this object will pop the named instantiation off
10232 /// the stack.
10234 /// Note that we are instantiating a class template,
10235 /// function template, variable template, alias template,
10236 /// or a member thereof.
10237 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10238 Decl *Entity,
10239 SourceRange InstantiationRange = SourceRange());
10240
10242 /// Note that we are instantiating an exception specification
10243 /// of a function template.
10244 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10246 SourceRange InstantiationRange = SourceRange());
10247
10248 /// Note that we are instantiating a default argument in a
10249 /// template-id.
10250 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10251 TemplateParameter Param, TemplateDecl *Template,
10252 ArrayRef<TemplateArgument> TemplateArgs,
10253 SourceRange InstantiationRange = SourceRange());
10254
10255 /// Note that we are substituting either explicitly-specified or
10256 /// deduced template arguments during function template argument deduction.
10257 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10258 FunctionTemplateDecl *FunctionTemplate,
10259 ArrayRef<TemplateArgument> TemplateArgs,
10261 sema::TemplateDeductionInfo &DeductionInfo,
10262 SourceRange InstantiationRange = SourceRange());
10263
10264 /// Note that we are instantiating as part of template
10265 /// argument deduction for a class template declaration.
10266 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10267 TemplateDecl *Template,
10268 ArrayRef<TemplateArgument> TemplateArgs,
10269 sema::TemplateDeductionInfo &DeductionInfo,
10270 SourceRange InstantiationRange = SourceRange());
10271
10272 /// Note that we are instantiating as part of template
10273 /// argument deduction for a class template partial
10274 /// specialization.
10275 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10277 ArrayRef<TemplateArgument> TemplateArgs,
10278 sema::TemplateDeductionInfo &DeductionInfo,
10279 SourceRange InstantiationRange = SourceRange());
10280
10281 /// Note that we are instantiating as part of template
10282 /// argument deduction for a variable template partial
10283 /// specialization.
10284 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10286 ArrayRef<TemplateArgument> TemplateArgs,
10287 sema::TemplateDeductionInfo &DeductionInfo,
10288 SourceRange InstantiationRange = SourceRange());
10289
10290 /// Note that we are instantiating a default argument for a function
10291 /// parameter.
10292 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10293 ParmVarDecl *Param,
10294 ArrayRef<TemplateArgument> TemplateArgs,
10295 SourceRange InstantiationRange = SourceRange());
10296
10297 /// Note that we are substituting prior template arguments into a
10298 /// non-type parameter.
10299 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10300 NamedDecl *Template, NonTypeTemplateParmDecl *Param,
10301 ArrayRef<TemplateArgument> TemplateArgs,
10302 SourceRange InstantiationRange);
10303
10304 /// Note that we are substituting prior template arguments into a
10305 /// template template parameter.
10306 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10307 NamedDecl *Template, TemplateTemplateParmDecl *Param,
10308 ArrayRef<TemplateArgument> TemplateArgs,
10309 SourceRange InstantiationRange);
10310
10311 /// Note that we are checking the default template argument
10312 /// against the template parameter for a given template-id.
10313 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10314 TemplateDecl *Template, NamedDecl *Param,
10315 ArrayRef<TemplateArgument> TemplateArgs,
10316 SourceRange InstantiationRange);
10317
10319 /// \brief Note that we are checking the constraints associated with some
10320 /// constrained entity (a concept declaration or a template with associated
10321 /// constraints).
10322 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10323 ConstraintsCheck, NamedDecl *Template,
10324 ArrayRef<TemplateArgument> TemplateArgs,
10325 SourceRange InstantiationRange);
10326
10328 /// \brief Note that we are checking a constraint expression associated
10329 /// with a template declaration or as part of the satisfaction check of a
10330 /// concept.
10331 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10333 sema::TemplateDeductionInfo &DeductionInfo,
10334 SourceRange InstantiationRange);
10335
10337 /// \brief Note that we are normalizing a constraint expression.
10338 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10340 SourceRange InstantiationRange);
10341
10343 /// \brief Note that we are subtituting into the parameter mapping of an
10344 /// atomic constraint during constraint normalization.
10345 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10347 SourceRange InstantiationRange);
10348
10349 /// \brief Note that we are substituting template arguments into a part of
10350 /// a requirement of a requires expression.
10351 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10353 sema::TemplateDeductionInfo &DeductionInfo,
10354 SourceRange InstantiationRange = SourceRange());
10355
10356 /// \brief Note that we are checking the satisfaction of the constraint
10357 /// expression inside of a nested requirement.
10358 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10360 SourceRange InstantiationRange = SourceRange());
10361
10362 /// \brief Note that we are checking a requires clause.
10363 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10364 const RequiresExpr *E,
10365 sema::TemplateDeductionInfo &DeductionInfo,
10366 SourceRange InstantiationRange);
10367
10369 /// \brief Note that we are building deduction guides.
10370 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10372 SourceRange InstantiationRange = SourceRange());
10373
10374 /// Note that we have finished instantiating this template.
10375 void Clear();
10376
10378
10379 /// Determines whether we have exceeded the maximum
10380 /// recursive template instantiations.
10381 bool isInvalid() const { return Invalid; }
10382
10383 /// Determine whether we are already instantiating this
10384 /// specialization in some surrounding active instantiation.
10385 bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
10386
10387 private:
10388 Sema &SemaRef;
10389 bool Invalid;
10390 bool AlreadyInstantiating;
10391 bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
10392 SourceRange InstantiationRange);
10393
10396 SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
10397 Decl *Entity, NamedDecl *Template = nullptr,
10398 ArrayRef<TemplateArgument> TemplateArgs = std::nullopt,
10399 sema::TemplateDeductionInfo *DeductionInfo = nullptr);
10400
10402
10403 InstantiatingTemplate &operator=(const InstantiatingTemplate &) = delete;
10404 };
10405
10407 const MultiLevelTemplateArgumentList &TemplateArgs,
10408 TemplateArgumentLoc &Output);
10409 bool
10411 const MultiLevelTemplateArgumentList &TemplateArgs,
10412 TemplateArgumentListInfo &Outputs);
10413
10415 const NamedDecl *D, const DeclContext *DC = nullptr, bool Final = false,
10416 std::optional<ArrayRef<TemplateArgument>> Innermost = std::nullopt,
10417 bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr,
10418 bool ForConstraintInstantiation = false,
10419 bool SkipForSpecialization = false);
10420
10421 /// RAII object to handle the state changes required to synthesize
10422 /// a function body.
10424 Sema &S;
10425 Sema::ContextRAII SavedContext;
10426 bool PushedCodeSynthesisContext = false;
10427
10428 public:
10430 : S(S), SavedContext(S, DC) {
10431 auto *FD = dyn_cast<FunctionDecl>(DC);
10432 S.PushFunctionScope();
10433 S.PushExpressionEvaluationContext(
10434 (FD && FD->isConsteval())
10435 ? ExpressionEvaluationContext::ImmediateFunctionContext
10436 : ExpressionEvaluationContext::PotentiallyEvaluated);
10437 if (FD) {
10438 FD->setWillHaveBody(true);
10439 S.ExprEvalContexts.back().InImmediateFunctionContext =
10440 FD->isImmediateFunction() ||
10441 S.ExprEvalContexts[S.ExprEvalContexts.size() - 2]
10442 .isConstantEvaluated();
10443 S.ExprEvalContexts.back().InImmediateEscalatingFunctionContext =
10444 S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
10445 } else
10446 assert(isa<ObjCMethodDecl>(DC));
10447 }
10448
10450 assert(!PushedCodeSynthesisContext);
10451
10453 Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction;
10454 Ctx.PointOfInstantiation = UseLoc;
10455 Ctx.Entity = cast<Decl>(S.CurContext);
10456 S.pushCodeSynthesisContext(Ctx);
10457
10458 PushedCodeSynthesisContext = true;
10459 }
10460
10462 if (PushedCodeSynthesisContext)
10463 S.popCodeSynthesisContext();
10464 if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext)) {
10465 FD->setWillHaveBody(false);
10466 S.CheckImmediateEscalatingFunctionDefinition(FD, S.getCurFunction());
10467 }
10468 S.PopExpressionEvaluationContext();
10469 S.PopFunctionScopeInfo();
10470 }
10471 };
10472
10473 /// List of active code synthesis contexts.
10474 ///
10475 /// This vector is treated as a stack. As synthesis of one entity requires
10476 /// synthesis of another, additional contexts are pushed onto the stack.
10478
10479 /// Specializations whose definitions are currently being instantiated.
10481
10482 /// Non-dependent types used in templates that have already been instantiated
10483 /// by some template instantiation.
10485
10486 /// Extra modules inspected when performing a lookup during a template
10487 /// instantiation. Computed lazily.
10489
10490 /// Cache of additional modules that should be used for name lookup
10491 /// within the current template instantiation. Computed lazily; use
10492 /// getLookupModules() to get a complete set.
10494
10495 /// Map from the most recent declaration of a namespace to the most
10496 /// recent visible declaration of that namespace.
10497 llvm::DenseMap<NamedDecl *, NamedDecl *> VisibleNamespaceCache;
10498
10499 /// Whether we are in a SFINAE context that is not associated with
10500 /// template instantiation.
10501 ///
10502 /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
10503 /// of a template instantiation or template argument deduction.
10505
10506 /// The number of \p CodeSynthesisContexts that are not template
10507 /// instantiations and, therefore, should not be counted as part of the
10508 /// instantiation depth.
10509 ///
10510 /// When the instantiation depth reaches the user-configurable limit
10511 /// \p LangOptions::InstantiationDepth we will abort instantiation.
10512 // FIXME: Should we have a similar limit for other forms of synthesis?
10514
10515 /// The depth of the context stack at the point when the most recent
10516 /// error or warning was produced.
10517 ///
10518 /// This value is used to suppress printing of redundant context stacks
10519 /// when there are multiple errors or warnings in the same instantiation.
10520 // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
10522
10523 /// The template instantiation callbacks to trace or track
10524 /// instantiations (objects can be chained).
10525 ///
10526 /// This callbacks is used to print, trace or track template
10527 /// instantiations as they are being constructed.
10528 std::vector<std::unique_ptr<TemplateInstantiationCallback>>
10530
10531 /// The current index into pack expansion arguments that will be
10532 /// used for substitution of parameter packs.
10533 ///
10534 /// The pack expansion index will be -1 to indicate that parameter packs
10535 /// should be instantiated as themselves. Otherwise, the index specifies
10536 /// which argument within the parameter pack will be used for substitution.
10538
10539 /// RAII object used to change the argument pack substitution index
10540 /// within a \c Sema object.
10541 ///
10542 /// See \c ArgumentPackSubstitutionIndex for more information.
10544 Sema &Self;
10545 int OldSubstitutionIndex;
10546
10547 public:
10548 ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
10549 : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
10550 Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
10551 }
10552
10554 Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
10555 }
10556 };
10557
10559
10562
10564 if (!CodeSynthesisContexts.empty() &&
10568 }
10571 }
10573
10574 /// Determines whether we are currently in a context where
10575 /// template argument substitution failures are not considered
10576 /// errors.
10577 ///
10578 /// \returns An empty \c Optional if we're not in a SFINAE context.
10579 /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
10580 /// template-deduction context object, which can be used to capture
10581 /// diagnostics that will be suppressed.
10582 std::optional<sema::TemplateDeductionInfo *> isSFINAEContext() const;
10583
10585 const MultiLevelTemplateArgumentList &TemplateArgs,
10586 SourceLocation Loc, DeclarationName Entity,
10587 bool AllowDeducedTST = false);
10588
10590 const MultiLevelTemplateArgumentList &TemplateArgs,
10591 SourceLocation Loc, DeclarationName Entity);
10592
10594 const MultiLevelTemplateArgumentList &TemplateArgs,
10595 SourceLocation Loc, DeclarationName Entity);
10596
10598 TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs,
10599 SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext,
10600 Qualifiers ThisTypeQuals, bool EvaluateConstraints = true);
10601 void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
10602 const MultiLevelTemplateArgumentList &Args);
10605 SmallVectorImpl<QualType> &ExceptionStorage,
10606 const MultiLevelTemplateArgumentList &Args);
10607 ParmVarDecl *
10609 const MultiLevelTemplateArgumentList &TemplateArgs,
10610 int indexAdjustment, std::optional<unsigned> NumExpansions,
10611 bool ExpectParameterPack, bool EvaluateConstraints = true);
10613 const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
10614 const MultiLevelTemplateArgumentList &TemplateArgs,
10615 SmallVectorImpl<QualType> &ParamTypes,
10617 ExtParameterInfoBuilder &ParamInfos);
10619 const MultiLevelTemplateArgumentList &TemplateArgs,
10620 bool ForCallExpr = false);
10622 const MultiLevelTemplateArgumentList &TemplateArgs);
10623
10624 // A RAII type used by the TemplateDeclInstantiator and TemplateInstantiator
10625 // to disable constraint evaluation, then restore the state.
10626 template <typename InstTy> struct ConstraintEvalRAII {
10627 InstTy &TI;
10629
10631 : TI(TI), OldValue(TI.getEvaluateConstraints()) {
10632 TI.setEvaluateConstraints(false);
10633 }
10634 ~ConstraintEvalRAII() { TI.setEvaluateConstraints(OldValue); }
10635 };
10636
10637 // Must be used instead of SubstExpr at 'constraint checking' time.
10640 const MultiLevelTemplateArgumentList &TemplateArgs);
10641 // Unlike the above, this does not evaluates constraints.
10643 Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs);
10644
10645 /// Substitute the given template arguments into a list of
10646 /// expressions, expanding pack expansions if required.
10647 ///
10648 /// \param Exprs The list of expressions to substitute into.
10649 ///
10650 /// \param IsCall Whether this is some form of call, in which case
10651 /// default arguments will be dropped.
10652 ///
10653 /// \param TemplateArgs The set of template arguments to substitute.
10654 ///
10655 /// \param Outputs Will receive all of the substituted arguments.
10656 ///
10657 /// \returns true if an error occurred, false otherwise.
10658 bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
10659 const MultiLevelTemplateArgumentList &TemplateArgs,
10660 SmallVectorImpl<Expr *> &Outputs);
10661
10663 const MultiLevelTemplateArgumentList &TemplateArgs);
10664
10667 bool CXXDirectInit);
10668
10669 bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
10670 const MultiLevelTemplateArgumentList &TemplateArgs);
10671
10672 bool InstantiateClass(SourceLocation PointOfInstantiation,
10673 CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
10674 const MultiLevelTemplateArgumentList &TemplateArgs,
10675 TemplateSpecializationKind TSK, bool Complain = true);
10676
10677 bool InstantiateEnum(SourceLocation PointOfInstantiation,
10678 EnumDecl *Instantiation, EnumDecl *Pattern,
10679 const MultiLevelTemplateArgumentList &TemplateArgs,
10681
10683 SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
10684 FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
10685
10687 SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
10688
10690 SourceLocation PointOfInstantiation,
10691 ClassTemplateSpecializationDecl *ClassTemplateSpec,
10692 TemplateSpecializationKind TSK, bool Complain = true);
10693
10694 void
10695 InstantiateClassMembers(SourceLocation PointOfInstantiation,
10696 CXXRecordDecl *Instantiation,
10697 const MultiLevelTemplateArgumentList &TemplateArgs,
10699
10701 SourceLocation PointOfInstantiation,
10702 ClassTemplateSpecializationDecl *ClassTemplateSpec,
10704
10707 const MultiLevelTemplateArgumentList &TemplateArgs);
10708
10711 const MultiLevelTemplateArgumentList &TemplateArgs);
10714 SourceLocation Loc,
10715 const MultiLevelTemplateArgumentList &TemplateArgs);
10716
10718 const MultiLevelTemplateArgumentList &TemplateArgs,
10719 bool EvaluateConstraint);
10720
10721 /// Determine whether we are currently performing template instantiation.
10724 }
10725
10726 ///@}
10727
10728 //
10729 //
10730 // -------------------------------------------------------------------------
10731 //
10732 //
10733
10734 /// \name C++ Template Declaration Instantiation
10735 /// Implementations are in SemaTemplateInstantiateDecl.cpp
10736 ///@{
10737
10738public:
10739 /// An entity for which implicit template instantiation is required.
10740 ///
10741 /// The source location associated with the declaration is the first place in
10742 /// the source code where the declaration was "used". It is not necessarily
10743 /// the point of instantiation (which will be either before or after the
10744 /// namespace-scope declaration that triggered this implicit instantiation),
10745 /// However, it is the location that diagnostics should generally refer to,
10746 /// because users will need to know what code triggered the instantiation.
10747 typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
10748
10749 /// The queue of implicit template instantiations that are required
10750 /// but have not yet been performed.
10751 std::deque<PendingImplicitInstantiation> PendingInstantiations;
10752
10753 /// Queue of implicit template instantiations that cannot be performed
10754 /// eagerly.
10756
10760
10761 /// The queue of implicit template instantiations that are required
10762 /// and must be performed within the current local scope.
10763 ///
10764 /// This queue is only used for member functions of local classes in
10765 /// templates, which must be instantiated in the same scope as their
10766 /// enclosing function, so that they can reference function-local
10767 /// types, static variables, enumerators, etc.
10768 std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
10769
10771 public:
10773 SavedPendingLocalImplicitInstantiations.swap(
10774 S.PendingLocalImplicitInstantiations);
10775 }
10776
10777 void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
10778
10780 assert(S.PendingLocalImplicitInstantiations.empty() &&
10781 "there shouldn't be any pending local implicit instantiations");
10782 SavedPendingLocalImplicitInstantiations.swap(
10783 S.PendingLocalImplicitInstantiations);
10784 }
10785
10786 private:
10787 Sema &S;
10788 std::deque<PendingImplicitInstantiation>
10789 SavedPendingLocalImplicitInstantiations;
10790 };
10791
10792 /// Records and restores the CurFPFeatures state on entry/exit of compound
10793 /// statements.
10795 public:
10798 FPOptionsOverride getOverrides() { return OldOverrides; }
10799
10800 private:
10801 Sema &S;
10802 FPOptions OldFPFeaturesState;
10803 FPOptionsOverride OldOverrides;
10804 LangOptions::FPEvalMethodKind OldEvalMethod;
10805 SourceLocation OldFPPragmaLocation;
10806 };
10807
10809 public:
10811 : S(S), Enabled(Enabled) {
10812 if (!Enabled)
10813 return;
10814
10815 S.SavedPendingInstantiations.emplace_back();
10816 S.SavedPendingInstantiations.back().swap(S.PendingInstantiations);
10817
10818 S.SavedVTableUses.emplace_back();
10819 S.SavedVTableUses.back().swap(S.VTableUses);
10820 }
10821
10822 void perform() {
10823 if (Enabled) {
10824 S.DefineUsedVTables();
10825 S.PerformPendingInstantiations();
10826 }
10827 }
10828
10830 if (!Enabled)
10831 return;
10832
10833 // Restore the set of pending vtables.
10834 assert(S.VTableUses.empty() &&
10835 "VTableUses should be empty before it is discarded.");
10836 S.VTableUses.swap(S.SavedVTableUses.back());
10837 S.SavedVTableUses.pop_back();
10838
10839 // Restore the set of pending implicit instantiations.
10840 if (S.TUKind != TU_Prefix || !S.LangOpts.PCHInstantiateTemplates) {
10841 assert(S.PendingInstantiations.empty() &&
10842 "PendingInstantiations should be empty before it is discarded.");
10843 S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
10844 S.SavedPendingInstantiations.pop_back();
10845 } else {
10846 // Template instantiations in the PCH may be delayed until the TU.
10847 S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
10848 S.PendingInstantiations.insert(
10849 S.PendingInstantiations.end(),
10850 S.SavedPendingInstantiations.back().begin(),
10851 S.SavedPendingInstantiations.back().end());
10852 S.SavedPendingInstantiations.pop_back();
10853 }
10854 }
10855
10856 private:
10857 Sema &S;
10858 bool Enabled;
10859 };
10860
10862 const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES);
10863
10868
10870 Decl *D)
10871 : TmplAttr(A), Scope(S), NewDecl(D) {}
10872 };
10874
10875 void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
10876 const Decl *Pattern, Decl *Inst,
10877 LateInstantiatedAttrVec *LateAttrs = nullptr,
10878 LocalInstantiationScope *OuterMostScope = nullptr);
10879 void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst);
10880
10881 void
10883 const Decl *Pattern, Decl *Inst,
10884 LateInstantiatedAttrVec *LateAttrs = nullptr,
10885 LocalInstantiationScope *OuterMostScope = nullptr);
10886
10888
10890 ParmVarDecl *Param);
10891 void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
10895 SourceLocation Loc,
10898 void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
10900 bool Recursive = false,
10901 bool DefinitionRequired = false,
10902 bool AtEndOfTU = false);
10905 const TemplateArgumentList *PartialSpecArgs,
10906 const TemplateArgumentListInfo &TemplateArgsInfo,
10908 SourceLocation PointOfInstantiation,
10909 LateInstantiatedAttrVec *LateAttrs = nullptr,
10910 LocalInstantiationScope *StartingScope = nullptr);
10912 VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
10913 const MultiLevelTemplateArgumentList &TemplateArgs);
10914 void
10916 const MultiLevelTemplateArgumentList &TemplateArgs,
10917 LateInstantiatedAttrVec *LateAttrs,
10918 DeclContext *Owner,
10919 LocalInstantiationScope *StartingScope,
10920 bool InstantiatingVarTemplate = false,
10921 VarTemplateSpecializationDecl *PrevVTSD = nullptr);
10922
10924 VarDecl *Var, VarDecl *OldVar,
10925 const MultiLevelTemplateArgumentList &TemplateArgs);
10926 void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
10927 VarDecl *Var, bool Recursive = false,
10928 bool DefinitionRequired = false,
10929 bool AtEndOfTU = false);
10930
10932 CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl,
10933 const MultiLevelTemplateArgumentList &TemplateArgs);
10934
10935 NamedDecl *
10937 const MultiLevelTemplateArgumentList &TemplateArgs,
10938 bool FindingInstantiatedContext = false);
10939 DeclContext *
10941 const MultiLevelTemplateArgumentList &TemplateArgs);
10942
10943 Decl *SubstDecl(Decl *D, DeclContext *Owner,
10944 const MultiLevelTemplateArgumentList &TemplateArgs);
10945
10946 /// Substitute the name and return type of a defaulted 'operator<=>' to form
10947 /// an implicit 'operator=='.
10949 FunctionDecl *Spaceship);
10950
10951 void PerformPendingInstantiations(bool LocalOnly = false);
10952
10955 const MultiLevelTemplateArgumentList &TemplateArgs,
10956 bool EvaluateConstraints = true);
10957
10959 const DeclContext *Pattern,
10960 const MultiLevelTemplateArgumentList &TemplateArgs);
10961
10962private:
10963 /// Introduce the instantiated local variables into the local
10964 /// instantiation scope.
10965 void addInstantiatedLocalVarsToScope(FunctionDecl *Function,
10966 const FunctionDecl *PatternDecl,
10968 /// Introduce the instantiated function parameters into the local
10969 /// instantiation scope, and set the parameter names to those used
10970 /// in the template.
10971 bool addInstantiatedParametersToScope(
10972 FunctionDecl *Function, const FunctionDecl *PatternDecl,
10974 const MultiLevelTemplateArgumentList &TemplateArgs);
10975
10976 int ParsingClassDepth = 0;
10977
10978 class SavePendingParsedClassStateRAII {
10979 public:
10980 SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
10981
10982 ~SavePendingParsedClassStateRAII() {
10983 assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
10984 "there shouldn't be any pending delayed exception spec checks");
10985 assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
10986 "there shouldn't be any pending delayed exception spec checks");
10987 swapSavedState();
10988 }
10989
10990 private:
10991 Sema &S;
10992 decltype(DelayedOverridingExceptionSpecChecks)
10993 SavedOverridingExceptionSpecChecks;
10994 decltype(DelayedEquivalentExceptionSpecChecks)
10995 SavedEquivalentExceptionSpecChecks;
10996
10997 void swapSavedState() {
10998 SavedOverridingExceptionSpecChecks.swap(
10999 S.DelayedOverridingExceptionSpecChecks);
11000 SavedEquivalentExceptionSpecChecks.swap(
11001 S.DelayedEquivalentExceptionSpecChecks);
11002 }
11003 };
11004
11005 ///@}
11006
11007 //
11008 //
11009 // -------------------------------------------------------------------------
11010 //
11011 //
11012
11013 /// \name C++ Variadic Templates
11014 /// Implementations are in SemaTemplateVariadic.cpp
11015 ///@{
11016
11017public:
11018 /// Determine whether an unexpanded parameter pack might be permitted in this
11019 /// location. Useful for error recovery.
11021
11022 /// The context in which an unexpanded parameter pack is
11023 /// being diagnosed.
11024 ///
11025 /// Note that the values of this enumeration line up with the first
11026 /// argument to the \c err_unexpanded_parameter_pack diagnostic.
11028 /// An arbitrary expression.
11030
11031 /// The base type of a class type.
11033
11034 /// The type of an arbitrary declaration.
11036
11037 /// The type of a data member.
11039
11040 /// The size of a bit-field.
11042
11043 /// The expression in a static assertion.
11045
11046 /// The fixed underlying type of an enumeration.
11048
11049 /// The enumerator value.
11051
11052 /// A using declaration.
11054
11055 /// A friend declaration.
11057
11058 /// A declaration qualifier.
11060
11061 /// An initializer.
11063
11064 /// A default argument.
11066
11067 /// The type of a non-type template parameter.
11069
11070 /// The type of an exception.
11072
11073 /// Explicit specialization.
11075
11076 /// Partial specialization.
11078
11079 /// Microsoft __if_exists.
11081
11082 /// Microsoft __if_not_exists.
11084
11085 /// Lambda expression.
11087
11088 /// Block expression.
11090
11091 /// A type constraint.
11093
11094 // A requirement in a requires-expression.
11096
11097 // A requires-clause.
11099 };
11100
11101 /// Diagnose unexpanded parameter packs.
11102 ///
11103 /// \param Loc The location at which we should emit the diagnostic.
11104 ///
11105 /// \param UPPC The context in which we are diagnosing unexpanded
11106 /// parameter packs.
11107 ///
11108 /// \param Unexpanded the set of unexpanded parameter packs.
11109 ///
11110 /// \returns true if an error occurred, false otherwise.
11114
11115 /// If the given type contains an unexpanded parameter pack,
11116 /// diagnose the error.
11117 ///
11118 /// \param Loc The source location where a diagnostc should be emitted.
11119 ///
11120 /// \param T The type that is being checked for unexpanded parameter
11121 /// packs.
11122 ///
11123 /// \returns true if an error occurred, false otherwise.
11126
11127 /// If the given expression contains an unexpanded parameter
11128 /// pack, diagnose the error.
11129 ///
11130 /// \param E The expression that is being checked for unexpanded
11131 /// parameter packs.
11132 ///
11133 /// \returns true if an error occurred, false otherwise.
11136
11137 /// If the given requirees-expression contains an unexpanded reference to one
11138 /// of its own parameter packs, diagnose the error.
11139 ///
11140 /// \param RE The requiress-expression that is being checked for unexpanded
11141 /// parameter packs.
11142 ///
11143 /// \returns true if an error occurred, false otherwise.
11145
11146 /// If the given nested-name-specifier contains an unexpanded
11147 /// parameter pack, diagnose the error.
11148 ///
11149 /// \param SS The nested-name-specifier that is being checked for
11150 /// unexpanded parameter packs.
11151 ///
11152 /// \returns true if an error occurred, false otherwise.
11155
11156 /// If the given name contains an unexpanded parameter pack,
11157 /// diagnose the error.
11158 ///
11159 /// \param NameInfo The name (with source location information) that
11160 /// is being checked for unexpanded parameter packs.
11161 ///
11162 /// \returns true if an error occurred, false otherwise.
11165
11166 /// If the given template name contains an unexpanded parameter pack,
11167 /// diagnose the error.
11168 ///
11169 /// \param Loc The location of the template name.
11170 ///
11171 /// \param Template The template name that is being checked for unexpanded
11172 /// parameter packs.
11173 ///
11174 /// \returns true if an error occurred, false otherwise.
11176 TemplateName Template,
11178
11179 /// If the given template argument contains an unexpanded parameter
11180 /// pack, diagnose the error.
11181 ///
11182 /// \param Arg The template argument that is being checked for unexpanded
11183 /// parameter packs.
11184 ///
11185 /// \returns true if an error occurred, false otherwise.
11188
11189 /// Collect the set of unexpanded parameter packs within the given
11190 /// template argument.
11191 ///
11192 /// \param Arg The template argument that will be traversed to find
11193 /// unexpanded parameter packs.
11195 TemplateArgument Arg,
11197
11198 /// Collect the set of unexpanded parameter packs within the given
11199 /// template argument.
11200 ///
11201 /// \param Arg The template argument that will be traversed to find
11202 /// unexpanded parameter packs.
11206
11207 /// Collect the set of unexpanded parameter packs within the given
11208 /// type.
11209 ///
11210 /// \param T The type that will be traversed to find
11211 /// unexpanded parameter packs.
11214
11215 /// Collect the set of unexpanded parameter packs within the given
11216 /// type.
11217 ///
11218 /// \param TL The type that will be traversed to find
11219 /// unexpanded parameter packs.
11222
11223 /// Collect the set of unexpanded parameter packs within the given
11224 /// nested-name-specifier.
11225 ///
11226 /// \param NNS The nested-name-specifier that will be traversed to find
11227 /// unexpanded parameter packs.
11231
11232 /// Collect the set of unexpanded parameter packs within the given
11233 /// name.
11234 ///
11235 /// \param NameInfo The name that will be traversed to find
11236 /// unexpanded parameter packs.
11238 const DeclarationNameInfo &NameInfo,
11240
11241 /// Invoked when parsing a template argument followed by an
11242 /// ellipsis, which creates a pack expansion.
11243 ///
11244 /// \param Arg The template argument preceding the ellipsis, which
11245 /// may already be invalid.
11246 ///
11247 /// \param EllipsisLoc The location of the ellipsis.
11249 SourceLocation EllipsisLoc);
11250
11251 /// Invoked when parsing a type followed by an ellipsis, which
11252 /// creates a pack expansion.
11253 ///
11254 /// \param Type The type preceding the ellipsis, which will become
11255 /// the pattern of the pack expansion.
11256 ///
11257 /// \param EllipsisLoc The location of the ellipsis.
11259
11260 /// Construct a pack expansion type from the pattern of the pack
11261 /// expansion.
11263 SourceLocation EllipsisLoc,
11264 std::optional<unsigned> NumExpansions);
11265
11266 /// Construct a pack expansion type from the pattern of the pack
11267 /// expansion.
11268 QualType CheckPackExpansion(QualType Pattern, SourceRange PatternRange,
11269 SourceLocation EllipsisLoc,
11270 std::optional<unsigned> NumExpansions);
11271
11272 /// Invoked when parsing an expression followed by an ellipsis, which
11273 /// creates a pack expansion.
11274 ///
11275 /// \param Pattern The expression preceding the ellipsis, which will become
11276 /// the pattern of the pack expansion.
11277 ///
11278 /// \param EllipsisLoc The location of the ellipsis.
11279 ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
11280
11281 /// Invoked when parsing an expression followed by an ellipsis, which
11282 /// creates a pack expansion.
11283 ///
11284 /// \param Pattern The expression preceding the ellipsis, which will become
11285 /// the pattern of the pack expansion.
11286 ///
11287 /// \param EllipsisLoc The location of the ellipsis.
11288 ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
11289 std::optional<unsigned> NumExpansions);
11290
11291 /// Determine whether we could expand a pack expansion with the
11292 /// given set of parameter packs into separate arguments by repeatedly
11293 /// transforming the pattern.
11294 ///
11295 /// \param EllipsisLoc The location of the ellipsis that identifies the
11296 /// pack expansion.
11297 ///
11298 /// \param PatternRange The source range that covers the entire pattern of
11299 /// the pack expansion.
11300 ///
11301 /// \param Unexpanded The set of unexpanded parameter packs within the
11302 /// pattern.
11303 ///
11304 /// \param ShouldExpand Will be set to \c true if the transformer should
11305 /// expand the corresponding pack expansions into separate arguments. When
11306 /// set, \c NumExpansions must also be set.
11307 ///
11308 /// \param RetainExpansion Whether the caller should add an unexpanded
11309 /// pack expansion after all of the expanded arguments. This is used
11310 /// when extending explicitly-specified template argument packs per
11311 /// C++0x [temp.arg.explicit]p9.
11312 ///
11313 /// \param NumExpansions The number of separate arguments that will be in
11314 /// the expanded form of the corresponding pack expansion. This is both an
11315 /// input and an output parameter, which can be set by the caller if the
11316 /// number of expansions is known a priori (e.g., due to a prior substitution)
11317 /// and will be set by the callee when the number of expansions is known.
11318 /// The callee must set this value when \c ShouldExpand is \c true; it may
11319 /// set this value in other cases.
11320 ///
11321 /// \returns true if an error occurred (e.g., because the parameter packs
11322 /// are to be instantiated with arguments of different lengths), false
11323 /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
11324 /// must be set.
11326 SourceLocation EllipsisLoc, SourceRange PatternRange,
11328 const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand,
11329 bool &RetainExpansion, std::optional<unsigned> &NumExpansions);
11330
11331 /// Determine the number of arguments in the given pack expansion
11332 /// type.
11333 ///
11334 /// This routine assumes that the number of arguments in the expansion is
11335 /// consistent across all of the unexpanded parameter packs in its pattern.
11336 ///
11337 /// Returns an empty Optional if the type can't be expanded.
11338 std::optional<unsigned> getNumArgumentsInExpansion(
11339 QualType T, const MultiLevelTemplateArgumentList &TemplateArgs);
11340
11341 /// Determine whether the given declarator contains any unexpanded
11342 /// parameter packs.
11343 ///
11344 /// This routine is used by the parser to disambiguate function declarators
11345 /// with an ellipsis prior to the ')', e.g.,
11346 ///
11347 /// \code
11348 /// void f(T...);
11349 /// \endcode
11350 ///
11351 /// To determine whether we have an (unnamed) function parameter pack or
11352 /// a variadic function.
11353 ///
11354 /// \returns true if the declarator contains any unexpanded parameter packs,
11355 /// false otherwise.
11357
11358 /// Returns the pattern of the pack expansion for a template argument.
11359 ///
11360 /// \param OrigLoc The template argument to expand.
11361 ///
11362 /// \param Ellipsis Will be set to the location of the ellipsis.
11363 ///
11364 /// \param NumExpansions Will be set to the number of expansions that will
11365 /// be generated from this pack expansion, if known a priori.
11367 TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis,
11368 std::optional<unsigned> &NumExpansions) const;
11369
11370 /// Given a template argument that contains an unexpanded parameter pack, but
11371 /// which has already been substituted, attempt to determine the number of
11372 /// elements that will be produced once this argument is fully-expanded.
11373 ///
11374 /// This is intended for use when transforming 'sizeof...(Arg)' in order to
11375 /// avoid actually expanding the pack where possible.
11376 std::optional<unsigned> getFullyPackExpandedSize(TemplateArgument Arg);
11377
11379 IdentifierInfo &Name,
11380 SourceLocation NameLoc,
11381 SourceLocation RParenLoc);
11382
11383 ExprResult ActOnPackIndexingExpr(Scope *S, Expr *PackExpression,
11384 SourceLocation EllipsisLoc,
11385 SourceLocation LSquareLoc, Expr *IndexExpr,
11386 SourceLocation RSquareLoc);
11387
11388 ExprResult BuildPackIndexingExpr(Expr *PackExpression,
11389 SourceLocation EllipsisLoc, Expr *IndexExpr,
11390 SourceLocation RSquareLoc,
11391 ArrayRef<Expr *> ExpandedExprs = {},
11392 bool EmptyPack = false);
11393
11394 /// Handle a C++1z fold-expression: ( expr op ... op expr ).
11395 ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS,
11396 tok::TokenKind Operator,
11397 SourceLocation EllipsisLoc, Expr *RHS,
11398 SourceLocation RParenLoc);
11399 ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee,
11400 SourceLocation LParenLoc, Expr *LHS,
11401 BinaryOperatorKind Operator,
11402 SourceLocation EllipsisLoc, Expr *RHS,
11403 SourceLocation RParenLoc,
11404 std::optional<unsigned> NumExpansions);
11405 ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc,
11406 BinaryOperatorKind Operator);
11407
11408 ///@}
11409
11410 //
11411 //
11412 // -------------------------------------------------------------------------
11413 //
11414 //
11415
11416 /// \name Constraints and Concepts
11417 /// Implementations are in SemaConcept.cpp
11418 ///@{
11419
11420public:
11422 const llvm::FoldingSetNodeID &ID) {
11423 const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
11424 SatisfactionStack.emplace_back(Can, ID);
11425 }
11426
11427 void PopSatisfactionStackEntry() { SatisfactionStack.pop_back(); }
11428
11430 const llvm::FoldingSetNodeID &ID) const {
11431 const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
11432 return llvm::find(SatisfactionStack, SatisfactionStackEntryTy{Can, ID}) !=
11433 SatisfactionStack.end();
11434 }
11435
11437 std::pair<const NamedDecl *, llvm::FoldingSetNodeID>;
11438
11439 // Resets the current SatisfactionStack for cases where we are instantiating
11440 // constraints as a 'side effect' of normal instantiation in a way that is not
11441 // indicative of recursive definition.
11444 Sema &SemaRef;
11445
11446 public:
11448 SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
11449 }
11450
11452 SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
11453 }
11454 };
11455
11458 SatisfactionStack.swap(NewSS);
11459 }
11460
11461 /// Check whether the given expression is a valid constraint expression.
11462 /// A diagnostic is emitted if it is not, false is returned, and
11463 /// PossibleNonPrimary will be set to true if the failure might be due to a
11464 /// non-primary expression being used as an atomic constraint.
11465 bool CheckConstraintExpression(const Expr *CE, Token NextToken = Token(),
11466 bool *PossibleNonPrimary = nullptr,
11467 bool IsTrailingRequiresClause = false);
11468
11469 /// \brief Check whether the given list of constraint expressions are
11470 /// satisfied (as if in a 'conjunction') given template arguments.
11471 /// \param Template the template-like entity that triggered the constraints
11472 /// check (either a concept or a constrained entity).
11473 /// \param ConstraintExprs a list of constraint expressions, treated as if
11474 /// they were 'AND'ed together.
11475 /// \param TemplateArgLists the list of template arguments to substitute into
11476 /// the constraint expression.
11477 /// \param TemplateIDRange The source range of the template id that
11478 /// caused the constraints check.
11479 /// \param Satisfaction if true is returned, will contain details of the
11480 /// satisfaction, with enough information to diagnose an unsatisfied
11481 /// expression.
11482 /// \returns true if an error occurred and satisfaction could not be checked,
11483 /// false otherwise.
11485 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
11486 const MultiLevelTemplateArgumentList &TemplateArgLists,
11487 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction) {
11489 return CheckConstraintSatisfaction(Template, ConstraintExprs, Converted,
11490 TemplateArgLists, TemplateIDRange,
11491 Satisfaction);
11492 }
11493
11494 /// \brief Check whether the given list of constraint expressions are
11495 /// satisfied (as if in a 'conjunction') given template arguments.
11496 /// Additionally, takes an empty list of Expressions which is populated with
11497 /// the instantiated versions of the ConstraintExprs.
11498 /// \param Template the template-like entity that triggered the constraints
11499 /// check (either a concept or a constrained entity).
11500 /// \param ConstraintExprs a list of constraint expressions, treated as if
11501 /// they were 'AND'ed together.
11502 /// \param ConvertedConstraints a out parameter that will get populated with
11503 /// the instantiated version of the ConstraintExprs if we successfully checked
11504 /// satisfaction.
11505 /// \param TemplateArgList the multi-level list of template arguments to
11506 /// substitute into the constraint expression. This should be relative to the
11507 /// top-level (hence multi-level), since we need to instantiate fully at the
11508 /// time of checking.
11509 /// \param TemplateIDRange The source range of the template id that
11510 /// caused the constraints check.
11511 /// \param Satisfaction if true is returned, will contain details of the
11512 /// satisfaction, with enough information to diagnose an unsatisfied
11513 /// expression.
11514 /// \returns true if an error occurred and satisfaction could not be checked,
11515 /// false otherwise.
11517 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
11518 llvm::SmallVectorImpl<Expr *> &ConvertedConstraints,
11519 const MultiLevelTemplateArgumentList &TemplateArgList,
11520 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
11521
11522 /// \brief Check whether the given non-dependent constraint expression is
11523 /// satisfied. Returns false and updates Satisfaction with the satisfaction
11524 /// verdict if successful, emits a diagnostic and returns true if an error
11525 /// occurred and satisfaction could not be determined.
11526 ///
11527 /// \returns true if an error occurred, false otherwise.
11528 bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
11529 ConstraintSatisfaction &Satisfaction);
11530
11531 /// Check whether the given function decl's trailing requires clause is
11532 /// satisfied, if any. Returns false and updates Satisfaction with the
11533 /// satisfaction verdict if successful, emits a diagnostic and returns true if
11534 /// an error occurred and satisfaction could not be determined.
11535 ///
11536 /// \returns true if an error occurred, false otherwise.
11538 ConstraintSatisfaction &Satisfaction,
11539 SourceLocation UsageLoc = SourceLocation(),
11540 bool ForOverloadResolution = false);
11541
11542 // Calculates whether two constraint expressions are equal irrespective of a
11543 // difference in 'depth'. This takes a pair of optional 'NamedDecl's 'Old' and
11544 // 'New', which are the "source" of the constraint, since this is necessary
11545 // for figuring out the relative 'depth' of the constraint. The depth of the
11546 // 'primary template' and the 'instantiated from' templates aren't necessarily
11547 // the same, such as a case when one is a 'friend' defined in a class.
11549 const Expr *OldConstr,
11550 const TemplateCompareNewDeclInfo &New,
11551 const Expr *NewConstr);
11552
11553 // Calculates whether the friend function depends on an enclosing template for
11554 // the purposes of [temp.friend] p9.
11556
11557 /// \brief Ensure that the given template arguments satisfy the constraints
11558 /// associated with the given template, emitting a diagnostic if they do not.
11559 ///
11560 /// \param Template The template to which the template arguments are being
11561 /// provided.
11562 ///
11563 /// \param TemplateArgs The converted, canonicalized template arguments.
11564 ///
11565 /// \param TemplateIDRange The source range of the template id that
11566 /// caused the constraints check.
11567 ///
11568 /// \returns true if the constrains are not satisfied or could not be checked
11569 /// for satisfaction, false if the constraints are satisfied.
11571 TemplateDecl *Template,
11572 const MultiLevelTemplateArgumentList &TemplateArgs,
11573 SourceRange TemplateIDRange);
11574
11576 SourceLocation PointOfInstantiation, FunctionDecl *Decl,
11577 ArrayRef<TemplateArgument> TemplateArgs,
11578 ConstraintSatisfaction &Satisfaction);
11579
11580 /// \brief Emit diagnostics explaining why a constraint expression was deemed
11581 /// unsatisfied.
11582 /// \param First whether this is the first time an unsatisfied constraint is
11583 /// diagnosed for this error.
11585 bool First = true);
11586
11587 /// \brief Emit diagnostics explaining why a constraint expression was deemed
11588 /// unsatisfied.
11589 void
11591 bool First = true);
11592
11594 NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
11595
11596 /// \brief Check whether the given declaration's associated constraints are
11597 /// at least as constrained than another declaration's according to the
11598 /// partial ordering of constraints.
11599 ///
11600 /// \param Result If no error occurred, receives the result of true if D1 is
11601 /// at least constrained than D2, and false otherwise.
11602 ///
11603 /// \returns true if an error occurred, false otherwise.
11606 bool &Result);
11607
11608 /// If D1 was not at least as constrained as D2, but would've been if a pair
11609 /// of atomic constraints involved had been declared in a concept and not
11610 /// repeated in two separate places in code.
11611 /// \returns true if such a diagnostic was emitted, false otherwise.
11615
11616private:
11617 /// Caches pairs of template-like decls whose associated constraints were
11618 /// checked for subsumption and whether or not the first's constraints did in
11619 /// fact subsume the second's.
11620 llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
11621 /// Caches the normalized associated constraints of declarations (concepts or
11622 /// constrained declarations). If an error occurred while normalizing the
11623 /// associated constraints of the template or concept, nullptr will be cached
11624 /// here.
11625 llvm::DenseMap<NamedDecl *, NormalizedConstraint *> NormalizationCache;
11626
11627 llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
11628 SatisfactionCache;
11629
11630 // The current stack of constraint satisfactions, so we can exit-early.
11632
11633 /// Introduce the instantiated captures of the lambda into the local
11634 /// instantiation scope.
11635 bool addInstantiatedCapturesToScope(
11636 FunctionDecl *Function, const FunctionDecl *PatternDecl,
11638 const MultiLevelTemplateArgumentList &TemplateArgs);
11639
11640 /// Used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
11641 /// the case of lambdas) set up the LocalInstantiationScope of the current
11642 /// function.
11643 bool
11644 SetupConstraintScope(FunctionDecl *FD,
11645 std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11646 const MultiLevelTemplateArgumentList &MLTAL,
11648
11649 /// Used during constraint checking, sets up the constraint template argument
11650 /// lists, and calls SetupConstraintScope to set up the
11651 /// LocalInstantiationScope to have the proper set of ParVarDecls configured.
11652 std::optional<MultiLevelTemplateArgumentList>
11653 SetupConstraintCheckingTemplateArgumentsAndScope(
11654 FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11656
11657 ///@}
11658
11659 //
11660 //
11661 // -------------------------------------------------------------------------
11662 //
11663 //
11664
11665 /// \name Types
11666 /// Implementations are in SemaType.cpp
11667 ///@{
11668
11669public:
11670 /// A mapping that describes the nullability we've seen in each header file.
11672
11673 static int getPrintable(int I) { return I; }
11674 static unsigned getPrintable(unsigned I) { return I; }
11675 static bool getPrintable(bool B) { return B; }
11676 static const char *getPrintable(const char *S) { return S; }
11677 static StringRef getPrintable(StringRef S) { return S; }
11678 static const std::string &getPrintable(const std::string &S) { return S; }
11679 static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
11680 return II;
11681 }
11683 static QualType getPrintable(QualType T) { return T; }
11684 static SourceRange getPrintable(SourceRange R) { return R; }
11686 static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
11688
11689 enum class CompleteTypeKind {
11690 /// Apply the normal rules for complete types. In particular,
11691 /// treat all sizeless types as incomplete.
11692 Normal,
11693
11694 /// Relax the normal rules for complete types so that they include
11695 /// sizeless built-in types.
11697
11698 // FIXME: Eventually we should flip the default to Normal and opt in
11699 // to AcceptSizeless rather than opt out of it.
11701 };
11702
11703 /// Build a an Objective-C protocol-qualified 'id' type where no
11704 /// base type was specified.
11706 SourceLocation lAngleLoc, ArrayRef<Decl *> protocols,
11707 ArrayRef<SourceLocation> protocolLocs, SourceLocation rAngleLoc);
11708
11709 /// Build a specialized and/or protocol-qualified Objective-C type.
11711 Scope *S, SourceLocation Loc, ParsedType BaseType,
11712 SourceLocation TypeArgsLAngleLoc, ArrayRef<ParsedType> TypeArgs,
11713 SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc,
11714 ArrayRef<Decl *> Protocols, ArrayRef<SourceLocation> ProtocolLocs,
11715 SourceLocation ProtocolRAngleLoc);
11716
11717 /// Build an Objective-C type parameter type.
11719 SourceLocation ProtocolLAngleLoc,
11721 ArrayRef<SourceLocation> ProtocolLocs,
11722 SourceLocation ProtocolRAngleLoc,
11723 bool FailOnError = false);
11724
11725 /// Build an Objective-C object pointer type.
11727 QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
11728 ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
11729 SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
11730 ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
11731 bool FailOnError, bool Rebuilding);
11732
11734 const DeclSpec *DS = nullptr);
11735 QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
11736 const DeclSpec *DS = nullptr);
11738 DeclarationName Entity);
11739 QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc,
11740 DeclarationName Entity);
11742 unsigned Quals, SourceRange Brackets,
11743 DeclarationName Entity);
11744 QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
11746 SourceLocation AttrLoc);
11747 QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns,
11748 SourceLocation AttrLoc);
11749
11750 QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace,
11751 SourceLocation AttrLoc);
11752
11753 /// Same as above, but constructs the AddressSpace index if not provided.
11755 SourceLocation AttrLoc);
11756
11758
11760
11761 /// Build a function type.
11762 ///
11763 /// This routine checks the function type according to C++ rules and
11764 /// under the assumption that the result type and parameter types have
11765 /// just been instantiated from a template. It therefore duplicates
11766 /// some of the behavior of GetTypeForDeclarator, but in a much
11767 /// simpler form that is only suitable for this narrow use case.
11768 ///
11769 /// \param T The return type of the function.
11770 ///
11771 /// \param ParamTypes The parameter types of the function. This array
11772 /// will be modified to account for adjustments to the types of the
11773 /// function parameters.
11774 ///
11775 /// \param Loc The location of the entity whose type involves this
11776 /// function type or, if there is no such entity, the location of the
11777 /// type that will have function type.
11778 ///
11779 /// \param Entity The name of the entity that involves the function
11780 /// type, if known.
11781 ///
11782 /// \param EPI Extra information about the function type. Usually this will
11783 /// be taken from an existing function with the same prototype.
11784 ///
11785 /// \returns A suitable function type, if there are no errors. The
11786 /// unqualified type will always be a FunctionProtoType.
11787 /// Otherwise, returns a NULL type.
11789 SourceLocation Loc, DeclarationName Entity,
11791
11793 SourceLocation Loc, DeclarationName Entity);
11795 DeclarationName Entity);
11800 QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc);
11801
11804
11805 /// Package the given type and TSI into a ParsedType.
11808 TypeSourceInfo **TInfo = nullptr);
11809
11811
11812 /// The parser has parsed the context-sensitive type 'instancetype'
11813 /// in an Objective-C message declaration. Return the appropriate type.
11815
11816 // Check whether the size of array element of type \p EltTy is a multiple of
11817 // its alignment and return false if it isn't.
11819
11820 void
11821 diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
11822 SourceLocation FallbackLoc,
11823 SourceLocation ConstQualLoc = SourceLocation(),
11824 SourceLocation VolatileQualLoc = SourceLocation(),
11825 SourceLocation RestrictQualLoc = SourceLocation(),
11826 SourceLocation AtomicQualLoc = SourceLocation(),
11827 SourceLocation UnalignedQualLoc = SourceLocation());
11828
11829 /// Retrieve the keyword associated
11831
11832 /// The struct behind the CFErrorRef pointer.
11834 bool isCFError(RecordDecl *D);
11835
11836 /// Retrieve the identifier "NSError".
11838
11839 /// Adjust the calling convention of a method to be the ABI default if it
11840 /// wasn't specified explicitly. This handles method types formed from
11841 /// function type typedefs and typename template arguments.
11842 void adjustMemberFunctionCC(QualType &T, bool HasThisPointer,
11843 bool IsCtorOrDtor, SourceLocation Loc);
11844
11845 // Check if there is an explicit attribute, but only look through parens.
11846 // The intent is to look for an attribute on the current declarator, but not
11847 // one that came from a typedef.
11849
11850 /// Check whether a nullability type specifier can be added to the given
11851 /// type through some means not written in source (e.g. API notes).
11852 ///
11853 /// \param Type The type to which the nullability specifier will be
11854 /// added. On success, this type will be updated appropriately.
11855 ///
11856 /// \param Nullability The nullability specifier to add.
11857 ///
11858 /// \param DiagLoc The location to use for diagnostics.
11859 ///
11860 /// \param AllowArrayTypes Whether to accept nullability specifiers on an
11861 /// array type (e.g., because it will decay to a pointer).
11862 ///
11863 /// \param OverrideExisting Whether to override an existing, locally-specified
11864 /// nullability specifier rather than complaining about the conflict.
11865 ///
11866 /// \returns true if nullability cannot be applied, false otherwise.
11868 NullabilityKind Nullability,
11869 SourceLocation DiagLoc,
11870 bool AllowArrayTypes,
11871 bool OverrideExisting);
11872
11873 /// Get the type of expression E, triggering instantiation to complete the
11874 /// type if necessary -- that is, if the expression refers to a templated
11875 /// static data member of incomplete array type.
11876 ///
11877 /// May still return an incomplete type if instantiation was not possible or
11878 /// if the type is incomplete for a different reason. Use
11879 /// RequireCompleteExprType instead if a diagnostic is expected for an
11880 /// incomplete expression type.
11882
11885 TypeDiagnoser &Diagnoser);
11886 bool RequireCompleteExprType(Expr *E, unsigned DiagID);
11887
11888 template <typename... Ts>
11889 bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
11890 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11892 }
11893
11895 const CXXScopeSpec &SS, QualType T,
11896 TagDecl *OwnedTagDecl = nullptr);
11897
11898 // Returns the underlying type of a decltype with the given expression.
11900
11902 /// If AsUnevaluated is false, E is treated as though it were an evaluated
11903 /// context, such as when building a type for decltype(auto).
11904 QualType BuildDecltypeType(Expr *E, bool AsUnevaluated = true);
11905
11906 QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr,
11907 SourceLocation Loc,
11908 SourceLocation EllipsisLoc);
11909 QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
11910 SourceLocation Loc, SourceLocation EllipsisLoc,
11911 bool FullySubstituted = false,
11912 ArrayRef<QualType> Expansions = {});
11913
11916 SourceLocation Loc);
11922 SourceLocation Loc);
11924 SourceLocation Loc);
11926 SourceLocation Loc);
11928 SourceLocation Loc);
11930 SourceLocation Loc);
11931
11933 TypeDiagnoser &Diagnoser);
11934 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
11935
11936 template <typename... Ts>
11937 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
11938 const Ts &...Args) {
11939 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11940 return RequireLiteralType(Loc, T, Diagnoser);
11941 }
11942
11945 return !RequireCompleteTypeImpl(Loc, T, Kind, nullptr);
11946 }
11948 CompleteTypeKind Kind, TypeDiagnoser &Diagnoser);
11950 CompleteTypeKind Kind, unsigned DiagID);
11951
11953 TypeDiagnoser &Diagnoser) {
11954 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, Diagnoser);
11955 }
11956 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID) {
11957 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, DiagID);
11958 }
11959
11960 template <typename... Ts>
11961 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
11962 const Ts &...Args) {
11963 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11964 return RequireCompleteType(Loc, T, Diagnoser);
11965 }
11966
11967 /// Determine whether a declaration is visible to name lookup.
11968 bool isVisible(const NamedDecl *D) {
11969 return D->isUnconditionallyVisible() ||
11970 isAcceptableSlow(D, AcceptableKind::Visible);
11971 }
11972
11973 /// Determine whether a declaration is reachable.
11974 bool isReachable(const NamedDecl *D) {
11975 // All visible declarations are reachable.
11976 return D->isUnconditionallyVisible() ||
11977 isAcceptableSlow(D, AcceptableKind::Reachable);
11978 }
11979
11980 /// Determine whether a declaration is acceptable (visible/reachable).
11982 return Kind == AcceptableKind::Visible ? isVisible(D) : isReachable(D);
11983 }
11984
11985 /// Determine if \p D and \p Suggested have a structurally compatible
11986 /// layout as described in C11 6.2.7/1.
11987 bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
11988
11989 /// Determine if \p D has a visible definition. If not, suggest a declaration
11990 /// that should be made visible to expose the definition.
11991 bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
11992 bool OnlyNeedComplete = false);
11994 NamedDecl *Hidden;
11995 return hasVisibleDefinition(const_cast<NamedDecl *>(D), &Hidden);
11996 }
11997
11998 /// Determine if \p D has a reachable definition. If not, suggest a
11999 /// declaration that should be made reachable to expose the definition.
12000 bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested,
12001 bool OnlyNeedComplete = false);
12003 NamedDecl *Hidden;
12004 return hasReachableDefinition(D, &Hidden);
12005 }
12006
12007 bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
12008 AcceptableKind Kind,
12009 bool OnlyNeedComplete = false);
12011 NamedDecl *Hidden;
12012 return hasAcceptableDefinition(D, &Hidden, Kind);
12013 }
12014
12015private:
12016 bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
12017 CompleteTypeKind Kind, TypeDiagnoser *Diagnoser);
12018
12019 /// Nullability type specifiers.
12020 IdentifierInfo *Ident__Nonnull = nullptr;
12021 IdentifierInfo *Ident__Nullable = nullptr;
12022 IdentifierInfo *Ident__Nullable_result = nullptr;
12023 IdentifierInfo *Ident__Null_unspecified = nullptr;
12024
12025 IdentifierInfo *Ident_NSError = nullptr;
12026
12027 ///@}
12028
12029 //
12030 //
12031 // -------------------------------------------------------------------------
12032 //
12033 //
12034
12035 /// \name ObjC Declarations
12036 /// Implementations are in SemaDeclObjC.cpp
12037 ///@{
12038
12039public:
12048
12049 /// Method selectors used in a \@selector expression. Used for implementation
12050 /// of -Wselector.
12051 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
12052
12054 public:
12055 using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
12056 using iterator = llvm::DenseMap<Selector, Lists>::iterator;
12057 iterator begin() { return Methods.begin(); }
12058 iterator end() { return Methods.end(); }
12059 iterator find(Selector Sel) { return Methods.find(Sel); }
12060 std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
12061 return Methods.insert(Val);
12062 }
12063 int count(Selector Sel) const { return Methods.count(Sel); }
12064 bool empty() const { return Methods.empty(); }
12065
12066 private:
12067 llvm::DenseMap<Selector, Lists> Methods;
12068 };
12069
12070 /// Method Pool - allows efficient lookup when typechecking messages to "id".
12071 /// We need to maintain a list, since selectors can have differing signatures
12072 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
12073 /// of selectors are "overloaded").
12074 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
12075 /// methods inside categories with a particular selector.
12077
12078 /// Check ODR hashes for C/ObjC when merging types from modules.
12079 /// Differently from C++, actually parse the body and reject in case
12080 /// of a mismatch.
12081 template <typename T,
12082 typename = std::enable_if_t<std::is_base_of<NamedDecl, T>::value>>
12084 if (Duplicate->getODRHash() != Previous->getODRHash())
12085 return false;
12086
12087 // Make the previous decl visible.
12089 return true;
12090 }
12091
12093
12095
12106
12108 SourceLocation varianceLoc, unsigned index,
12109 IdentifierInfo *paramName,
12110 SourceLocation paramLoc,
12111 SourceLocation colonLoc, ParsedType typeBound);
12112
12114 ArrayRef<Decl *> typeParams,
12115 SourceLocation rAngleLoc);
12116 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
12117
12119 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
12120 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
12121 IdentifierInfo *SuperName, SourceLocation SuperLoc,
12122 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
12123 Decl *const *ProtoRefs, unsigned NumProtoRefs,
12124 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
12125 const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
12126
12128 Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
12129 IdentifierInfo *ClassName, SourceLocation ClassLoc,
12130 IdentifierInfo *SuperName, SourceLocation SuperLoc,
12131 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange);
12132
12134 SmallVectorImpl<SourceLocation> &ProtocolLocs,
12135 IdentifierInfo *SuperName,
12136 SourceLocation SuperLoc);
12137
12138 Decl *ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc,
12139 IdentifierInfo *AliasName,
12140 SourceLocation AliasLocation,
12141 IdentifierInfo *ClassName,
12142 SourceLocation ClassLocation);
12143
12145 IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc,
12146 const ObjCList<ObjCProtocolDecl> &PList);
12147
12149 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
12150 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
12151 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
12152 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
12153 SkipBodyInfo *SkipBody);
12154
12156 SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
12157 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
12158 IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
12159 Decl *const *ProtoRefs, unsigned NumProtoRefs,
12160 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
12161 const ParsedAttributesView &AttrList);
12162
12164 SourceLocation AtClassImplLoc, IdentifierInfo *ClassName,
12165 SourceLocation ClassLoc, IdentifierInfo *SuperClassname,
12166 SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
12167
12169 SourceLocation AtCatImplLoc, IdentifierInfo *ClassName,
12170 SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc,
12171 const ParsedAttributesView &AttrList);
12172
12174 ArrayRef<Decl *> Decls);
12175
12179 const ParsedAttributesView &attrList);
12180
12181 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
12182 ArrayRef<IdentifierLocPair> ProtocolId,
12183 SmallVectorImpl<Decl *> &Protocols);
12184
12186 SourceLocation ProtocolLoc,
12187 IdentifierInfo *TypeArgId,
12188 SourceLocation TypeArgLoc,
12189 bool SelectProtocolFirst = false);
12190
12191 /// Given a list of identifiers (and their locations), resolve the
12192 /// names to either Objective-C protocol qualifiers or type
12193 /// arguments, as appropriate.
12195 Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
12196 ArrayRef<IdentifierInfo *> identifiers,
12197 ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
12198 SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
12199 SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
12200 SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
12201 bool warnOnIncompleteProtocols);
12202
12205
12206 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
12207 ArrayRef<Decl *> allMethods = std::nullopt,
12208 ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
12209
12213 // The Type is null if no type was specified, and the DeclSpec is invalid
12214 // in this case.
12217
12218 /// ArgAttrs - Attribute list for this argument.
12220 };
12221
12223 Scope *S,
12224 SourceLocation BeginLoc, // location of the + or -.
12225 SourceLocation EndLoc, // location of the ; or {.
12226 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
12227 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
12228 // optional arguments. The number of types/arguments is obtained
12229 // from the Sel.getNumArgs().
12230 ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
12231 unsigned CNumArgs, // c-style args
12232 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
12233 bool isVariadic, bool MethodDefinition);
12234
12235 bool CheckARCMethodDecl(ObjCMethodDecl *method);
12236
12237 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
12238
12239 /// Check whether the given new method is a valid override of the
12240 /// given overridden method, and set any properties that should be inherited.
12242 const ObjCMethodDecl *Overridden);
12243
12244 /// Describes the compatibility of a result type with its method.
12250
12252 ObjCMethodDecl *overridden);
12253
12255 ObjCInterfaceDecl *CurrentClass,
12257
12258 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
12259 /// pool.
12261
12263 bool isObjCMethodDecl(Decl *D) { return D && isa<ObjCMethodDecl>(D); }
12264
12265 /// CheckImplementationIvars - This routine checks if the instance variables
12266 /// listed in the implelementation match those listed in the interface.
12268 ObjCIvarDecl **Fields, unsigned nIvars,
12269 SourceLocation Loc);
12270
12272 ObjCMethodDecl *MethodDecl,
12273 bool IsProtocolMethodDecl);
12274
12276 ObjCMethodDecl *Overridden,
12277 bool IsProtocolMethodDecl);
12278
12279 /// WarnExactTypedMethods - This routine issues a warning if method
12280 /// implementation declaration matches exactly that of its declaration.
12281 void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl,
12282 bool IsProtocolMethodDecl);
12283
12284 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
12285 /// or protocol against those declared in their implementations.
12287 const SelectorSet &InsMap, const SelectorSet &ClsMap,
12288 SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
12289 ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass,
12290 bool WarnCategoryMethodImpl = false);
12291
12292 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
12293 /// category matches with those implemented in its primary class and
12294 /// warns each time an exact match is found.
12296
12297 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
12298 /// remains unimplemented in the class or category \@implementation.
12300 ObjCContainerDecl *IDecl,
12301 bool IncompleteImpl = false);
12302
12304 SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs,
12305 ArrayRef<ObjCTypeParamList *> TypeParamLists, unsigned NumElts);
12306
12307 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
12308 /// true, or false, accordingly.
12309 bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
12310 const ObjCMethodDecl *PrevMethod,
12311 MethodMatchStrategy strategy = MMS_strict);
12312
12313 /// Add the given method to the list of globally-known methods.
12315
12316 void ReadMethodPool(Selector Sel);
12318
12319 /// - Returns instance or factory methods in global method pool for
12320 /// given selector. It checks the desired kind first, if none is found, and
12321 /// parameter checkTheOther is set, it then checks the other kind. If no such
12322 /// method or only one method is found, function returns false; otherwise, it
12323 /// returns true.
12324 bool
12327 bool InstanceFirst, bool CheckTheOther,
12328 const ObjCObjectType *TypeBound = nullptr);
12329
12330 bool
12332 SourceRange R, bool receiverIdOrClass,
12334
12335 void
12337 Selector Sel, SourceRange R,
12338 bool receiverIdOrClass);
12339
12340 const ObjCMethodDecl *
12342 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
12343 /// implementation.
12345
12347
12348 /// Checks that the Objective-C declaration is declared in the global scope.
12349 /// Emits an error and marks the declaration as invalid if it's not declared
12350 /// in the global scope.
12351 bool CheckObjCDeclScope(Decl *D);
12352
12353 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
12354 IdentifierInfo *ClassName, SmallVectorImpl<Decl *> &Decls);
12355
12357 SourceLocation StartLoc, SourceLocation IdLoc,
12358 IdentifierInfo *Id, bool Invalid = false);
12359
12361
12362 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
12363 /// initialization.
12364 void
12367
12369
12370 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar
12371 /// which backs the property is not used in the property's accessor.
12373 const ObjCImplementationDecl *ImplD);
12374
12375 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
12376 /// it property has a backing ivar, returns this ivar; otherwise, returns
12377 /// NULL. It also returns ivar's property on success.
12378 ObjCIvarDecl *
12380 const ObjCPropertyDecl *&PDecl) const;
12381
12382 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
12383 /// unit are added to a global pool. This allows us to efficiently associate
12384 /// a selector with a method declaraation for purposes of typechecking
12385 /// messages sent to "id" (where the class of the object is unknown).
12387 bool impl = false) {
12388 AddMethodToGlobalPool(Method, impl, /*instance*/ true);
12389 }
12390
12391 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
12392 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl = false) {
12393 AddMethodToGlobalPool(Method, impl, /*instance*/ false);
12394 }
12395
12396private:
12397 /// AddMethodToGlobalPool - Add an instance or factory method to the global
12398 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
12399 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
12400
12401 /// LookupMethodInGlobalPool - Returns the instance or factory method and
12402 /// optionally warns if there are multiple signatures.
12403 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
12404 bool receiverIdOrClass,
12405 bool instance);
12406
12407 ///@}
12408
12409 //
12410 //
12411 // -------------------------------------------------------------------------
12412 //
12413 //
12414
12415 /// \name ObjC Expressions
12416 /// Implementations are in SemaExprObjC.cpp
12417 ///@{
12418
12419public:
12420 /// Caches identifiers/selectors for NSFoundation APIs.
12421 std::unique_ptr<NSAPI> NSAPIObj;
12422
12423 /// The declaration of the Objective-C NSNumber class.
12425
12426 /// The declaration of the Objective-C NSValue class.
12428
12429 /// Pointer to NSNumber type (NSNumber *).
12431
12432 /// Pointer to NSValue type (NSValue *).
12434
12435 /// The Objective-C NSNumber methods used to create NSNumber literals.
12437
12438 /// The declaration of the Objective-C NSString class.
12440
12441 /// Pointer to NSString type (NSString *).
12443
12444 /// The declaration of the stringWithUTF8String: method.
12446
12447 /// The declaration of the valueWithBytes:objCType: method.
12449
12450 /// The declaration of the Objective-C NSArray class.
12452
12453 /// The declaration of the arrayWithObjects:count: method.
12455
12456 /// The declaration of the Objective-C NSDictionary class.
12458
12459 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
12461
12462 /// id<NSCopying> type.
12464
12465 /// will hold 'respondsToSelector:'
12467
12469 Expr *BaseExpr, SourceLocation OpLoc,
12470 DeclarationName MemberName,
12471 SourceLocation MemberLoc,
12472 SourceLocation SuperLoc,
12473 QualType SuperType, bool Super);
12474
12476 IdentifierInfo &propertyName,
12477 SourceLocation receiverNameLoc,
12478 SourceLocation propertyNameLoc);
12479
12480 // ParseObjCStringLiteral - Parse Objective-C string literals.
12482 ArrayRef<Expr *> Strings);
12483
12485
12486 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
12487 /// numeric literal expression. Type of the expression will be "NSNumber *"
12488 /// or "id" if NSNumber is unavailable.
12491 bool Value);
12493
12494 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
12495 /// '@' prefixed parenthesized expression. The type of the expression will
12496 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
12497 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
12498 /// "const char *" or C structure with attribute 'objc_boxable'.
12500
12502 Expr *IndexExpr,
12503 ObjCMethodDecl *getterMethod,
12504 ObjCMethodDecl *setterMethod);
12505
12509
12511 TypeSourceInfo *EncodedTypeInfo,
12512 SourceLocation RParenLoc);
12513
12515 SourceLocation EncodeLoc,
12516 SourceLocation LParenLoc, ParsedType Ty,
12517 SourceLocation RParenLoc);
12518
12519 /// ParseObjCSelectorExpression - Build selector expression for \@selector
12521 SourceLocation SelLoc,
12522 SourceLocation LParenLoc,
12523 SourceLocation RParenLoc,
12524 bool WarnMultipleSelectors);
12525
12526 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
12528 SourceLocation AtLoc,
12529 SourceLocation ProtoLoc,
12530 SourceLocation LParenLoc,
12531 SourceLocation ProtoIdLoc,
12532 SourceLocation RParenLoc);
12533
12535
12536 /// Describes the kind of message expression indicated by a message
12537 /// send that starts with an identifier.
12539 /// The message is sent to 'super'.
12541 /// The message is an instance message.
12543 /// The message is a class message, and the identifier is a type
12544 /// name.
12547
12549 SourceLocation NameLoc, bool IsSuper,
12550 bool HasTrailingDot,
12551 ParsedType &ReceiverType);
12552
12554 SourceLocation LBracLoc,
12555 ArrayRef<SourceLocation> SelectorLocs,
12556 SourceLocation RBracLoc, MultiExprArg Args);
12557
12559 QualType ReceiverType, SourceLocation SuperLoc,
12560 Selector Sel, ObjCMethodDecl *Method,
12561 SourceLocation LBracLoc,
12562 ArrayRef<SourceLocation> SelectorLocs,
12563 SourceLocation RBracLoc, MultiExprArg Args,
12564 bool isImplicit = false);
12565
12567 bool isSuperReceiver, SourceLocation Loc,
12568 Selector Sel, ObjCMethodDecl *Method,
12569 MultiExprArg Args);
12570
12572 SourceLocation LBracLoc,
12573 ArrayRef<SourceLocation> SelectorLocs,
12574 SourceLocation RBracLoc, MultiExprArg Args);
12575
12576 ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType,
12577 SourceLocation SuperLoc, Selector Sel,
12578 ObjCMethodDecl *Method,
12579 SourceLocation LBracLoc,
12580 ArrayRef<SourceLocation> SelectorLocs,
12581 SourceLocation RBracLoc, MultiExprArg Args,
12582 bool isImplicit = false);
12583
12584 ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType,
12585 SourceLocation Loc, Selector Sel,
12586 ObjCMethodDecl *Method,
12587 MultiExprArg Args);
12588
12590 SourceLocation LBracLoc,
12591 ArrayRef<SourceLocation> SelectorLocs,
12592 SourceLocation RBracLoc, MultiExprArg Args);
12593
12595 ObjCBridgeCastKind Kind,
12596 SourceLocation BridgeKeywordLoc,
12597 TypeSourceInfo *TSInfo, Expr *SubExpr);
12598
12600 ObjCBridgeCastKind Kind,
12601 SourceLocation BridgeKeywordLoc,
12602 ParsedType Type, SourceLocation RParenLoc,
12603 Expr *SubExpr);
12604
12606
12608
12610 CastKind &Kind);
12611
12613 QualType SrcType,
12614 ObjCInterfaceDecl *&RelatedClass,
12615 ObjCMethodDecl *&ClassMethod,
12616 ObjCMethodDecl *&InstanceMethod,
12617 TypedefNameDecl *&TDNDecl, bool CfToNs,
12618 bool Diagnose = true);
12619
12621 QualType SrcType, Expr *&SrcExpr,
12622 bool Diagnose = true);
12623
12624 /// Private Helper predicate to check for 'self'.
12625 bool isSelfExpr(Expr *RExpr);
12626 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
12627
12629 const ObjCObjectPointerType *OPT,
12630 bool IsInstance);
12632 bool IsInstance);
12633
12634 bool isKnownName(StringRef name);
12635
12637
12638 /// Checks for invalid conversions and casts between
12639 /// retainable pointers and other pointer kinds for ARC and Weak.
12641 QualType castType, Expr *&op,
12643 bool Diagnose = true,
12644 bool DiagnoseCFAudited = false,
12645 BinaryOperatorKind Opc = BO_PtrMemD);
12646
12649
12651 QualType ExprType);
12652
12653 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
12654 /// \param Method - May be null.
12655 /// \param [out] ReturnType - The return type of the send.
12656 /// \return true iff there were any incompatible types.
12657 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
12658 MultiExprArg Args, Selector Sel,
12659 ArrayRef<SourceLocation> SelectorLocs,
12660 ObjCMethodDecl *Method, bool isClassMessage,
12661 bool isSuperMessage, SourceLocation lbrac,
12662 SourceLocation rbrac, SourceRange RecRange,
12663 QualType &ReturnType, ExprValueKind &VK);
12664
12665 /// Determine the result of a message send expression based on
12666 /// the type of the receiver, the method expected to receive the message,
12667 /// and the form of the message send.
12668 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
12669 ObjCMethodDecl *Method, bool isClassMessage,
12670 bool isSuperMessage);
12671
12672 /// If the given expression involves a message send to a method
12673 /// with a related result type, emit a note describing what happened.
12674 void EmitRelatedResultTypeNote(const Expr *E);
12675
12676 /// Given that we had incompatible pointer types in a return
12677 /// statement, check whether we're in a method with a related result
12678 /// type, and if so, emit a note describing what happened.
12680
12681 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
12682 /// there are multiple signatures.
12685 bool receiverIdOrClass = false) {
12686 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
12687 /*instance*/ true);
12688 }
12689
12690 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
12691 /// there are multiple signatures.
12694 bool receiverIdOrClass = false) {
12695 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
12696 /*instance*/ false);
12697 }
12698
12699 ///@}
12700
12701 //
12702 //
12703 // -------------------------------------------------------------------------
12704 //
12705 //
12706
12707 /// \name ObjC @property and @synthesize
12708 /// Implementations are in SemaObjCProperty.cpp
12709 ///@{
12710
12711public:
12712 /// Ensure attributes are consistent with type.
12713 /// \param [in, out] Attributes The attributes to check; they will
12714 /// be modified to be consistent with \p PropertyTy.
12715 void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc,
12716 unsigned &Attributes,
12717 bool propertyInPrimaryClass);
12718
12719 /// Process the specified property declaration and create decls for the
12720 /// setters and getters as needed.
12721 /// \param property The property declaration being processed
12722 void ProcessPropertyDecl(ObjCPropertyDecl *property);
12723
12725 FieldDeclarator &FD, ObjCDeclSpec &ODS,
12726 Selector GetterSel, Selector SetterSel,
12727 tok::ObjCKeywordKind MethodImplKind,
12728 DeclContext *lexicalDC = nullptr);
12729
12731 SourceLocation PropertyLoc, bool ImplKind,
12732 IdentifierInfo *PropertyId,
12733 IdentifierInfo *PropertyIvar,
12734 SourceLocation PropertyIvarLoc,
12735 ObjCPropertyQueryKind QueryKind);
12736
12737 /// Called by ActOnProperty to handle \@property declarations in
12738 /// class extensions.
12740 Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
12741 FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc,
12742 Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite,
12743 unsigned &Attributes, const unsigned AttributesAsWritten, QualType T,
12744 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind);
12745
12746 /// Called by ActOnProperty and HandlePropertyInClassExtension to
12747 /// handle creating the ObjcPropertyDecl for a category or \@interface.
12750 SourceLocation LParenLoc, FieldDeclarator &FD,
12751 Selector GetterSel, SourceLocation GetterNameLoc,
12752 Selector SetterSel, SourceLocation SetterNameLoc,
12753 const bool isReadWrite, const unsigned Attributes,
12754 const unsigned AttributesAsWritten, QualType T,
12755 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind,
12756 DeclContext *lexicalDC = nullptr);
12757
12759 ObjCPropertyDecl *SuperProperty,
12760 const IdentifierInfo *Name,
12761 bool OverridingProtocolProperty);
12762
12764 ObjCMethodDecl *Getter,
12765 SourceLocation Loc);
12766
12767 /// DiagnoseUnimplementedProperties - This routine warns on those properties
12768 /// which must be implemented by this implementation.
12770 ObjCContainerDecl *CDecl,
12771 bool SynthesizeProperties);
12772
12773 /// Diagnose any null-resettable synthesized setters.
12775
12776 /// DefaultSynthesizeProperties - This routine default synthesizes all
12777 /// properties which must be synthesized in the class's \@implementation.
12779 ObjCInterfaceDecl *IDecl,
12780 SourceLocation AtEnd);
12782
12783 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
12784 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
12785 /// declared in class 'IFace'.
12787 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
12788
12790
12791 void
12793 const ObjCInterfaceDecl *IFD);
12794
12795 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
12796 /// warning) when atomic property has one but not the other user-declared
12797 /// setter or getter.
12799 ObjCInterfaceDecl *IDecl);
12800
12801 ///@}
12802
12803 //
12804 //
12805 // -------------------------------------------------------------------------
12806 //
12807 //
12808
12809 /// \name Code Completion
12810 /// Implementations are in SemaCodeComplete.cpp
12811 ///@{
12812
12813public:
12814 /// Code-completion consumer.
12816
12817 /// Describes the context in which code completion occurs.
12819 /// Code completion occurs at top-level or namespace context.
12821 /// Code completion occurs within a class, struct, or union.
12823 /// Code completion occurs within an Objective-C interface, protocol,
12824 /// or category.
12826 /// Code completion occurs within an Objective-C implementation or
12827 /// category implementation
12829 /// Code completion occurs within the list of instance variables
12830 /// in an Objective-C interface, protocol, category, or implementation.
12832 /// Code completion occurs following one or more template
12833 /// headers.
12835 /// Code completion occurs following one or more template
12836 /// headers within a class.
12838 /// Code completion occurs within an expression.
12840 /// Code completion occurs within a statement, which may
12841 /// also be an expression or a declaration.
12843 /// Code completion occurs at the beginning of the
12844 /// initialization statement (or expression) in a for loop.
12846 /// Code completion occurs within the condition of an if,
12847 /// while, switch, or for statement.
12849 /// Code completion occurs within the body of a function on a
12850 /// recovery path, where we do not have a specific handle on our position
12851 /// in the grammar.
12853 /// Code completion occurs where only a type is permitted.
12855 /// Code completion occurs in a parenthesized expression, which
12856 /// might also be a type cast.
12858 /// Code completion occurs within a sequence of declaration
12859 /// specifiers within a function, method, or block.
12861 /// Code completion occurs at top-level in a REPL session
12863 };
12864
12867 ParserCompletionContext CompletionContext);
12868 void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers,
12869 bool AllowNestedNameSpecifiers);
12870
12871 struct CodeCompleteExpressionData;
12872 void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data);
12873 void CodeCompleteExpression(Scope *S, QualType PreferredType,
12874 bool IsParenthesized = false);
12875 void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
12876 SourceLocation OpLoc, bool IsArrow,
12877 bool IsBaseExprStatement,
12878 QualType PreferredType);
12880 QualType PreferredType);
12881 void CodeCompleteTag(Scope *S, unsigned TagSpec);
12884 const VirtSpecifiers *VS = nullptr);
12886 void CodeCompleteCase(Scope *S);
12888 Attribute,
12889 Scope,
12890 None,
12891 };
12895 const IdentifierInfo *Scope = nullptr);
12896 /// Determines the preferred type of the current function argument, by
12897 /// examining the signatures of all possible overloads.
12898 /// Returns null if unknown or ambiguous, or if code completion is off.
12899 ///
12900 /// If the code completion point has been reached, also reports the function
12901 /// signatures that were considered.
12902 ///
12903 /// FIXME: rename to GuessCallArgumentType to reduce confusion.
12905 SourceLocation OpenParLoc);
12907 ArrayRef<Expr *> Args,
12908 SourceLocation OpenParLoc,
12909 bool Braced);
12911 Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy,
12912 ArrayRef<Expr *> ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc,
12913 bool Braced);
12916 void CodeCompleteInitializer(Scope *S, Decl *D);
12917 /// Trigger code completion for a record of \p BaseType. \p InitExprs are
12918 /// expressions in the initializer list seen so far and \p D is the current
12919 /// Designation being parsed.
12920 void CodeCompleteDesignator(const QualType BaseType,
12921 llvm::ArrayRef<Expr *> InitExprs,
12922 const Designation &D);
12923 void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
12924
12925 void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
12926 bool IsUsingDeclaration, QualType BaseType,
12927 QualType PreferredType);
12928 void CodeCompleteUsing(Scope *S);
12934 Decl *Constructor, ArrayRef<CXXCtorInitializer *> Initializers);
12935
12937 bool AfterAmpersand);
12939
12948 bool IsParameter);
12952 bool AtArgumentExpression);
12955 bool AtArgumentExpression,
12956 bool IsSuper = false);
12957 void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
12959 bool AtArgumentExpression,
12960 ObjCInterfaceDecl *Super = nullptr);
12961 void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar);
12963 void
12969 SourceLocation ClassNameLoc);
12972 SourceLocation ClassNameLoc);
12974 IdentifierInfo *ClassName,
12975 SourceLocation ClassNameLoc);
12978 IdentifierInfo *PropertyName);
12980 std::optional<bool> IsInstanceMethod,
12981 ParsedType ReturnType);
12982 void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod,
12983 bool AtParameterName,
12984 ParsedType ReturnType,
12985 ArrayRef<IdentifierInfo *> SelIdents);
12987 SourceLocation ClassNameLoc,
12988 bool IsBaseExprStatement);
12989 void CodeCompletePreprocessorDirective(bool InConditional);
12991 void CodeCompletePreprocessorMacroName(bool IsDefinition);
12995 unsigned Argument);
12996 void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
12999 void
13001 CodeCompletionTUInfo &CCTUInfo,
13003
13004 ///@}
13005
13006 //
13007 //
13008 // -------------------------------------------------------------------------
13009 //
13010 //
13011
13012 /// \name FixIt Helpers
13013 /// Implementations are in SemaFixItUtils.cpp
13014 ///@{
13015
13016public:
13017 /// Get a string to suggest for zero-initialization of a type.
13019 SourceLocation Loc) const;
13020 std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
13021
13022 ///@}
13023
13024 //
13025 //
13026 // -------------------------------------------------------------------------
13027 //
13028 //
13029
13030 /// \name API Notes
13031 /// Implementations are in SemaAPINotes.cpp
13032 ///@{
13033
13034public:
13035 /// Map any API notes provided for this declaration to attributes on the
13036 /// declaration.
13037 ///
13038 /// Triggered by declaration-attribute processing.
13039 void ProcessAPINotes(Decl *D);
13040
13041 ///@}
13042 //
13043 //
13044 // -------------------------------------------------------------------------
13045 //
13046 //
13047
13048 /// \name Name Lookup for RISC-V Vector Intrinsic
13049 /// Implementations are in SemaRISCVVectorLookup.cpp
13050 ///@{
13051
13052public:
13053 /// Indicate RISC-V vector builtin functions enabled or not.
13055
13056 /// Indicate RISC-V SiFive vector builtin functions enabled or not.
13058
13059private:
13060 std::unique_ptr<sema::RISCVIntrinsicManager> RVIntrinsicManager;
13061
13062 ///@}
13063
13064 //
13065 //
13066 // -------------------------------------------------------------------------
13067 //
13068 //
13069
13070 /// \name CUDA
13071 /// Implementations are in SemaCUDA.cpp
13072 ///@{
13073
13074public:
13075 /// Increments our count of the number of times we've seen a pragma forcing
13076 /// functions to be __host__ __device__. So long as this count is greater
13077 /// than zero, all functions encountered will be __host__ __device__.
13079
13080 /// Decrements our count of the number of times we've seen a pragma forcing
13081 /// functions to be __host__ __device__. Returns false if the count is 0
13082 /// before incrementing, so you can emit an error.
13084
13086 MultiExprArg ExecConfig,
13087 SourceLocation GGGLoc);
13088
13089 /// Diagnostics that are emitted only if we discover that the given function
13090 /// must be codegen'ed. Because handling these correctly adds overhead to
13091 /// compilation, this is currently only enabled for CUDA compilations.
13092 llvm::DenseMap<CanonicalDeclPtr<const FunctionDecl>,
13093 std::vector<PartialDiagnosticAt>>
13095
13096 /// A pair of a canonical FunctionDecl and a SourceLocation. When used as the
13097 /// key in a hashtable, both the FD and location are hashed.
13101 };
13102
13103 /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
13104 /// (maybe deferred) "bad call" diagnostic. We use this to avoid emitting the
13105 /// same deferred diag twice.
13107
13108 /// An inverse call graph, mapping known-emitted functions to one of their
13109 /// known-emitted callers (plus the location of the call).
13110 ///
13111 /// Functions that we can tell a priori must be emitted aren't added to this
13112 /// map.
13113 llvm::DenseMap</* Callee = */ CanonicalDeclPtr<const FunctionDecl>,
13114 /* Caller = */ FunctionDeclAndLoc>
13116
13117 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13118 /// context is "used as device code".
13119 ///
13120 /// - If CurContext is a __host__ function, does not emit any diagnostics
13121 /// unless \p EmitOnBothSides is true.
13122 /// - If CurContext is a __device__ or __global__ function, emits the
13123 /// diagnostics immediately.
13124 /// - If CurContext is a __host__ __device__ function and we are compiling for
13125 /// the device, creates a diagnostic which is emitted if and when we realize
13126 /// that the function will be codegen'ed.
13127 ///
13128 /// Example usage:
13129 ///
13130 /// // Variable-length arrays are not allowed in CUDA device code.
13131 /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
13132 /// return ExprError();
13133 /// // Otherwise, continue parsing as normal.
13135 unsigned DiagID);
13136
13137 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13138 /// context is "used as host code".
13139 ///
13140 /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
13142
13143 /// Determines whether the given function is a CUDA device/host/kernel/etc.
13144 /// function.
13145 ///
13146 /// Use this rather than examining the function's attributes yourself -- you
13147 /// will get it wrong. Returns CFT_Host if D is null.
13149 bool IgnoreImplicitHDAttr = false);
13151
13153 CVT_Device, /// Emitted on device side with a shadow variable on host side
13154 CVT_Host, /// Emitted on host side only
13155 CVT_Both, /// Emitted on both sides with different addresses
13156 CVT_Unified, /// Emitted as a unified address, e.g. managed variables
13157 };
13158 /// Determines whether the given variable is emitted on host or device side.
13160
13161 /// Defines kinds of CUDA global host/device context where a function may be
13162 /// called.
13164 CTCK_Unknown, /// Unknown context
13165 CTCK_InitGlobalVar, /// Function called during global variable
13166 /// initialization
13167 };
13168
13169 /// Define the current global CUDA host/device context where a function may be
13170 /// called. Only used when a function is called outside of any functions.
13172 CUDAFunctionTarget Target = CFT_HostDevice;
13173 CUDATargetContextKind Kind = CTCK_Unknown;
13174 Decl *D = nullptr;
13176
13181 ~CUDATargetContextRAII() { S.CurCUDATargetCtx = SavedCtx; }
13182 };
13183
13184 /// Gets the CUDA target for the current context.
13186 return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
13187 }
13188
13189 static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D);
13190
13191 // CUDA function call preference. Must be ordered numerically from
13192 // worst to best.
13194 CFP_Never, // Invalid caller/callee combination.
13195 CFP_WrongSide, // Calls from host-device to host or device
13196 // function that do not match current compilation
13197 // mode.
13198 CFP_HostDevice, // Any calls to host/device functions.
13199 CFP_SameSide, // Calls from host-device to host or device
13200 // function matching current compilation mode.
13201 CFP_Native, // host-to-host or device-to-device calls.
13202 };
13203
13204 /// Identifies relative preference of a given Caller/Callee
13205 /// combination, based on their host/device attributes.
13206 /// \param Caller function which needs address of \p Callee.
13207 /// nullptr in case of global context.
13208 /// \param Callee target function
13209 ///
13210 /// \returns preference value for particular Caller/Callee combination.
13212 const FunctionDecl *Callee);
13213
13214 /// Determines whether Caller may invoke Callee, based on their CUDA
13215 /// host/device attributes. Returns false if the call is not allowed.
13216 ///
13217 /// Note: Will return true for CFP_WrongSide calls. These may appear in
13218 /// semantically correct CUDA programs, but only if they're never codegen'ed.
13220 const FunctionDecl *Callee) {
13221 return IdentifyCUDAPreference(Caller, Callee) != CFP_Never;
13222 }
13223
13224 /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
13225 /// depending on FD and the current compilation settings.
13227 const LookupResult &Previous);
13228
13229 /// May add implicit CUDAConstantAttr attribute to VD, depending on VD
13230 /// and current compilation settings.
13232
13233 /// Check whether we're allowed to call Callee from the current context.
13234 ///
13235 /// - If the call is never allowed in a semantically-correct program
13236 /// (CFP_Never), emits an error and returns false.
13237 ///
13238 /// - If the call is allowed in semantically-correct programs, but only if
13239 /// it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
13240 /// be emitted if and when the caller is codegen'ed, and returns true.
13241 ///
13242 /// Will only create deferred diagnostics for a given SourceLocation once,
13243 /// so you can safely call this multiple times without generating duplicate
13244 /// deferred errors.
13245 ///
13246 /// - Otherwise, returns true without emitting any diagnostics.
13247 bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
13248
13250
13251 /// Set __device__ or __host__ __device__ attributes on the given lambda
13252 /// operator() method.
13253 ///
13254 /// CUDA lambdas by default is host device function unless it has explicit
13255 /// host or device attribute.
13256 void CUDASetLambdaAttrs(CXXMethodDecl *Method);
13257
13258 /// Record \p FD if it is a CUDA/HIP implicit host device function used on
13259 /// device side in device compilation.
13261
13262 /// Finds a function in \p Matches with highest calling priority
13263 /// from \p Caller context and erases all functions with lower
13264 /// calling priority.
13266 const FunctionDecl *Caller,
13267 SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
13268
13269 /// Given a implicit special member, infer its CUDA target from the
13270 /// calls it needs to make to underlying base/field special members.
13271 /// \param ClassDecl the class for which the member is being created.
13272 /// \param CSM the kind of special member.
13273 /// \param MemberDecl the special member itself.
13274 /// \param ConstRHS true if this is a copy operation with a const object on
13275 /// its RHS.
13276 /// \param Diagnose true if this call should emit diagnostics.
13277 /// \return true if there was an error inferring.
13278 /// The result of this call is implicit CUDA target attribute(s) attached to
13279 /// the member declaration.
13281 CXXSpecialMember CSM,
13282 CXXMethodDecl *MemberDecl,
13283 bool ConstRHS, bool Diagnose);
13284
13285 /// \return true if \p CD can be considered empty according to CUDA
13286 /// (E.2.3.1 in CUDA 7.5 Programming guide).
13289
13290 // \brief Checks that initializers of \p Var satisfy CUDA restrictions. In
13291 // case of error emits appropriate diagnostic and invalidates \p Var.
13292 //
13293 // \details CUDA allows only empty constructors as initializers for global
13294 // variables (see E.2.3.1, CUDA 7.5). The same restriction also applies to all
13295 // __shared__ variables whether they are local or not (they all are implicitly
13296 // static in CUDA). One exception is that CUDA allows constant initializers
13297 // for __constant__ and __device__ variables.
13299
13300 /// Check whether NewFD is a valid overload for CUDA. Emits
13301 /// diagnostics and invalidates NewFD if not.
13303 const LookupResult &Previous);
13304 /// Copies target attributes from the template TD to the function FD.
13306
13307 /// Returns the name of the launch configuration function. This is the name
13308 /// of the function that will be called to configure kernel call, with the
13309 /// parameters specified via <<<>>>.
13310 std::string getCudaConfigureFuncName() const;
13311
13312private:
13313 unsigned ForceCUDAHostDeviceDepth = 0;
13314
13315 ///@}
13316
13317 //
13318 //
13319 // -------------------------------------------------------------------------
13320 //
13321 //
13322
13323 /// \name HLSL Constructs
13324 /// Implementations are in SemaHLSL.cpp
13325 ///@{
13326
13327public:
13328 Decl *ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer,
13329 SourceLocation KwLoc, IdentifierInfo *Ident,
13330 SourceLocation IdentLoc, SourceLocation LBrace);
13331 void ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace);
13332
13333 bool CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13334
13335 bool SemaBuiltinVectorMath(CallExpr *TheCall, QualType &Res);
13337
13338 ///@}
13339
13340 //
13341 //
13342 // -------------------------------------------------------------------------
13343 //
13344 //
13345
13346 /// \name OpenACC Constructs
13347 /// Implementations are in SemaOpenACC.cpp
13348 ///@{
13349
13350public:
13351 /// Called after parsing an OpenACC Clause so that it can be checked.
13352 bool ActOnOpenACCClause(OpenACCClauseKind ClauseKind,
13353 SourceLocation StartLoc);
13354
13355 /// Called after the construct has been parsed, but clauses haven't been
13356 /// parsed. This allows us to diagnose not-implemented, as well as set up any
13357 /// state required for parsing the clauses.
13359
13360 /// Called after the directive, including its clauses, have been parsed and
13361 /// parsing has consumed the 'annot_pragma_openacc_end' token. This DOES
13362 /// happen before any associated declarations or statements have been parsed.
13363 /// This function is only called when we are parsing a 'statement' context.
13365 SourceLocation StartLoc);
13366
13367 /// Called after the directive, including its clauses, have been parsed and
13368 /// parsing has consumed the 'annot_pragma_openacc_end' token. This DOES
13369 /// happen before any associated declarations or statements have been parsed.
13370 /// This function is only called when we are parsing a 'Decl' context.
13372 SourceLocation StartLoc);
13373 /// Called when we encounter an associated statement for our construct, this
13374 /// should check legality of the statement as it appertains to this Construct.
13376 StmtResult AssocStmt);
13377
13378 /// Called after the directive has been completely parsed, including the
13379 /// declaration group or associated statement.
13381 SourceLocation StartLoc,
13382 SourceLocation EndLoc,
13383 StmtResult AssocStmt);
13384 /// Called after the directive has been completely parsed, including the
13385 /// declaration group or associated statement.
13387
13388 ///@}
13389
13390 //
13391 //
13392 // -------------------------------------------------------------------------
13393 //
13394 //
13395
13396 /// \name OpenMP Directives and Clauses
13397 /// Implementations are in SemaOpenMP.cpp
13398 ///@{
13399
13400public:
13401 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13402 /// context is "used as device code".
13403 ///
13404 /// - If CurContext is a `declare target` function or it is known that the
13405 /// function is emitted for the device, emits the diagnostics immediately.
13406 /// - If CurContext is a non-`declare target` function and we are compiling
13407 /// for the device, creates a diagnostic which is emitted if and when we
13408 /// realize that the function will be codegen'ed.
13409 ///
13410 /// Example usage:
13411 ///
13412 /// // Variable-length arrays are not allowed in NVPTX device code.
13413 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
13414 /// return ExprError();
13415 /// // Otherwise, continue parsing as normal.
13416 SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc,
13417 unsigned DiagID,
13418 const FunctionDecl *FD);
13419
13420 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13421 /// context is "used as host code".
13422 ///
13423 /// - If CurContext is a `declare target` function or it is known that the
13424 /// function is emitted for the host, emits the diagnostics immediately.
13425 /// - If CurContext is a non-host function, just ignore it.
13426 ///
13427 /// Example usage:
13428 ///
13429 /// // Variable-length arrays are not allowed in NVPTX device code.
13430 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
13431 /// return ExprError();
13432 /// // Otherwise, continue parsing as normal.
13433 SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc,
13434 unsigned DiagID,
13435 const FunctionDecl *FD);
13436
13437 /// Register \p D as specialization of all base functions in \p Bases in the
13438 /// current `omp begin/end declare variant` scope.
13441
13442 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
13444
13445 /// Can we exit an OpenMP declare variant scope at the moment.
13447 return !OMPDeclareVariantScopes.empty();
13448 }
13449
13452 bool StrictlyPositive = true,
13453 bool SuppressExprDiags = false);
13454
13455 /// Given the potential call expression \p Call, determine if there is a
13456 /// specialization via the OpenMP declare variant mechanism available. If
13457 /// there is, return the specialized call expression, otherwise return the
13458 /// original \p Call.
13460 SourceLocation LParenLoc, MultiExprArg ArgExprs,
13461 SourceLocation RParenLoc, Expr *ExecConfig);
13462
13463 /// Handle a `omp begin declare variant`.
13465
13466 /// Handle a `omp end declare variant`.
13468
13469 /// Function tries to capture lambda's captured variables in the OpenMP region
13470 /// before the original lambda is captured.
13472
13473 /// Return true if the provided declaration \a VD should be captured by
13474 /// reference.
13475 /// \param Level Relative level of nested OpenMP construct for that the check
13476 /// is performed.
13477 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
13478 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
13479 unsigned OpenMPCaptureLevel) const;
13480
13481 /// Check if the specified variable is used in one of the private
13482 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
13483 /// constructs.
13484 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
13485 unsigned StopAt = 0);
13486
13487 /// The member expression(this->fd) needs to be rebuilt in the template
13488 /// instantiation to generate private copy for OpenMP when default
13489 /// clause is used. The function will return true if default
13490 /// cluse is used.
13492
13495
13496 /// If the current region is a loop-based region, mark the start of the loop
13497 /// construct.
13498 void startOpenMPLoop();
13499
13500 /// If the current region is a range loop-based region, mark the start of the
13501 /// loop construct.
13503
13504 /// Check if the specified variable is used in 'private' clause.
13505 /// \param Level Relative level of nested OpenMP construct for that the check
13506 /// is performed.
13508 unsigned CapLevel) const;
13509
13510 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
13511 /// for \p FD based on DSA for the provided corresponding captured declaration
13512 /// \p D.
13513 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
13514
13515 /// Check if the specified variable is captured by 'target' directive.
13516 /// \param Level Relative level of nested OpenMP construct for that the check
13517 /// is performed.
13518 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
13519 unsigned CaptureLevel) const;
13520
13521 /// Check if the specified global variable must be captured by outer capture
13522 /// regions.
13523 /// \param Level Relative level of nested OpenMP construct for that
13524 /// the check is performed.
13525 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
13526 unsigned CaptureLevel) const;
13527
13529 Expr *Op);
13530 /// Called on start of new data sharing attribute block.
13532 const DeclarationNameInfo &DirName, Scope *CurScope,
13533 SourceLocation Loc);
13534 /// Start analysis of clauses.
13536 /// End analysis of clauses.
13537 void EndOpenMPClause();
13538 /// Called on end of data sharing attribute block.
13539 void EndOpenMPDSABlock(Stmt *CurDirective);
13540
13541 /// Check if the current region is an OpenMP loop region and if it is,
13542 /// mark loop control variable, used in \p Init for loop initialization, as
13543 /// private by default.
13544 /// \param Init First part of the for loop.
13546
13547 /// Called on well-formed '\#pragma omp metadirective' after parsing
13548 /// of the associated statement.
13550 Stmt *AStmt, SourceLocation StartLoc,
13551 SourceLocation EndLoc);
13552
13553 // OpenMP directives and clauses.
13554 /// Called on correct id-expression from the '#pragma omp
13555 /// threadprivate'.
13557 const DeclarationNameInfo &Id,
13558 OpenMPDirectiveKind Kind);
13559 /// Called on well-formed '#pragma omp threadprivate'.
13561 ArrayRef<Expr *> VarList);
13562 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
13564 ArrayRef<Expr *> VarList);
13565 /// Called on well-formed '#pragma omp allocate'.
13567 ArrayRef<Expr *> VarList,
13568 ArrayRef<OMPClause *> Clauses,
13569 DeclContext *Owner = nullptr);
13570
13571 /// Called on well-formed '#pragma omp [begin] assume[s]'.
13573 OpenMPDirectiveKind DKind,
13574 ArrayRef<std::string> Assumptions,
13575 bool SkippedClauses);
13576
13577 /// Check if there is an active global `omp begin assumes` directive.
13578 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
13579
13580 /// Check if there is an active global `omp assumes` directive.
13581 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
13582
13583 /// Called on well-formed '#pragma omp end assumes'.
13585
13586 /// Called on well-formed '#pragma omp requires'.
13588 ArrayRef<OMPClause *> ClauseList);
13589 /// Check restrictions on Requires directive
13591 ArrayRef<OMPClause *> Clauses);
13592 /// Check if the specified type is allowed to be used in 'omp declare
13593 /// reduction' construct.
13596 /// Called on start of '#pragma omp declare reduction'.
13598 Scope *S, DeclContext *DC, DeclarationName Name,
13599 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
13600 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
13601 /// Initialize declare reduction construct initializer.
13603 /// Finish current declare reduction construct initializer.
13605 /// Initialize declare reduction construct initializer.
13606 /// \return omp_priv variable.
13608 /// Finish current declare reduction construct initializer.
13610 VarDecl *OmpPrivParm);
13611 /// Called at the end of '#pragma omp declare reduction'.
13613 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
13614
13615 /// Check variable declaration in 'omp declare mapper' construct.
13617 /// Check if the specified type is allowed to be used in 'omp declare
13618 /// mapper' construct.
13621 /// Called on start of '#pragma omp declare mapper'.
13623 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
13625 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
13626 Decl *PrevDeclInScope = nullptr);
13627 /// Build the mapper variable of '#pragma omp declare mapper'.
13629 QualType MapperType,
13630 SourceLocation StartLoc,
13631 DeclarationName VN);
13633 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
13635
13637 struct MapInfo {
13638 OMPDeclareTargetDeclAttr::MapTypeTy MT;
13640 };
13641 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
13642 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
13643
13644 /// The 'device_type' as parsed from the clause.
13645 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
13646
13647 /// The directive kind, `begin declare target` or `declare target`.
13649
13650 /// The directive with indirect clause.
13651 std::optional<Expr *> Indirect;
13652
13653 /// The directive location.
13655
13657 : Kind(Kind), Loc(Loc) {}
13658 };
13659
13660 /// Called on the start of target region i.e. '#pragma omp declare target'.
13661 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
13662
13663 /// Called at the end of target region i.e. '#pragma omp end declare target'.
13664 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
13665
13666 /// Called once a target context is completed, that can be when a
13667 /// '#pragma omp end declare target' was encountered or when a
13668 /// '#pragma omp declare target' without declaration-definition-seq was
13669 /// encountered.
13670 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
13671
13672 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
13673 /// the end of a compilation unit.
13675
13676 /// Searches for the provided declaration name for OpenMP declare target
13677 /// directive.
13679 CXXScopeSpec &ScopeSpec,
13680 const DeclarationNameInfo &Id);
13681
13682 /// Called on correct id-expression from the '#pragma omp declare target'.
13684 OMPDeclareTargetDeclAttr::MapTypeTy MT,
13685 DeclareTargetContextInfo &DTCI);
13686
13687 /// Check declaration inside target region.
13688 void
13690 SourceLocation IdLoc = SourceLocation());
13691
13692 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
13693 /// directive.
13695
13696 /// Finishes analysis of the deferred functions calls that may be declared as
13697 /// host/nohost during device/host compilation.
13699 const FunctionDecl *Callee,
13700 SourceLocation Loc);
13701
13702 /// Return true if currently in OpenMP task with untied clause context.
13703 bool isInOpenMPTaskUntiedContext() const;
13704
13705 /// Return true inside OpenMP declare target region.
13707 return !DeclareTargetNesting.empty();
13708 }
13709 /// Return true inside OpenMP target region.
13711
13712 /// Return the number of captured regions created for an OpenMP directive.
13714
13715 /// Initialization of captured region for OpenMP region.
13716 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
13717
13718 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
13719 /// an OpenMP loop directive.
13721
13722 /// Process a canonical OpenMP loop nest that can either be a canonical
13723 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
13724 /// OpenMP loop transformation construct.
13726
13727 /// End of OpenMP region.
13728 ///
13729 /// \param S Statement associated with the current OpenMP region.
13730 /// \param Clauses List of clauses for the current OpenMP region.
13731 ///
13732 /// \returns Statement for finished OpenMP region.
13735 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
13736 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
13737 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc,
13738 OpenMPDirectiveKind PrevMappedDirective = llvm::omp::OMPD_unknown);
13739 /// Called on well-formed '\#pragma omp parallel' after parsing
13740 /// of the associated statement.
13742 Stmt *AStmt, SourceLocation StartLoc,
13743 SourceLocation EndLoc);
13745 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
13746 /// Called on well-formed '\#pragma omp simd' after parsing
13747 /// of the associated statement.
13750 SourceLocation StartLoc, SourceLocation EndLoc,
13751 VarsWithInheritedDSAType &VarsWithImplicitDSA);
13752 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
13753 /// the associated statement.
13755 Stmt *AStmt, SourceLocation StartLoc,
13756 SourceLocation EndLoc);
13757 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
13758 /// and the associated statement.
13760 Stmt *AStmt, SourceLocation StartLoc,
13761 SourceLocation EndLoc);
13762 /// Called on well-formed '\#pragma omp for' after parsing
13763 /// of the associated statement.
13766 SourceLocation StartLoc, SourceLocation EndLoc,
13767 VarsWithInheritedDSAType &VarsWithImplicitDSA);
13768 /// Called on well-formed '\#pragma omp for simd' after parsing
13769 /// of the associated statement.
13772 SourceLocation StartLoc, SourceLocation EndLoc,
13773 VarsWithInheritedDSAType &VarsWithImplicitDSA);
13774 /// Called on well-formed '\#pragma omp sections' after parsing
13775 /// of the associated statement.
13777 Stmt *AStmt, SourceLocation StartLoc,
13778 SourceLocation EndLoc);
13779 /// Called on well-formed '\#pragma omp section' after parsing of the
13780 /// associated statement.
13782 SourceLocation EndLoc);
13783 /// Called on well-formed '\#pragma omp scope' after parsing of the
13784 /// associated statement.
13786 Stmt *AStmt, SourceLocation StartLoc,
13787 SourceLocation EndLoc);
13788 /// Called on well-formed '\#pragma omp single' after parsing of the
13789 /// associated statement.
13791 Stmt *AStmt, SourceLocation StartLoc,
13792 SourceLocation EndLoc);
13793 /// Called on well-formed '\#pragma omp master' after parsing of the
13794 /// associated statement.
13796 SourceLocation EndLoc);
13797 /// Called on well-formed '\#pragma omp critical' after parsing of the
13798 /// associated statement.
13800 ArrayRef<OMPClause *> Clauses,
13801 Stmt *AStmt, SourceLocation StartLoc,
13802 SourceLocation EndLoc);
13803 /// Called on well-formed '\#pragma omp parallel for' after parsing
13804 /// of the associated statement.
13806 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13807 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13808 /// Called on well-formed '\#pragma omp parallel for simd' after
13809 /// parsing of the associated statement.
13811 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13812 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13813 /// Called on well-formed '\#pragma omp parallel master' after
13814 /// parsing of the associated statement.
13816 Stmt *AStmt,
13817 SourceLocation StartLoc,
13818 SourceLocation EndLoc);
13819 /// Called on well-formed '\#pragma omp parallel masked' after
13820 /// parsing of the associated statement.
13822 Stmt *AStmt,
13823 SourceLocation StartLoc,
13824 SourceLocation EndLoc);
13825 /// Called on well-formed '\#pragma omp parallel sections' after
13826 /// parsing of the associated statement.
13828 Stmt *AStmt,
13829 SourceLocation StartLoc,
13830 SourceLocation EndLoc);
13831 /// Called on well-formed '\#pragma omp task' after parsing of the
13832 /// associated statement.
13834 Stmt *AStmt, SourceLocation StartLoc,
13835 SourceLocation EndLoc);
13836 /// Called on well-formed '\#pragma omp taskyield'.
13838 SourceLocation EndLoc);
13839 /// Called on well-formed '\#pragma omp error'.
13840 /// Error direcitive is allowed in both declared and excutable contexts.
13841 /// Adding InExContext to identify which context is called from.
13843 SourceLocation StartLoc,
13844 SourceLocation EndLoc,
13845 bool InExContext = true);
13846 /// Called on well-formed '\#pragma omp barrier'.
13848 SourceLocation EndLoc);
13849 /// Called on well-formed '\#pragma omp taskwait'.
13851 SourceLocation StartLoc,
13852 SourceLocation EndLoc);
13853 /// Called on well-formed '\#pragma omp taskgroup'.
13855 Stmt *AStmt, SourceLocation StartLoc,
13856 SourceLocation EndLoc);
13857 /// Called on well-formed '\#pragma omp flush'.
13859 SourceLocation StartLoc,
13860 SourceLocation EndLoc);
13861 /// Called on well-formed '\#pragma omp depobj'.
13863 SourceLocation StartLoc,
13864 SourceLocation EndLoc);
13865 /// Called on well-formed '\#pragma omp scan'.
13867 SourceLocation StartLoc,
13868 SourceLocation EndLoc);
13869 /// Called on well-formed '\#pragma omp ordered' after parsing of the
13870 /// associated statement.
13872 Stmt *AStmt, SourceLocation StartLoc,
13873 SourceLocation EndLoc);
13874 /// Called on well-formed '\#pragma omp atomic' after parsing of the
13875 /// associated statement.
13877 Stmt *AStmt, SourceLocation StartLoc,
13878 SourceLocation EndLoc);
13879 /// Called on well-formed '\#pragma omp target' after parsing of the
13880 /// associated statement.
13882 Stmt *AStmt, SourceLocation StartLoc,
13883 SourceLocation EndLoc);
13884 /// Called on well-formed '\#pragma omp target data' after parsing of
13885 /// the associated statement.
13887 Stmt *AStmt,
13888 SourceLocation StartLoc,
13889 SourceLocation EndLoc);
13890 /// Called on well-formed '\#pragma omp target enter data' after
13891 /// parsing of the associated statement.
13893 SourceLocation StartLoc,
13894 SourceLocation EndLoc,
13895 Stmt *AStmt);
13896 /// Called on well-formed '\#pragma omp target exit data' after
13897 /// parsing of the associated statement.
13899 SourceLocation StartLoc,
13900 SourceLocation EndLoc,
13901 Stmt *AStmt);
13902 /// Called on well-formed '\#pragma omp target parallel' after
13903 /// parsing of the associated statement.
13905 Stmt *AStmt,
13906 SourceLocation StartLoc,
13907 SourceLocation EndLoc);
13908 /// Called on well-formed '\#pragma omp target parallel for' after
13909 /// parsing of the associated statement.
13911 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13912 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13913 /// Called on well-formed '\#pragma omp teams' after parsing of the
13914 /// associated statement.
13916 Stmt *AStmt, SourceLocation StartLoc,
13917 SourceLocation EndLoc);
13918 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
13919 /// associated statement.
13921 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13922 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13923 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
13924 /// the associated statement.
13926 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13927 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13928 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
13929 /// associated statement.
13931 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13932 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13933 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
13934 /// of the associated statement.
13936 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13937 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13938 /// Called on well-formed '\#pragma omp cancellation point'.
13941 SourceLocation EndLoc,
13942 OpenMPDirectiveKind CancelRegion);
13943 /// Called on well-formed '\#pragma omp cancel'.
13945 SourceLocation StartLoc,
13946 SourceLocation EndLoc,
13947 OpenMPDirectiveKind CancelRegion);
13948 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
13949 /// associated statement.
13952 SourceLocation StartLoc, SourceLocation EndLoc,
13953 VarsWithInheritedDSAType &VarsWithImplicitDSA);
13954 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
13955 /// the associated statement.
13957 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13958 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13959 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
13960 /// associated statement.
13962 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13963 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13964 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
13965 /// the associated statement.
13967 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13968 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13969 /// Called on well-formed '\#pragma omp parallel master taskloop' after
13970 /// parsing of the associated statement.
13972 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13973 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13974 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
13975 /// parsing of the associated statement.
13977 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13978 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13979 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
13980 /// associated statement.
13982 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13983 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13984 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
13985 /// the associated statement.
13987 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13988 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13989 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
13990 /// parsing of the associated statement.
13992 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13993 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13994 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
13995 /// parsing of the associated statement.
13997 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
13998 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
13999 /// Called on well-formed '\#pragma omp distribute' after parsing
14000 /// of the associated statement.
14003 SourceLocation StartLoc, SourceLocation EndLoc,
14004 VarsWithInheritedDSAType &VarsWithImplicitDSA);
14005 /// Called on well-formed '\#pragma omp target update'.
14007 SourceLocation StartLoc,
14008 SourceLocation EndLoc,
14009 Stmt *AStmt);
14010 /// Called on well-formed '\#pragma omp distribute parallel for' after
14011 /// parsing of the associated statement.
14013 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14014 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14015 /// Called on well-formed '\#pragma omp distribute parallel for simd'
14016 /// after parsing of the associated statement.
14018 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14019 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14020 /// Called on well-formed '\#pragma omp distribute simd' after
14021 /// parsing of the associated statement.
14023 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14024 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14025 /// Called on well-formed '\#pragma omp target parallel for simd' after
14026 /// parsing of the associated statement.
14028 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14029 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14030 /// Called on well-formed '\#pragma omp target simd' after parsing of
14031 /// the associated statement.
14034 SourceLocation StartLoc, SourceLocation EndLoc,
14035 VarsWithInheritedDSAType &VarsWithImplicitDSA);
14036 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
14037 /// the associated statement.
14039 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14040 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14041 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
14042 /// of the associated statement.
14044 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14045 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14046 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
14047 /// after parsing of the associated statement.
14049 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14050 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14051 /// Called on well-formed '\#pragma omp teams distribute parallel for'
14052 /// after parsing of the associated statement.
14054 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14055 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14056 /// Called on well-formed '\#pragma omp target teams' after parsing of the
14057 /// associated statement.
14059 Stmt *AStmt,
14060 SourceLocation StartLoc,
14061 SourceLocation EndLoc);
14062 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
14063 /// of the associated statement.
14065 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14066 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14067 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
14068 /// after parsing of the associated statement.
14070 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14071 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14072 /// Called on well-formed '\#pragma omp target teams distribute parallel for
14073 /// simd' after parsing of the associated statement.
14075 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14076 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14077 /// Called on well-formed '\#pragma omp target teams distribute simd' after
14078 /// parsing of the associated statement.
14080 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14081 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14082 /// Called on well-formed '\#pragma omp interop'.
14084 SourceLocation StartLoc,
14085 SourceLocation EndLoc);
14086 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
14087 // /associated statement.
14089 Stmt *AStmt, SourceLocation StartLoc,
14090 SourceLocation EndLoc);
14091 /// Called on well-formed '\#pragma omp masked' after parsing of the
14092 // /associated statement.
14094 Stmt *AStmt, SourceLocation StartLoc,
14095 SourceLocation EndLoc);
14096
14097 /// Called on well-formed '\#pragma omp loop' after parsing of the
14098 /// associated statement.
14100 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
14101 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
14102
14103 /// Checks correctness of linear modifiers.
14105 SourceLocation LinLoc);
14106 /// Checks that the specified declaration matches requirements for the linear
14107 /// decls.
14110 bool IsDeclareSimd = false);
14111
14112 /// Called on well-formed '\#pragma omp declare simd' after parsing of
14113 /// the associated method/function.
14115 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
14116 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
14117 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
14118 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
14119
14120 /// Checks '\#pragma omp declare variant' variant function and original
14121 /// functions after parsing of the associated method/function.
14122 /// \param DG Function declaration to which declare variant directive is
14123 /// applied to.
14124 /// \param VariantRef Expression that references the variant function, which
14125 /// must be used instead of the original one, specified in \p DG.
14126 /// \param TI The trait info object representing the match clause.
14127 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
14128 /// in checking.
14129 /// \returns std::nullopt, if the function/variant function are not compatible
14130 /// with the pragma, pair of original function/variant ref expression
14131 /// otherwise.
14132 std::optional<std::pair<FunctionDecl *, Expr *>>
14134 OMPTraitInfo &TI, unsigned NumAppendArgs,
14135 SourceRange SR);
14136
14137 /// Called on well-formed '\#pragma omp declare variant' after parsing of
14138 /// the associated method/function.
14139 /// \param FD Function declaration to which declare variant directive is
14140 /// applied to.
14141 /// \param VariantRef Expression that references the variant function, which
14142 /// must be used instead of the original one, specified in \p DG.
14143 /// \param TI The context traits associated with the function variant.
14144 /// \param AdjustArgsNothing The list of 'nothing' arguments.
14145 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
14146 /// \param AppendArgs The list of 'append_args' arguments.
14147 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
14148 /// \param AppendArgsLoc The Location of an 'append_args' clause.
14149 /// \param SR The SourceRange of the 'declare variant' directive.
14151 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
14152 ArrayRef<Expr *> AdjustArgsNothing,
14153 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
14154 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
14155 SourceLocation AppendArgsLoc, SourceRange SR);
14156
14158 SourceLocation StartLoc,
14159 SourceLocation LParenLoc,
14160 SourceLocation EndLoc);
14161 /// Called on well-formed 'allocator' clause.
14163 SourceLocation StartLoc,
14164 SourceLocation LParenLoc,
14165 SourceLocation EndLoc);
14166 /// Called on well-formed 'if' clause.
14168 Expr *Condition, SourceLocation StartLoc,
14169 SourceLocation LParenLoc,
14170 SourceLocation NameModifierLoc,
14171 SourceLocation ColonLoc,
14172 SourceLocation EndLoc);
14173 /// Called on well-formed 'final' clause.
14175 SourceLocation LParenLoc,
14176 SourceLocation EndLoc);
14177 /// Called on well-formed 'num_threads' clause.
14179 SourceLocation StartLoc,
14180 SourceLocation LParenLoc,
14181 SourceLocation EndLoc);
14182 /// Called on well-formed 'align' clause.
14184 SourceLocation LParenLoc,
14185 SourceLocation EndLoc);
14186 /// Called on well-formed 'safelen' clause.
14188 SourceLocation LParenLoc,
14189 SourceLocation EndLoc);
14190 /// Called on well-formed 'simdlen' clause.
14192 SourceLocation LParenLoc,
14193 SourceLocation EndLoc);
14194 /// Called on well-form 'sizes' clause.
14196 SourceLocation StartLoc,
14197 SourceLocation LParenLoc,
14198 SourceLocation EndLoc);
14199 /// Called on well-form 'full' clauses.
14201 SourceLocation EndLoc);
14202 /// Called on well-form 'partial' clauses.
14204 SourceLocation LParenLoc,
14205 SourceLocation EndLoc);
14206 /// Called on well-formed 'collapse' clause.
14208 SourceLocation StartLoc,
14209 SourceLocation LParenLoc,
14210 SourceLocation EndLoc);
14211 /// Called on well-formed 'ordered' clause.
14212 OMPClause *
14214 SourceLocation LParenLoc = SourceLocation(),
14215 Expr *NumForLoops = nullptr);
14216 /// Called on well-formed 'grainsize' clause.
14218 Expr *Size, SourceLocation StartLoc,
14219 SourceLocation LParenLoc,
14220 SourceLocation ModifierLoc,
14221 SourceLocation EndLoc);
14222 /// Called on well-formed 'num_tasks' clause.
14224 Expr *NumTasks, SourceLocation StartLoc,
14225 SourceLocation LParenLoc,
14226 SourceLocation ModifierLoc,
14227 SourceLocation EndLoc);
14228 /// Called on well-formed 'hint' clause.
14230 SourceLocation LParenLoc,
14231 SourceLocation EndLoc);
14232 /// Called on well-formed 'detach' clause.
14234 SourceLocation LParenLoc,
14235 SourceLocation EndLoc);
14236
14237 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
14238 SourceLocation ArgumentLoc,
14239 SourceLocation StartLoc,
14240 SourceLocation LParenLoc,
14241 SourceLocation EndLoc);
14242 /// Called on well-formed 'when' clause.
14244 SourceLocation LParenLoc,
14245 SourceLocation EndLoc);
14246 /// Called on well-formed 'default' clause.
14247 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
14248 SourceLocation KindLoc,
14249 SourceLocation StartLoc,
14250 SourceLocation LParenLoc,
14251 SourceLocation EndLoc);
14252 /// Called on well-formed 'proc_bind' clause.
14253 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
14254 SourceLocation KindLoc,
14255 SourceLocation StartLoc,
14256 SourceLocation LParenLoc,
14257 SourceLocation EndLoc);
14258 /// Called on well-formed 'order' clause.
14261 SourceLocation StartLoc,
14262 SourceLocation LParenLoc,
14263 SourceLocation MLoc, SourceLocation KindLoc,
14264 SourceLocation EndLoc);
14265 /// Called on well-formed 'update' clause.
14267 SourceLocation KindLoc,
14268 SourceLocation StartLoc,
14269 SourceLocation LParenLoc,
14270 SourceLocation EndLoc);
14271
14273 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
14274 SourceLocation StartLoc, SourceLocation LParenLoc,
14275 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
14276 SourceLocation EndLoc);
14277 /// Called on well-formed 'schedule' clause.
14280 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
14281 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
14282 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
14283
14285 SourceLocation EndLoc);
14286 /// Called on well-formed 'nowait' clause.
14288 SourceLocation EndLoc);
14289 /// Called on well-formed 'untied' clause.
14291 SourceLocation EndLoc);
14292 /// Called on well-formed 'mergeable' clause.
14294 SourceLocation EndLoc);
14295 /// Called on well-formed 'read' clause.
14297 SourceLocation EndLoc);
14298 /// Called on well-formed 'write' clause.
14300 SourceLocation EndLoc);
14301 /// Called on well-formed 'update' clause.
14303 SourceLocation EndLoc);
14304 /// Called on well-formed 'capture' clause.
14306 SourceLocation EndLoc);
14307 /// Called on well-formed 'compare' clause.
14309 SourceLocation EndLoc);
14310 /// Called on well-formed 'fail' clause.
14312 SourceLocation EndLoc);
14314 SourceLocation KindLoc,
14315 SourceLocation StartLoc,
14316 SourceLocation LParenLoc,
14317 SourceLocation EndLoc);
14318
14319 /// Called on well-formed 'seq_cst' clause.
14321 SourceLocation EndLoc);
14322 /// Called on well-formed 'acq_rel' clause.
14324 SourceLocation EndLoc);
14325 /// Called on well-formed 'acquire' clause.
14327 SourceLocation EndLoc);
14328 /// Called on well-formed 'release' clause.
14330 SourceLocation EndLoc);
14331 /// Called on well-formed 'relaxed' clause.
14333 SourceLocation EndLoc);
14334 /// Called on well-formed 'weak' clause.
14336 SourceLocation EndLoc);
14337
14338 /// Called on well-formed 'init' clause.
14339 OMPClause *
14340 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
14341 SourceLocation StartLoc, SourceLocation LParenLoc,
14342 SourceLocation VarLoc, SourceLocation EndLoc);
14343
14344 /// Called on well-formed 'use' clause.
14345 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
14346 SourceLocation LParenLoc,
14347 SourceLocation VarLoc, SourceLocation EndLoc);
14348
14349 /// Called on well-formed 'destroy' clause.
14351 SourceLocation LParenLoc,
14352 SourceLocation VarLoc,
14353 SourceLocation EndLoc);
14354 /// Called on well-formed 'novariants' clause.
14356 SourceLocation StartLoc,
14357 SourceLocation LParenLoc,
14358 SourceLocation EndLoc);
14359 /// Called on well-formed 'nocontext' clause.
14361 SourceLocation StartLoc,
14362 SourceLocation LParenLoc,
14363 SourceLocation EndLoc);
14364 /// Called on well-formed 'filter' clause.
14366 SourceLocation LParenLoc,
14367 SourceLocation EndLoc);
14368 /// Called on well-formed 'threads' clause.
14370 SourceLocation EndLoc);
14371 /// Called on well-formed 'simd' clause.
14373 SourceLocation EndLoc);
14374 /// Called on well-formed 'nogroup' clause.
14376 SourceLocation EndLoc);
14377 /// Called on well-formed 'unified_address' clause.
14379 SourceLocation EndLoc);
14380
14381 /// Called on well-formed 'unified_address' clause.
14383 SourceLocation EndLoc);
14384
14385 /// Called on well-formed 'reverse_offload' clause.
14387 SourceLocation EndLoc);
14388
14389 /// Called on well-formed 'dynamic_allocators' clause.
14391 SourceLocation EndLoc);
14392
14393 /// Called on well-formed 'atomic_default_mem_order' clause.
14396 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
14397
14398 /// Called on well-formed 'at' clause.
14400 SourceLocation KindLoc,
14401 SourceLocation StartLoc,
14402 SourceLocation LParenLoc,
14403 SourceLocation EndLoc);
14404
14405 /// Called on well-formed 'severity' clause.
14407 SourceLocation KindLoc,
14408 SourceLocation StartLoc,
14409 SourceLocation LParenLoc,
14410 SourceLocation EndLoc);
14411
14412 /// Called on well-formed 'message' clause.
14413 /// passing string for message.
14415 SourceLocation LParenLoc,
14416 SourceLocation EndLoc);
14417
14418 /// Data used for processing a list of variables in OpenMP clauses.
14419 struct OpenMPVarListDataTy final {
14420 Expr *DepModOrTailExpr = nullptr;
14421 Expr *IteratorExpr = nullptr;
14426 int ExtraModifier = -1; ///< Additional modifier for linear, map, depend or
14427 ///< lastprivate clause.
14435 bool IsMapTypeImplicit = false;
14439 StepModifierLoc; /// 'step' modifier location for linear clause
14440 };
14441
14443 ArrayRef<Expr *> Vars,
14444 const OMPVarListLocTy &Locs,
14446 /// Called on well-formed 'inclusive' clause.
14448 SourceLocation StartLoc,
14449 SourceLocation LParenLoc,
14450 SourceLocation EndLoc);
14451 /// Called on well-formed 'exclusive' clause.
14453 SourceLocation StartLoc,
14454 SourceLocation LParenLoc,
14455 SourceLocation EndLoc);
14456 /// Called on well-formed 'allocate' clause.
14457 OMPClause *
14459 SourceLocation StartLoc, SourceLocation ColonLoc,
14460 SourceLocation LParenLoc, SourceLocation EndLoc);
14461 /// Called on well-formed 'private' clause.
14463 SourceLocation StartLoc,
14464 SourceLocation LParenLoc,
14465 SourceLocation EndLoc);
14466 /// Called on well-formed 'firstprivate' clause.
14468 SourceLocation StartLoc,
14469 SourceLocation LParenLoc,
14470 SourceLocation EndLoc);
14471 /// Called on well-formed 'lastprivate' clause.
14474 SourceLocation LPKindLoc, SourceLocation ColonLoc,
14475 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
14476 /// Called on well-formed 'shared' clause.
14478 SourceLocation StartLoc,
14479 SourceLocation LParenLoc,
14480 SourceLocation EndLoc);
14481 /// Called on well-formed 'reduction' clause.
14484 SourceLocation StartLoc, SourceLocation LParenLoc,
14485 SourceLocation ModifierLoc, SourceLocation ColonLoc,
14486 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
14487 const DeclarationNameInfo &ReductionId,
14488 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
14489 /// Called on well-formed 'task_reduction' clause.
14491 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
14492 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
14493 CXXScopeSpec &ReductionIdScopeSpec,
14494 const DeclarationNameInfo &ReductionId,
14495 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
14496 /// Called on well-formed 'in_reduction' clause.
14498 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
14499 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
14500 CXXScopeSpec &ReductionIdScopeSpec,
14501 const DeclarationNameInfo &ReductionId,
14502 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
14503 /// Called on well-formed 'linear' clause.
14505 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
14506 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
14507 SourceLocation LinLoc, SourceLocation ColonLoc,
14508 SourceLocation StepModifierLoc, SourceLocation EndLoc);
14509 /// Called on well-formed 'aligned' clause.
14511 SourceLocation StartLoc,
14512 SourceLocation LParenLoc,
14513 SourceLocation ColonLoc,
14514 SourceLocation EndLoc);
14515 /// Called on well-formed 'copyin' clause.
14517 SourceLocation StartLoc,
14518 SourceLocation LParenLoc,
14519 SourceLocation EndLoc);
14520 /// Called on well-formed 'copyprivate' clause.
14522 SourceLocation StartLoc,
14523 SourceLocation LParenLoc,
14524 SourceLocation EndLoc);
14525 /// Called on well-formed 'flush' pseudo clause.
14527 SourceLocation StartLoc,
14528 SourceLocation LParenLoc,
14529 SourceLocation EndLoc);
14530 /// Called on well-formed 'depobj' pseudo clause.
14532 SourceLocation LParenLoc,
14533 SourceLocation EndLoc);
14534 /// Called on well-formed 'depend' clause.
14536 Expr *DepModifier,
14537 ArrayRef<Expr *> VarList,
14538 SourceLocation StartLoc,
14539 SourceLocation LParenLoc,
14540 SourceLocation EndLoc);
14541 /// Called on well-formed 'device' clause.
14543 Expr *Device, SourceLocation StartLoc,
14544 SourceLocation LParenLoc,
14545 SourceLocation ModifierLoc,
14546 SourceLocation EndLoc);
14547 /// Called on well-formed 'map' clause.
14549 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
14550 ArrayRef<SourceLocation> MapTypeModifiersLoc,
14551 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
14552 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
14553 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
14554 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
14555 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
14556 /// Called on well-formed 'num_teams' clause.
14558 SourceLocation LParenLoc,
14559 SourceLocation EndLoc);
14560 /// Called on well-formed 'thread_limit' clause.
14562 SourceLocation StartLoc,
14563 SourceLocation LParenLoc,
14564 SourceLocation EndLoc);
14565 /// Called on well-formed 'priority' clause.
14567 SourceLocation LParenLoc,
14568 SourceLocation EndLoc);
14569 /// Called on well-formed 'dist_schedule' clause.
14571 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
14572 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
14573 SourceLocation CommaLoc, SourceLocation EndLoc);
14574 /// Called on well-formed 'defaultmap' clause.
14577 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
14578 SourceLocation KindLoc, SourceLocation EndLoc);
14579 /// Called on well-formed 'to' clause.
14580 OMPClause *
14582 ArrayRef<SourceLocation> MotionModifiersLoc,
14583 CXXScopeSpec &MapperIdScopeSpec,
14584 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
14585 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
14586 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
14587 /// Called on well-formed 'from' clause.
14588 OMPClause *
14590 ArrayRef<SourceLocation> MotionModifiersLoc,
14591 CXXScopeSpec &MapperIdScopeSpec,
14592 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
14593 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
14594 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
14595 /// Called on well-formed 'use_device_ptr' clause.
14597 const OMPVarListLocTy &Locs);
14598 /// Called on well-formed 'use_device_addr' clause.
14600 const OMPVarListLocTy &Locs);
14601 /// Called on well-formed 'is_device_ptr' clause.
14603 const OMPVarListLocTy &Locs);
14604 /// Called on well-formed 'has_device_addr' clause.
14606 const OMPVarListLocTy &Locs);
14607 /// Called on well-formed 'nontemporal' clause.
14609 SourceLocation StartLoc,
14610 SourceLocation LParenLoc,
14611 SourceLocation EndLoc);
14612
14613 /// Data for list of allocators.
14615 /// Allocator.
14616 Expr *Allocator = nullptr;
14617 /// Allocator traits.
14618 Expr *AllocatorTraits = nullptr;
14619 /// Locations of '(' and ')' symbols.
14621 };
14622 /// Called on well-formed 'uses_allocators' clause.
14624 SourceLocation LParenLoc,
14625 SourceLocation EndLoc,
14627 /// Called on well-formed 'affinity' clause.
14629 SourceLocation LParenLoc,
14630 SourceLocation ColonLoc,
14631 SourceLocation EndLoc, Expr *Modifier,
14632 ArrayRef<Expr *> Locators);
14633 /// Called on a well-formed 'bind' clause.
14635 SourceLocation KindLoc,
14636 SourceLocation StartLoc,
14637 SourceLocation LParenLoc,
14638 SourceLocation EndLoc);
14639
14640 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
14642 SourceLocation LParenLoc,
14643 SourceLocation EndLoc);
14644
14645 /// Called on well-formed 'doacross' clause.
14646 OMPClause *
14648 SourceLocation DepLoc, SourceLocation ColonLoc,
14649 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
14650 SourceLocation LParenLoc, SourceLocation EndLoc);
14651
14652 /// Called on a well-formed 'ompx_attribute' clause.
14654 SourceLocation StartLoc,
14655 SourceLocation LParenLoc,
14656 SourceLocation EndLoc);
14657
14658 /// Called on a well-formed 'ompx_bare' clause.
14660 SourceLocation EndLoc);
14661
14662private:
14663 void *VarDataSharingAttributesStack;
14664
14665 /// Number of nested '#pragma omp declare target' directives.
14666 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
14667
14668 /// Initialization of data-sharing attributes stack.
14669 void InitDataSharingAttributesStack();
14670 void DestroyDataSharingAttributesStack();
14671
14672 /// Returns OpenMP nesting level for current directive.
14673 unsigned getOpenMPNestingLevel() const;
14674
14675 /// Adjusts the function scopes index for the target-based regions.
14676 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
14677 unsigned Level) const;
14678
14679 /// Returns the number of scopes associated with the construct on the given
14680 /// OpenMP level.
14681 int getNumberOfConstructScopes(unsigned Level) const;
14682
14683 /// Push new OpenMP function region for non-capturing function.
14684 void pushOpenMPFunctionRegion();
14685
14686 /// Pop OpenMP function region for non-capturing function.
14687 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
14688
14689 /// Analyzes and checks a loop nest for use by a loop transformation.
14690 ///
14691 /// \param Kind The loop transformation directive kind.
14692 /// \param NumLoops How many nested loops the directive is expecting.
14693 /// \param AStmt Associated statement of the transformation directive.
14694 /// \param LoopHelpers [out] The loop analysis result.
14695 /// \param Body [out] The body code nested in \p NumLoops loop.
14696 /// \param OriginalInits [out] Collection of statements and declarations that
14697 /// must have been executed/declared before entering the
14698 /// loop.
14699 ///
14700 /// \return Whether there was any error.
14701 bool checkTransformableLoopNest(
14702 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
14704 Stmt *&Body,
14705 SmallVectorImpl<SmallVector<llvm::PointerUnion<Stmt *, Decl *>, 0>>
14706 &OriginalInits);
14707
14708 /// Helper to keep information about the current `omp begin/end declare
14709 /// variant` nesting.
14710 struct OMPDeclareVariantScope {
14711 /// The associated OpenMP context selector.
14712 OMPTraitInfo *TI;
14713
14714 /// The associated OpenMP context selector mangling.
14715 std::string NameSuffix;
14716
14717 OMPDeclareVariantScope(OMPTraitInfo &TI);
14718 };
14719
14720 /// Return the OMPTraitInfo for the surrounding scope, if any.
14721 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
14722 return OMPDeclareVariantScopes.empty() ? nullptr
14723 : OMPDeclareVariantScopes.back().TI;
14724 }
14725
14726 /// The current `omp begin/end declare variant` scopes.
14727 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
14728
14729 /// The current `omp begin/end assumes` scopes.
14730 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
14731
14732 /// All `omp assumes` we encountered so far.
14733 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
14734
14735 /// OMPD_loop is mapped to OMPD_for, OMPD_distribute or OMPD_simd depending
14736 /// on the parameter of the bind clause. In the methods for the
14737 /// mapped directives, check the parameters of the lastprivate clause.
14738 bool checkLastPrivateForMappedDirectives(ArrayRef<OMPClause *> Clauses);
14739 /// Depending on the bind clause of OMPD_loop map the directive to new
14740 /// directives.
14741 /// 1) loop bind(parallel) --> OMPD_for
14742 /// 2) loop bind(teams) --> OMPD_distribute
14743 /// 3) loop bind(thread) --> OMPD_simd
14744 /// This is being handled in Sema instead of Codegen because of the need for
14745 /// rigorous semantic checking in the new mapped directives.
14746 bool mapLoopConstruct(llvm::SmallVector<OMPClause *> &ClausesWithoutBind,
14747 ArrayRef<OMPClause *> Clauses,
14748 OpenMPBindClauseKind &BindKind,
14749 OpenMPDirectiveKind &Kind,
14750 OpenMPDirectiveKind &PrevMappedDirective,
14751 SourceLocation StartLoc, SourceLocation EndLoc,
14752 const DeclarationNameInfo &DirName,
14753 OpenMPDirectiveKind CancelRegion);
14754
14755 ///@}
14756
14757 //
14758 //
14759 // -------------------------------------------------------------------------
14760 //
14761 //
14762
14763 /// \name SYCL Constructs
14764 /// Implementations are in SemaSYCL.cpp
14765 ///@{
14766
14767public:
14768 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
14769 /// context is "used as device code".
14770 ///
14771 /// - If CurLexicalContext is a kernel function or it is known that the
14772 /// function will be emitted for the device, emits the diagnostics
14773 /// immediately.
14774 /// - If CurLexicalContext is a function and we are compiling
14775 /// for the device, but we don't know that this function will be codegen'ed
14776 /// for devive yet, creates a diagnostic which is emitted if and when we
14777 /// realize that the function will be codegen'ed.
14778 ///
14779 /// Example usage:
14780 ///
14781 /// Diagnose __float128 type usage only from SYCL device code if the current
14782 /// target doesn't support it
14783 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
14784 /// S.getLangOpts().SYCLIsDevice)
14785 /// SYCLDiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
14786 SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc,
14787 unsigned DiagID);
14788
14789 void deepTypeCheckForSYCLDevice(SourceLocation UsedAt,
14791 ValueDecl *DeclToCheck);
14792
14793 ///@}
14794};
14795
14796DeductionFailureInfo
14798 sema::TemplateDeductionInfo &Info);
14799
14800/// Contains a late templated function.
14801/// Will be parsed at the end of the translation unit, used by Sema & Parser.
14804 /// The template function declaration to be late parsed.
14806 /// Floating-point options in the point of definition.
14808};
14809
14810template <>
14812 PragmaMsStackAction Action,
14813 llvm::StringRef StackSlotLabel,
14815
14816std::unique_ptr<sema::RISCVIntrinsicManager>
14818} // end namespace clang
14819
14820namespace llvm {
14821// Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
14822// SourceLocation.
14823template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
14826 DenseMapInfo<clang::CanonicalDeclPtr<const clang::FunctionDecl>>;
14827
14829 return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
14830 }
14831
14833 return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
14834 }
14835
14836 static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
14837 return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
14838 FDL.Loc.getHashValue());
14839 }
14840
14841 static bool isEqual(const FunctionDeclAndLoc &LHS,
14842 const FunctionDeclAndLoc &RHS) {
14843 return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
14844 }
14845};
14846} // namespace llvm
14847
14848#endif
This file provides AST data structures related to concepts.
#define V(N, I)
Definition: ASTContext.h:3259
int Id
Definition: ASTDiff.cpp:190
Forward declaration of all AST node types.
MatchType Type
StringRef P
static char ID
Definition: Arena.cpp:183
#define SM(sm)
Definition: Cuda.cpp:82
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
Defines enum values for all the target-independent builtin functions.
static void emit(Program &P, std::vector< std::byte > &Code, const T &Val, bool &Success)
Helper to write bytecode and bail out if 32-bit offsets become invalid.
llvm::APSInt APSInt
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines enumerations for expression traits intrinsics.
int Priority
Definition: Format.cpp:2956
StringRef Identifier
Definition: Format.cpp:2960
llvm::DenseSet< const void * > Visited
Definition: HTMLLogger.cpp:146
#define X(type, name)
Definition: Value.h:142
llvm::MachO::Target Target
Definition: MachO.h:40
llvm::MachO::Record Record
Definition: MachO.h:28
Defines the clang::Module class, which describes a module in the source code.
Defines some OpenACC-specific enums and functions.
Defines the clang::OpenCLOptions class.
Defines some OpenMP-specific enums and functions.
AccessResult
A copy of Sema's enum without AR_delayed.
Definition: SemaAccess.cpp:30
CastType
Definition: SemaCast.cpp:47
Sema::AllowedExplicit AllowedExplicit
Defines various enumerations that describe declaration and type specifiers.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TemplateNameKind enum.
Defines the clang::TypeLoc interface and its subclasses.
Allows QualTypes to be sorted and hence used in maps and sets.
Defines enumerations for the type traits support.
TypePropertyCache< Private > Cache
Definition: Type.cpp:4307
SourceLocation Begin
StateNode * Previous
std::string Label
A class for storing results from argument-dependent lookup.
Definition: Lookup.h:864
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:33
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
CanQualType BoolTy
Definition: ASTContext.h:1087
CanQualType IntTy
Definition: ASTContext.h:1095
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:366
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:86
PtrTy get() const
Definition: Ownership.h:170
bool isInvalid() const
Definition: Ownership.h:166
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2663
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:3147
Attr - This represents one attribute.
Definition: Attr.h:42
Syntax
The style used to specify an attribute.
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:5147
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:5524
Represents a C++ declaration that introduces decls from somewhere else.
Definition: DeclCXX.h:3410
A binding in a decomposition declaration.
Definition: DeclCXX.h:4100
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4459
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2528
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2855
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2293
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2481
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2792
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2053
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:73
Represents the this expression in C++.
Definition: ExprCXX.h:1148
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2819
A wrapper class around a pointer that always points to its canonical declaration.
Definition: Redeclarable.h:349
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4651
CaseStmt - Represent a case statement.
Definition: Stmt.h:1799
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3489
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Abstract interface for a consumer of code-completion information.
An allocator used specifically for the purpose of code completion.
Declaration of a C++20 concept.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:35
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3591
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
The information about the darwin SDK that was used during this compilation.
Definition: DarwinSDKInfo.h:29
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1379
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1446
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1260
Captures information about "declaration specifiers".
Definition: DeclSpec.h:246
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Definition: DeclBase.h:859
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:843
SourceLocation getLocation() const
Definition: DeclBase.h:444
DeclContext * getDeclContext()
Definition: DeclBase.h:453
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:918
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:978
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:770
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1899
A decomposition declaration.
Definition: DeclCXX.h:4159
A dependently-generated diagnostic.
Designation - Represent a full designation, which is a sequence of designators.
Definition: Designator.h:208
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:1271
void Clear() const
Clear out the current diagnostic.
Definition: Diagnostic.h:1303
bool isActive() const
Determine whether this diagnostic is still active.
Definition: Diagnostic.h:1310
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition: Diagnostic.h:761
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3265
Represents an enum.
Definition: Decl.h:3832
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Definition: Type.h:5118
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1892
The return type of classify().
Definition: Expr.h:330
This represents one expression.
Definition: Expr.h:110
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
Definition: Expr.h:792
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:277
An abstract interface that should be implemented by external AST sources that also provide informatio...
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source.
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
Represents difference between two FPOptions values.
Definition: LangOptions.h:870
FPOptionsOverride getChangesFrom(const FPOptions &Base) const
Return difference with the given option set.
Definition: LangOptions.h:975
Represents a member of a struct/union/class.
Definition: Decl.h:3025
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A mapping from file IDs to a record of whether we've seen nullability information in that file.
Definition: Sema.h:268
FileNullability & operator[](FileID file)
Definition: Sema.h:279
FileNullability Nullability
Definition: Sema.h:275
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition: Diagnostic.h:71
Represents a function declaration or definition.
Definition: Decl.h:1959
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4599
Represents a prototype with parameter type info, e.g.
Definition: Type.h:4199
Declaration of a template function.
Definition: DeclTemplate.h:958
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition: Type.h:3825
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3799
One of these records is kept for each identifier that is lexed.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:540
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3309
Describes an C or C++ initializer list.
Definition: Expr.h:4841
Describes the kind of initialization being performed, along with location information for tokens rela...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
Represents the declaration of a label.
Definition: Decl.h:499
FPEvalMethodKind
Possible float expression evaluation method choices.
Definition: LangOptions.h:276
FPExceptionModeKind
Possible floating point exception behavior.
Definition: LangOptions.h:264
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:418
Represents a lazily-loaded vector of data.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition: Template.h:365
Represents the results of name lookup.
Definition: Lookup.h:46
A global _GUID constant.
Definition: DeclCXX.h:4282
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4228
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4679
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3182
Abstract interface for a module loader.
Definition: ModuleLoader.h:82
Describes a module or submodule.
Definition: Module.h:105
Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID)
Construct a new module or submodule.
Definition: Module.cpp:37
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition: Template.h:76
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:191
This represents a decl that may have a name.
Definition: Decl.h:249
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Definition: Decl.h:414
Represent a C++ namespace.
Definition: Decl.h:547
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:55
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:416
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2323
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2542
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:944
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:896
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2595
Represents an ObjC class declaration.
Definition: DeclObjC.h:1150
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1947
ObjCList - This is a simple template class used to hold various lists of decls etc,...
Definition: DeclObjC.h:82
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:945
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:140
Represents a pointer to an Objective C object.
Definition: Type.h:6551
Represents a class type in Objective C.
Definition: Type.h:6297
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2079
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:578
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:658
Wrapper for void* pointer.
Definition: Ownership.h:50
static OpaquePtr make(QualType P)
Definition: Ownership.h:60
OpenCL supported extensions and optional core features.
Definition: OpenCLOptions.h:69
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition: Overload.h:977
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2129
Represents a parameter to a function.
Definition: Decl.h:1749
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:126
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:951
Represents the parsed form of a C++ template argument.
Parser - This implements a parser for the C family of languages.
Definition: Parser.h:54
void Emit(const DiagnosticBuilder &DB) const
Tracks expected type during expression parsing, for use in code completion.
Definition: Sema.h:300
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterDesignatedInitializer(SourceLocation Tok, QualType BaseType, const Designation &D)
Handles e.g. BaseType{ .D = Tok...
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
PreferredTypeBuilder(bool Enabled)
Definition: Sema.h:302
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
Definition: Sema.h:337
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:128
Stores the type being destroyed by a pseudo-destructor expression.
Definition: ExprCXX.h:2549
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6299
A (possibly-)qualified type.
Definition: Type.h:737
The collection of all-type qualifiers we support.
Definition: Type.h:147
Represents a struct/union/class.
Definition: Decl.h:4133
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5092
Represents the body of a requires-expression.
Definition: DeclCXX.h:2023
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
void incrementMSManglingNumber()
Definition: Scope.h:349
Smart pointer class that efficiently represents Objective-C method names.
AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
Definition: Sema.h:1352
bool operator==(const AlignPackInfo &Info) const
Definition: Sema.h:1412
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition: Sema.h:1384
unsigned getPackNumber() const
Definition: Sema.h:1402
bool IsXLStack() const
Definition: Sema.h:1410
bool IsPackSet() const
Definition: Sema.h:1404
AlignPackInfo(AlignPackInfo::Mode M, bool IsXL)
Definition: Sema.h:1358
bool IsAlignAttr() const
Definition: Sema.h:1398
bool IsPackAttr() const
Definition: Sema.h:1396
bool operator!=(const AlignPackInfo &Info) const
Definition: Sema.h:1418
AlignPackInfo(bool IsXL)
Definition: Sema.h:1362
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Definition: Sema.h:1369
Mode getAlignMode() const
Definition: Sema.h:1400
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:10543
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition: Sema.h:10548
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6631
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:6636
void emit(const SemaDiagnosticBuilder &DB, std::index_sequence< Is... >) const
Definition: Sema.h:6623
std::tuple< const Ts &... > Args
Definition: Sema.h:6620
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition: Sema.h:6786
A RAII object to enter scope of a compound statement.
Definition: Sema.h:1037
CompoundScopeRAII(Sema &S, bool IsStmtExpr=false)
Definition: Sema.h:1039
std::pair< VarDecl *, Expr * > get() const
Definition: Sema.h:6097
bool isInvalid() const
Definition: Sema.h:6096
std::optional< bool > getKnownValue() const
Definition: Sema.h:6101
A RAII object to temporarily push a declaration context.
Definition: Sema.h:2671
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition: Sema.h:2681
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition: Sema.h:8305
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition: Sema.h:8310
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
For a defaulted function, the kind of defaulted function that it is.
Definition: Sema.h:4851
DefaultedComparisonKind asComparison() const
Definition: Sema.h:4878
DefaultedFunctionKind(CXXSpecialMember CSM)
Definition: Sema.h:4859
CXXSpecialMember asSpecialMember() const
Definition: Sema.h:4875
unsigned getDiagnosticIndex() const
Get the index of this function kind for use in diagnostics.
Definition: Sema.h:4883
DefaultedFunctionKind(DefaultedComparisonKind Comp)
Definition: Sema.h:4862
RAII class to control scope of DeferDiags.
Definition: Sema.h:8159
DeferDiagsRAII(Sema &S, bool DeferDiags)
Definition: Sema.h:8164
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
Definition: Sema.h:1109
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition: Sema.h:1128
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition: Sema.h:1152
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition: Sema.h:1121
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition: Sema.h:1124
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition: Sema.h:1138
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition: Sema.h:1144
A helper class for building up ExtParameterInfos.
Definition: Sema.h:10005
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition: Sema.h:10024
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition: Sema.h:10012
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Definition: Sema.h:10794
FPOptionsOverride getOverrides()
Definition: Sema.h:10798
FullExprArg(Sema &actions)
Definition: Sema.h:6041
ExprResult release()
Definition: Sema.h:6043
Expr * get() const
Definition: Sema.h:6045
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition: Sema.h:10810
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition: Sema.h:12056
iterator find(Selector Sel)
Definition: Sema.h:12059
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition: Sema.h:12055
int count(Selector Sel) const
Definition: Sema.h:12063
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition: Sema.h:12060
SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
Definition: Sema.h:8369
virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition: Sema.h:8361
Helper class that creates diagnostics with optional template instantiation stacks.
Definition: Sema.h:526
const ImmediateDiagBuilder & operator<<(T &&V) const
Definition: Sema.h:577
ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
Definition: Sema.h:533
friend const ImmediateDiagBuilder & operator<<(const ImmediateDiagBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition: Sema.h:566
ImmediateDiagBuilder(const ImmediateDiagBuilder &)=default
ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition: Sema.h:531
Helper class that collects exception specifications for implicitly-declared special member functions.
Definition: Sema.h:4181
unsigned size() const
The number of exceptions in the exception specification.
Definition: Sema.h:4214
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition: Sema.h:4207
const QualType * data() const
The set of exceptions in the exception specification.
Definition: Sema.h:4217
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
Definition: Sema.h:4223
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition: Sema.h:4230
static NameClassification DependentNonType()
Definition: Sema.h:2894
static NameClassification VarTemplate(TemplateName Name)
Definition: Sema.h:2904
ExprResult getExpression() const
Definition: Sema.h:2930
NameClassification(const IdentifierInfo *Keyword)
Definition: Sema.h:2870
static NameClassification Unknown()
Definition: Sema.h:2874
static NameClassification OverloadSet(ExprResult E)
Definition: Sema.h:2878
NameClassificationKind getKind() const
Definition: Sema.h:2928
static NameClassification UndeclaredTemplate(TemplateName Name)
Definition: Sema.h:2922
static NameClassification FunctionTemplate(TemplateName Name)
Definition: Sema.h:2910
NamedDecl * getNonTypeDecl() const
Definition: Sema.h:2940
NameClassification(ParsedType Type)
Definition: Sema.h:2868
TemplateName getTemplateName() const
Definition: Sema.h:2945
ParsedType getType() const
Definition: Sema.h:2935
TemplateNameKind getTemplateNameKind() const
Definition: Sema.h:2952
static NameClassification NonType(NamedDecl *D)
Definition: Sema.h:2884
static NameClassification Concept(TemplateName Name)
Definition: Sema.h:2916
static NameClassification UndeclaredNonType()
Definition: Sema.h:2890
static NameClassification TypeTemplate(TemplateName Name)
Definition: Sema.h:2898
static NameClassification Error()
Definition: Sema.h:2872
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
Definition: Sema.h:810
void operator()(sema::FunctionScopeInfo *Scope) const
Definition: Sema.cpp:2283
Whether and why a template name is required in this lookup.
Definition: Sema.h:9103
RequiredTemplateKind(TemplateNameIsRequiredTag)
Template name is unconditionally required.
Definition: Sema.h:9109
SourceLocation getTemplateKeywordLoc() const
Definition: Sema.h:9111
RequiredTemplateKind(SourceLocation TemplateKWLoc=SourceLocation())
Template name is required if TemplateKWLoc is valid.
Definition: Sema.h:9106
bool hasTemplateKeyword() const
Definition: Sema.h:9114
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition: Sema.h:9755
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition: Sema.h:9785
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition: Sema.h:9763
A generic diagnostic builder for errors which may or may not be deferred.
Definition: Sema.h:598
void AddFixItHint(const FixItHint &Hint) const
Definition: Sema.h:674
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Definition: Sema.h:643
const SemaDiagnosticBuilder & operator<<(T &&V) const
Definition: Sema.h:657
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
Definition: Sema.h:684
@ K_Nop
Emit no diagnostics.
Definition: Sema.h:602
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
Definition: Sema.h:612
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Definition: Sema.h:608
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Definition: Sema.h:604
SemaDiagnosticBuilder & operator=(SemaDiagnosticBuilder &&)=delete
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
Definition: Sema.h:681
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
SemaDiagnosticBuilder & operator=(const SemaDiagnosticBuilder &)=delete
A derivative of BoundTypeDiagnoser for which the diagnostic's type parameter is preceded by a 0/1 enu...
Definition: Sema.h:6648
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:6653
SizelessTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6650
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:7581
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition: Sema.h:7559
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition: Sema.h:7568
CXXMethodDecl * getMethod() const
Definition: Sema.h:7571
void setMethod(CXXMethodDecl *MD)
Definition: Sema.h:7572
RAII object to handle the state changes required to synthesize a function body.
Definition: Sema.h:10423
void addContextNote(SourceLocation UseLoc)
Definition: Sema.h:10449
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition: Sema.h:10429
SourceLocation getLocation() const
Definition: Sema.h:9587
bool ContainsDecl(const NamedDecl *ND) const
Definition: Sema.h:9577
const DeclContext * getDeclContext() const
Definition: Sema.h:9583
TemplateCompareNewDeclInfo(const DeclContext *DeclCtx, const DeclContext *LexicalDeclCtx, SourceLocation Loc)
Definition: Sema.h:9561
const NamedDecl * getDecl() const
Definition: Sema.h:9575
TemplateCompareNewDeclInfo(const NamedDecl *ND)
Definition: Sema.h:9560
const DeclContext * getLexicalDeclContext() const
Definition: Sema.h:9579
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition: Sema.h:9794
TentativeAnalysisScope(Sema &SemaRef)
Definition: Sema.h:9801
Abstract base class used for diagnosing integer constant expression violations.
Definition: Sema.h:5994
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
VerifyICEDiagnoser(bool Suppress=false)
Definition: Sema.h:5998
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:426
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority)
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
const FieldDecl * getSelfAssignmentClassMemberCandidate(const ValueDecl *SelfAssigned)
Returns a field in a CXXRecordDecl that has the same name as the decl SelfAssigned when inside a CXXM...
Definition: SemaExpr.cpp:15388
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs)
Definition: SemaDecl.cpp:14396
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'map' clause.
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
QualType CheckSizelessVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
OMPClause * ActOnOpenMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'weak' clause.
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
Definition: SemaType.cpp:9388
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
Definition: SemaDecl.cpp:11095
ExprResult PerformImplicitObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
QualType BuildParenType(QualType T)
Build a paren type including T.
Definition: SemaType.cpp:2056
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
StmtResult ActOnOpenMPMetaDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp metadirective' after parsing of the associated statement.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
Definition: SemaType.cpp:6768
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
Definition: SemaDecl.cpp:6810
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition: Sema.h:10493
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
Definition: Sema.h:4810
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
Definition: SemaDecl.cpp:18305
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn)
#pragma optimize("[optimization-list]", on | off).
Definition: SemaAttr.cpp:1146
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList *PartialSpecArgs, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraint)
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result, ASTContext &Ctx, bool ErrorOnInvalidMessage)
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
std::optional< ExpressionEvaluationContextRecord::InitializationContext > InnermostDeclarationWithDelayedImmediateInvocations() const
Definition: Sema.h:6527
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
Definition: SemaAttr.cpp:388
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition: Sema.h:10477
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition: Sema.h:8733
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: Sema.h:12051
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:10034
void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opcode)
Check for comparisons of floating-point values using == and !=.
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition: Sema.h:869
void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls)
MergeTypedefNameDecl - We just parsed a typedef 'New' which has the same name and scope as a previous...
Definition: SemaDecl.cpp:2568
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
Definition: SemaCUDA.cpp:134
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
Definition: SemaType.cpp:9263
void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S)
Register the given locally-scoped extern "C" declaration so that it can be found later for redeclarat...
Definition: SemaDecl.cpp:6728
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
const ValueDecl * getOpenMPDeclareMapperVarName() const
BTFDeclTagAttr * mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL)
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
Definition: SemaDecl.cpp:2529
DeclGroupRef ActOnEndOpenACCDeclDirective()
Called after the directive has been completely parsed, including the declaration group or associated ...
OMPClause * ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
SmallVector< SmallVector< VTableUse, 16 >, 8 > SavedVTableUses
Definition: Sema.h:10757
void CodeCompleteObjCProtocolDecl(Scope *S)
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation > > ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:9848
void PopParsingClass(ParsingClassState state)
Definition: Sema.h:5007
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=std::nullopt, DeclContext *LookupCtx=nullptr, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
Definition: SemaExpr.cpp:2469
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void CodeCompleteTag(Scope *S, unsigned TagSpec)
void DiagnoseAbstractType(const CXXRecordDecl *RD)
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc, const LookupResult *R=nullptr, const UsingDecl *UD=nullptr)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition: Sema.h:8175
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition: Sema.cpp:929
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool CheckExplicitObjectOverride(CXXMethodDecl *New, const CXXMethodDecl *Old)
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
Definition: SemaExpr.cpp:9383
llvm::SmallPtrSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition: Sema.h:4996
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter,...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
QualType CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
bool checkArrayElementAlignment(QualType EltTy, SourceLocation Loc)
Definition: SemaType.cpp:2462
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)
void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs, SmallVectorImpl< const Attr * > &OutAttrs)
Process the attributes before creating an attributed statement.
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:16616
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6603
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
Definition: SemaDecl.cpp:1575
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
Definition: SemaExpr.cpp:3859
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:16292
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
bool isValidRVVBitcast(QualType srcType, QualType destType)
Are the two types RVV-bitcast-compatible types? I.e.
Definition: SemaExpr.cpp:8289
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
bool isAlwaysConstantEvaluatedContext() const
Definition: Sema.h:6497
bool isExternalWithNoLinkageType(const ValueDecl *VD) const
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
Definition: Sema.cpp:803
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
Definition: SemaDecl.cpp:15286
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Definition: SemaStmt.cpp:4747
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, std::optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Definition: SemaAttr.cpp:1055
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr, CUDAFunctionTarget CFT=CFT_InvalidTarget)
Check validaty of calling convention attribute attr.
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6596
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition: Sema.cpp:2468
LookupNameKind
Describes the kind of name lookup to perform.
Definition: Sema.h:7603
@ LookupLabel
Label name lookup.
Definition: Sema.h:7612
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition: Sema.h:7607
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
Definition: Sema.h:7634
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition: Sema.h:7626
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
Definition: Sema.h:7648
@ LookupLocalFriendName
Look up a friend of a local class.
Definition: Sema.h:7642
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
Definition: Sema.h:7644
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition: Sema.h:7639
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition: Sema.h:7619
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
Definition: Sema.h:7646
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Definition: Sema.h:7630
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
Definition: Sema.h:7615
@ LookupDestructorName
Look up a name following ~ in a destructor name.
Definition: Sema.h:7622
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition: Sema.h:7610
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
Definition: Sema.h:7650
@ LookupAnyName
Look up any declaration with any name.
Definition: Sema.h:7652
void DiagnoseSentinelCalls(const NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Definition: SemaExpr.cpp:417
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition: Sema.h:7547
void CodeCompleteUsing(Scope *S)
LazyVector< TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition: Sema.h:3731
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
Definition: SemaDecl.cpp:6746
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
Definition: SemaType.cpp:6877
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
Definition: SemaAttr.cpp:1062
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
void ActOnPopScope(SourceLocation Loc, Scope *S)
Definition: SemaDecl.cpp:2214
void ActOnDefinedDeclarationSpecifier(Decl *D)
Called once it is known whether a tag declaration is an anonymous union or struct.
Definition: SemaDecl.cpp:5387
llvm::PointerIntPair< CXXRecordDecl *, 3, CXXSpecialMember > SpecialMemberDecl
Definition: Sema.h:4991
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
ExprResult ActOnConstantExpression(ExprResult Res)
Definition: SemaExpr.cpp:20416
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:514
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:14031
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
Definition: SemaDecl.cpp:15987
bool checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D, StringRef &Str, bool &isDefault)
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:4772
VariadicCallType
Definition: Sema.h:2145
@ VariadicDoesNotApply
Definition: Sema.h:2150
@ VariadicFunction
Definition: Sema.h:2146
@ VariadicMethod
Definition: Sema.h:2148
@ VariadicConstructor
Definition: Sema.h:2149
@ VariadicBlock
Definition: Sema.h:2147
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:13045
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
void ActOnAnnotModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
Definition: SemaModule.cpp:755
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, std::optional< unsigned > NumExpansions, bool ExpectParameterPack, bool EvaluateConstraints=true)
ExplicitSpecifier ActOnExplicitBoolSpecifier(Expr *E)
ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression found in an explicit(bool)...
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
Definition: SemaExpr.cpp:7773
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
Definition: SemaLambda.cpp:807
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
bool DiagRedefinedPlaceholderFieldDecl(SourceLocation Loc, RecordDecl *ClassDecl, const IdentifierInfo *Name)
void ActOnFinishCXXNonNestedClass()
ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
Definition: SemaExprCXX.cpp:92
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
DelayedDiagnosticsState ParsingDeclState
Definition: Sema.h:1104
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
Definition: SemaAccess.cpp:39
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
NonTrivialCUnionContext
Definition: Sema.h:3140
@ NTCUC_CopyInit
Definition: Sema.h:3150
@ NTCUC_AutoVar
Definition: Sema.h:3148
@ NTCUC_CompoundLiteral
Definition: Sema.h:3154
@ NTCUC_DefaultInitializedObject
Definition: Sema.h:3146
@ NTCUC_Assignment
Definition: Sema.h:3152
@ NTCUC_BlockCapture
Definition: Sema.h:3156
@ NTCUC_FunctionReturn
Definition: Sema.h:3144
@ NTCUC_LValueToRValueVolatile
Definition: Sema.h:3158
@ NTCUC_FunctionParam
Definition: Sema.h:3142
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition: Sema.h:1617
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld, bool NewDeclIsDefn)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
Definition: SemaDecl.cpp:3648
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
void CodeCompleteCase(Scope *S)
void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind, uint64_t MagicValue, QualType Type, bool LayoutCompatible, bool MustBeNull)
Register a magic integral constant to be used as a type tag.
bool hasReachableDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
MissingImportKind
Kinds of missing import.
Definition: Sema.h:7880
StmtResult ActOnOpenMPScanDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scan'.
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc)
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc, Expr *DefaultArg)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
bool areVectorTypesSameSize(QualType srcType, QualType destType)
Definition: SemaExpr.cpp:8317
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, TemplateIdAnnotation *TemplateId, bool IsMemberSpecialization)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
Definition: SemaDecl.cpp:6215
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
Definition: SemaStmt.cpp:4382
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
Definition: SemaLookup.cpp:991
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
void DiagnoseStaticAssertDetails(const Expr *E)
Try to print more useful information about a failed static_assert with expression \E.
void ActOnAnnotModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
Definition: SemaModule.cpp:716
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: Sema.cpp:1911
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
Definition: SemaExpr.cpp:3101
RetainOwnershipKind
Definition: Sema.h:3863
OpaquePtr< QualType > TypeTy
Definition: Sema.h:1023
void CodeCompleteObjCMessageReceiver(Scope *S)
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
Definition: SemaDecl.cpp:18428
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
bool IsStringInit(Expr *Init, const ArrayType *AT)
Definition: SemaInit.cpp:166
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: Sema.h:12454
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: Sema.h:12445
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
void addImplicitTypedef(StringRef Name, QualType T)
Definition: Sema.cpp:261
void PrintContextStack()
Definition: Sema.h:10563
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
Definition: SemaExpr.cpp:2344
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
Definition: SemaType.cpp:2762
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable,...
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition: SemaStmt.cpp:603
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
void ActOnOpenMPEndAssumesDirective()
Called on well-formed '#pragma omp end assumes'.
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition: Sema.h:7107
@ IER_DoesNotExist
The symbol does not exist.
Definition: Sema.h:7112
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
Definition: Sema.h:7116
@ IER_Error
An error occurred.
Definition: Sema.h:7119
@ IER_Exists
The symbol exists.
Definition: Sema.h:7109
void CheckDelegatingCtorCycles()
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition: Sema.h:7546
void ActOnStartStmtExpr()
Definition: SemaExpr.cpp:16636
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, MultiExprArg Args)
CUDAFunctionPreference
Definition: Sema.h:13193
@ CFP_Never
Definition: Sema.h:13194
@ CFP_HostDevice
Definition: Sema.h:13198
@ CFP_SameSide
Definition: Sema.h:13199
@ CFP_Native
Definition: Sema.h:13201
@ CFP_WrongSide
Definition: Sema.h:13195
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
Definition: Sema.h:4801
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition: Sema.h:7806
bool FormatStringHasSArg(const StringLiteral *FExpr)
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
Definition: SemaExpr.cpp:18271
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
void ActOnStmtExprError()
Definition: SemaExpr.cpp:16642
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
Definition: Sema.h:1096
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
Definition: SemaStmt.cpp:4736
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Definition: SemaExpr.cpp:3028
void CodeCompleteInitializer(Scope *S, Decl *D)
void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
Definition: SemaAttr.cpp:1324
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: Sema.h:12457
void CheckExplicitObjectMemberFunction(Declarator &D, DeclarationName Name, QualType R, bool IsLambda, DeclContext *DC=nullptr)
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
Definition: SemaDecl.cpp:6182
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:2312
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
Definition: SemaExpr.cpp:1554
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition: Sema.h:11679
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc, bool Braced)
StmtResult ActOnForEachLValueExpr(Expr *E)
In an Objective C collection iteration statement: for (x in y) x can be an arbitrary l-value expressi...
Definition: SemaStmt.cpp:2223
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition: Sema.h:997
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
Definition: SemaDecl.cpp:18353
FunctionEmissionStatus
Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
Definition: Sema.h:3648
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition: Sema.h:2745
PragmaClangSection PragmaClangRodataSection
Definition: Sema.h:1324
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
Definition: SemaExpr.cpp:13043
void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet, OverloadedOperatorKind Op, const UnresolvedSetImpl &Fns, ArrayRef< Expr * > Args, bool RequiresADL=true)
Perform lookup for an overloaded binary operator.
void NoteAllFoundTemplates(TemplateName Name)
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, unsigned LambdaDependencyKind, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
Definition: SemaLambda.cpp:245
bool hasVisibleDefinition(const NamedDecl *D)
Definition: Sema.h:11993
bool SemaBuiltinVectorMath(CallExpr *TheCall, QualType &Res)
ObjCContainerKind
Definition: Sema.h:12096
@ OCK_Interface
Definition: Sema.h:12098
@ OCK_ClassExtension
Definition: Sema.h:12101
@ OCK_Category
Definition: Sema.h:12100
@ OCK_Implementation
Definition: Sema.h:12102
@ OCK_CategoryImplementation
Definition: Sema.h:12103
@ OCK_None
Definition: Sema.h:12097
@ OCK_Protocol
Definition: Sema.h:12099
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Definition: Sema.h:4973
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
void emitAndClearUnusedLocalTypedefWarnings()
Definition: Sema.cpp:1020
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
Definition: SemaDecl.cpp:16518
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition: Sema.h:4954
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, bool IsVariadic, FormatStringInfo *FSI)
Given a FunctionDecl's FormatAttr, attempts to populate the FomatStringInfo parameter with the Format...
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition: SemaStmt.cpp:85
Decl * ActOnParamDeclarator(Scope *S, Declarator &D, SourceLocation ExplicitThisLoc={})
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
Definition: SemaDecl.cpp:15163
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition: Sema.h:12421
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
VarDecl * buildCoroutinePromise(SourceLocation Loc)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
Definition: SemaType.cpp:1080
unsigned CapturingFunctionScopes
Track the number of currently active capturing scopes.
Definition: Sema.h:986
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
Definition: SemaAttr.cpp:1097
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition: Sema.h:13094
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
Definition: SemaExpr.cpp:18205
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: Sema.h:12684
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
Definition: SemaAttr.cpp:1458
PragmaClangSectionAction
Definition: Sema.h:1314
@ PCSA_Set
Definition: Sema.h:1314
@ PCSA_Clear
Definition: Sema.h:1314
void CodeCompleteObjCAtDirective(Scope *S)
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
Definition: SemaExpr.cpp:21143
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition: Sema.cpp:267
ConditionKind
Definition: Sema.h:6116
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition: Sema.h:1073
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
Definition: SemaAttr.cpp:1195
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Definition: Sema.h:11952
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
static SourceRange getPrintable(SourceLocation L)
Definition: Sema.h:11685
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
Definition: SemaExpr.cpp:2685
bool TemplateParameterListsAreEqual(const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New, const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
void CUDACheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture)
Definition: SemaCUDA.cpp:929
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
ModuleDeclKind
Definition: Sema.h:8010
@ PartitionImplementation
'module X:Y;'
@ Interface
'export module X;'
@ PartitionInterface
'export module X:Y;'
WebAssemblyImportNameAttr * mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL)
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition: Sema.h:979
void ActOnExitFunctionContext()
Definition: SemaDecl.cpp:1474
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
void addAMDGPUMaxNumWorkGroupsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups attribute to a particular declarat...
bool ActOnDuplicateODRHashDefinition(T *Duplicate, T *Previous)
Check ODR hashes for C/ObjC when merging types from modules.
Definition: Sema.h:12083
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition: Sema.h:8388
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
Definition: Sema.h:8391
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
Definition: Sema.h:8397
@ Ref_Related
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition: Sema.h:8395
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
void RefersToMemberWithReducedAlignment(Expr *E, llvm::function_ref< void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> Action)
This function calls Action when it determines that E designates a misaligned member due to the packed...
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType)
Definition: Sema.h:1270
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
AccessResult
Definition: Sema.h:1208
@ AR_dependent
Definition: Sema.h:1211
@ AR_accessible
Definition: Sema.h:1209
@ AR_inaccessible
Definition: Sema.h:1210
@ AR_delayed
Definition: Sema.h:1212
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Definition: Sema.cpp:2260
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
CompleteTypeKind
Definition: Sema.h:11689
@ Normal
Apply the normal rules for complete types.
@ AcceptSizeless
Relax the normal rules for complete types so that they include sizeless built-in types.
bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA)
Check whether the given statement can have musttail applied to it, issuing a diagnostic and returning...
Definition: SemaStmt.cpp:632
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
Definition: SemaCast.cpp:3357
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
Adds a conversion function template specialization candidate to the overload set, using template argu...
Preprocessor & getPreprocessor() const
Definition: Sema.h:500
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
Definition: Sema.h:5359
OMPClause * ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'dynamic_allocators' clause.
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition: Sema.cpp:2122
QualType GetSignedSizelessVectorType(QualType V)
Definition: SemaExpr.cpp:13605
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition: Sema.h:10480
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, Scope *CurContext)
Once the Lambdas capture are known, we can start to create the closure, call operator method,...
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
Definition: SemaCast.cpp:399
void AddTemplateParametersToLambdaCallOperator(CXXMethodDecl *CallOperator, CXXRecordDecl *Class, TemplateParameterList *TemplateParams)
Definition: SemaLambda.cpp:955
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
llvm::SmallPtrSet< ConstantExpr *, 4 > FailedImmediateInvocations
Definition: Sema.h:6672
void deduceOpenCLAddressSpace(ValueDecl *decl)
Definition: SemaDecl.cpp:7008
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3799
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
Definition: SemaExprCXX.cpp:58
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
Definition: SemaStmt.cpp:3322
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition: Sema.h:1555
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
void CheckHLSLEntryPoint(FunctionDecl *FD)
Definition: SemaDecl.cpp:12595
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc, CodeSynthesisContext::SynthesisKind CSC=CodeSynthesisContext::ExplicitTemplateArgumentSubstitution)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
Definition: Sema.h:6584
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * > > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
Definition: SemaCUDA.cpp:308
static SourceRange getPrintable(const Expr *E)
Definition: Sema.h:11686
PragmaStack< StringLiteral * > CodeSegStack
Definition: Sema.h:1549
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
Definition: SemaStmt.cpp:3974
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
Definition: SemaAttr.cpp:1165
void referenceDLLExportedClassMethods()
AMDGPUFlatWorkGroupSizeAttr * CreateAMDGPUFlatWorkGroupSizeAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
void MarkCaptureUsedInEnclosingContext(ValueDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
Definition: SemaExpr.cpp:19231
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates.
void setFunctionHasBranchIntoScope()
Definition: Sema.cpp:2311
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
Definition: SemaDecl.cpp:12680
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
Definition: SemaCUDA.cpp:50
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
ExprResult BuildCXXAssumeExpr(Expr *Assumption, const IdentifierInfo *AttrName, SourceRange Range)
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition: Sema.h:3736
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
Definition: SemaStmt.cpp:460
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid,...
Definition: Sema.h:1626
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
Definition: SemaDecl.cpp:6344
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
Definition: SemaExpr.cpp:17996
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:506
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
virtual void anchor()
This virtual key function only exists to limit the emission of debug info describing the Sema class.
Definition: Sema.cpp:259
void CodeCompleteObjCAtExpression(Scope *S)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
Definition: SemaType.cpp:2836
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
Definition: SemaDecl.cpp:4891
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition: Sema.h:1544
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions,...
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
SimplerImplicitMoveMode
Definition: Sema.h:8864
Expr * BuildBuiltinCallExpr(SourceLocation Loc, Builtin::ID Id, MultiExprArg CallArgs)
BuildBuiltinCallExpr - Create a call to a builtin function specified by Id.
Definition: SemaExpr.cpp:7397
StmtResult ActOnOpenMPLoopnest(Stmt *AStmt)
Process a canonical OpenMP loop nest that can either be a canonical literal loop (ForStmt or CXXForRa...
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition: SemaAttr.cpp:53
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
ErrorAttr * mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI, StringRef NewUserDiagnostic)
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
Definition: SemaDecl.cpp:12347
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function.
Definition: SemaDecl.cpp:16734
void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver)
If VD is set but not otherwise used, diagnose, for a parameter or a variable.
Definition: SemaDecl.cpp:2146
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool IsUnevaluatedContext)
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, bool AllowBoolOperation, bool ReportInvalid)
type checking for vector binary operators.
Definition: SemaExpr.cpp:11071
void ActOnComment(SourceRange Comment)
Definition: Sema.cpp:2409
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:3363
@ Other
C++ [dcl.fct.def.general]p1 function-body: ctor-initializer[opt] compound-statement function-try-bloc...
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
Definition: SemaStmt.cpp:48
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
Definition: SemaDecl.cpp:18546
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition: Sema.cpp:1110
ExprResult EvaluateConvertedConstantExpression(Expr *E, QualType T, APValue &Value, CCEKind CCE, bool RequireInt, const APValue &PreNarrowingValue)
EvaluateConvertedConstantExpression - Evaluate an Expression That is a converted constant expression ...
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement.
FPOptionsOverride CurFPFeatureOverrides()
Definition: Sema.h:1556
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Given a set of delayed diagnostics, re-emit them as if they had been delayed in the current context i...
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any.
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
Definition: SemaExpr.cpp:8268
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
StmtResult ActOnOpenMPTaskwaitDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: Sema.h:12430
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
Definition: SemaExpr.cpp:12574
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef)
Add an init-capture to a lambda scope.
Definition: SemaLambda.cpp:833
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=std::nullopt)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
Definition: SemaExpr.cpp:20928
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D)
Check variable declaration in 'omp declare mapper' construct.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
Definition: SemaAttr.cpp:735
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, BaseUsingDecl *BUD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void CheckThreadLocalForLargeAlignment(VarDecl *VD)
Definition: SemaDecl.cpp:14771
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
Definition: SemaExpr.cpp:16655
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
bool IsInsideALocalClassWithinATemplateFunction()
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
Definition: SemaExpr.cpp:5345
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
void ActOnTranslationUnitScope(Scope *S)
Scope actions.
Definition: Sema.cpp:127
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
Definition: SemaDecl.cpp:1450
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, ArrayRef< OMPClause * > ClauseList)
Called on well-formed '#pragma omp requires'.
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType, SourceLocation Loc, const PartialDiagnostic &Diag)
Is the given member accessible for the purposes of deciding whether to define a special member functi...
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
sema::LambdaScopeInfo * RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator)
Definition: SemaDecl.cpp:15648
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
Definition: SemaExpr.cpp:17308
IdentifierInfo * getSuperIdentifier() const
Definition: Sema.cpp:2695
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=std::nullopt, ArrayRef< DeclGroupPtrTy > allTUVars=std::nullopt)
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
StmtResult BuildIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:978
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
Definition: Sema.cpp:1489
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition: SemaAttr.cpp:549
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
Definition: SemaStmt.cpp:4338
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
Definition: SemaExpr.cpp:789
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
LateParsedTemplateMapT LateParsedTemplateMap
Definition: Sema.h:9074
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Definition: SemaDecl.cpp:3515
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition: Sema.h:9422
@ CTAK_DeducedFromArrayBound
The template argument was deduced from an array bound via template argument deduction.
Definition: Sema.h:9433
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition: Sema.h:9425
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
Definition: Sema.h:9429
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, const ParsedAttributesView &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S)
isTagName() - This method is called for error recovery purposes only to determine if the specified na...
Definition: SemaDecl.cpp:642
void ActOnFinishFunctionDeclarationDeclarator(Declarator &D)
Called after parsing a function declarator belonging to a function declaration.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:603
bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old)
Definition: SemaDecl.cpp:1681
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
Definition: SemaType.cpp:1150
ExprResult CheckUnevaluatedOperand(Expr *E)
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, const ImplicitConversionSequence &ICS, AssignmentAction Action, CheckedConversionKind CCK=CCK_ImplicitConversion)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType ...
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
bool isInOpenMPTaskUntiedContext() const
Return true if currently in OpenMP task with untied clause context.
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition: Sema.h:7541
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
StmtResult ActOnOpenMPMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop' after parsing of the associated statement.
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
CUDATargetContextKind
Defines kinds of CUDA global host/device context where a function may be called.
Definition: Sema.h:13163
@ CTCK_Unknown
Definition: Sema.h:13164
@ CTCK_InitGlobalVar
Unknown context.
Definition: Sema.h:13165
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition: SemaExpr.cpp:1039
void CodeCompleteObjCClassForwardDecl(Scope *S)
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
Definition: SemaExpr.cpp:14739
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path, ModuleIdPath Partition, ModuleImportState &ImportState)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
Definition: SemaModule.cpp:257
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition: Sema.h:10497
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
Definition: SemaExpr.cpp:5223
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
Definition: SemaDecl.cpp:20519
bool hasMergedDefinitionInCurrentModule(const NamedDecl *Def)
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
std::vector< Token > ExpandFunctionLocalPredefinedMacros(ArrayRef< Token > Toks)
Definition: SemaExpr.cpp:1996
bool IsAllowedCUDACall(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition: Sema.h:13219
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy, CastKind &Kind)
Definition: SemaExpr.cpp:8411
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
Definition: SemaExpr.cpp:15029
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
Definition: SemaDecl.cpp:15273
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
Definition: SemaStmt.cpp:1054
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ASTContext & Context
Definition: Sema.h:1030
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement.
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
Definition: Sema.h:6484
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
Definition: Sema.cpp:573
bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy)
Definition: SemaCast.cpp:2682
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
Definition: SemaExpr.cpp:10766
bool DiagIfReachable(SourceLocation Loc, ArrayRef< const Stmt * > Stmts, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the statements's reachability analysis.
Definition: SemaExpr.cpp:20939
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
Definition: SemaDecl.cpp:14793
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
bool ConstraintExpressionDependsOnEnclosingTemplate(const FunctionDecl *Friend, unsigned TemplateDepth, const Expr *Constraint)
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void ActOnCapturedRegionError()
Definition: SemaStmt.cpp:4927
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
ARCConversionResult
Definition: Sema.h:12636
@ ACR_error
Definition: Sema.h:12636
@ ACR_unbridged
Definition: Sema.h:12636
@ ACR_okay
Definition: Sema.h:12636
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
Definition: Sema.h:7552
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition: Sema.h:6062
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
Definition: SemaType.cpp:3075
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:12401
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition: SemaAttr.cpp:823
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
Definition: SemaDecl.cpp:5883
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition: Sema.h:10504
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
AMDGPUWavesPerEUAttr * CreateAMDGPUWavesPerEUAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, const OMPVarListLocTy &Locs, OpenMPVarListDataTy &Data)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
Definition: SemaExpr.cpp:2937
DiagnosticsEngine & getDiagnostics() const
Definition: Sema.h:498
static FormatStringType GetFormatStringType(const FormatAttr *Format)
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
Definition: SemaExpr.cpp:8678
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
void ActOnFinishTopLevelStmtDecl(TopLevelStmtDecl *D, Stmt *Statement)
Definition: SemaDecl.cpp:20540
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnCXXThis(SourceLocation loc)
void ActOnAnnotModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
Definition: SemaModule.cpp:779
void * SkippedDefinitionContext
Definition: Sema.h:3383
ExprResult BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11937
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
Definition: SemaExpr.cpp:21894
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
void resetFPOptions(FPOptions FPO)
Definition: Sema.h:9052
bool hasAcceptableDefinition(NamedDecl *D, AcceptableKind Kind)
Definition: Sema.h:12010
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:4438
QualType ProduceTemplateArgumentSignatureHelp(TemplateTy, ArrayRef< ParsedTemplateArgument >, SourceLocation LAngleLoc)
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
bool currentModuleIsImplementation() const
Is the module scope we are an implementation unit?
Definition: Sema.h:7998
DeclResult ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, SourceLocation ImportLoc, ModuleIdPath Path, bool IsPartition=false)
The parser has processed a module import declaration.
Definition: SemaModule.cpp:568
Decl * ActOnUsingEnumDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation IdentLoc, IdentifierInfo &II, CXXScopeSpec *SS=nullptr)
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen)
static bool getPrintable(bool B)
Definition: Sema.h:11675
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
Definition: SemaLookup.cpp:917
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
ExprResult SubstConstraintExprWithoutSatisfaction(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
void DiagPlaceholderFieldDeclDefinitions(RecordDecl *Record)
Emit diagnostic warnings for placeholder members.
Definition: SemaDecl.cpp:5396
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
Definition: SemaDecl.cpp:5001
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
Definition: SemaExpr.cpp:13870
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
Definition: Sema.cpp:2650
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
bool FunctionParamTypesAreEqual(ArrayRef< QualType > Old, ArrayRef< QualType > New, unsigned *ArgPos=nullptr, bool Reversed=false)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their param...
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed '#pragma omp threadprivate'.
bool SemaBuiltinVectorToScalarMath(CallExpr *TheCall)
void CheckDelayedMemberExceptionSpecs()
StmtResult ActOnEndOpenACCStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation EndLoc, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
Definition: SemaOpenACC.cpp:76
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition: SemaDecl.cpp:62
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
AllowFoldKind
Definition: Sema.h:6008
@ AllowFold
Definition: Sema.h:6010
@ NoFold
Definition: Sema.h:6009
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1517
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation > > &Functions)
Called on well-formed #pragma alloc_text().
Definition: SemaAttr.cpp:787
ClassTemplateDecl * StdCoroutineTraitsCache
The C++ "std::coroutine_traits" template, which is defined in <coroutine_traits>
Definition: Sema.h:2418
bool DeclareRISCVSiFiveVectorBuiltins
Indicate RISC-V SiFive vector builtin functions enabled or not.
Definition: Sema.h:13057
PragmaStack< bool > StrictGuardStackCheckStack
Definition: Sema.h:1552
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
Definition: Sema.h:2753
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: Sema.h:12439
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
void CleanupVarDeclMarking()
Definition: SemaExpr.cpp:20429
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
Definition: SemaConcept.cpp:91
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition: SemaExpr.cpp:755
bool isImmediateFunctionContext() const
Definition: Sema.h:6509
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
Definition: SemaDecl.cpp:2425
ASTContext & getASTContext() const
Definition: Sema.h:501
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition: SemaExpr.cpp:767
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)
Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...
ExprResult VerifyIntegerConstantExpression(Expr *E, AllowFoldKind CanFold=NoFold)
Definition: Sema.h:6025
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
void CheckCoroutineWrapper(FunctionDecl *FD)
Definition: SemaDecl.cpp:16059
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>.
Definition: Sema.h:4980
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:16571
void CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *MD)
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target update'.
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:1158
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
void CodeCompleteObjCPropertyDefinition(Scope *S)
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition: SemaAttr.cpp:922
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
Definition: SemaExpr.cpp:19722
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
Definition: SemaExpr.cpp:20680
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.
bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const
Definition: SemaDecl.cpp:1746
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
Definition: SemaModule.cpp:840
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
Definition: Sema.h:5058
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
Definition: SemaExpr.cpp:16085
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition: Sema.h:2817
@ NC_Unknown
This name is not a type or template in this context, but might be something else.
Definition: Sema.h:2820
@ NC_VarTemplate
The name was classified as a variable template name.
Definition: Sema.h:2847
@ NC_NonType
The name was classified as a specific non-type, non-template declaration.
Definition: Sema.h:2830
@ NC_TypeTemplate
The name was classified as a template whose specializations are types.
Definition: Sema.h:2845
@ NC_Error
Classification failed; an error has been produced.
Definition: Sema.h:2822
@ NC_FunctionTemplate
The name was classified as a function template name.
Definition: Sema.h:2849
@ NC_DependentNonType
The name denotes a member of a dependent type that could not be resolved.
Definition: Sema.h:2838
@ NC_UndeclaredNonType
The name was classified as an ADL-only function name.
Definition: Sema.h:2834
@ NC_UndeclaredTemplate
The name was classified as an ADL-only function template name.
Definition: Sema.h:2851
@ NC_Keyword
The name has been typo-corrected to a keyword.
Definition: Sema.h:2824
@ NC_Type
The name was classified as a type.
Definition: Sema.h:2826
@ NC_OverloadSet
The name was classified as an overload set, and an expression representing that overload set has been...
Definition: Sema.h:2843
@ NC_Concept
The name was classified as a concept name.
Definition: Sema.h:2853
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
Definition: SemaExpr.cpp:18631
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
Definition: SemaExpr.cpp:10510
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N)
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:1548
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: SemaStmt.cpp:4671
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition: SemaAttr.cpp:218
bool FunctionNonObjectParamTypesAreEqual(const FunctionDecl *OldFunction, const FunctionDecl *NewFunction, unsigned *ArgPos=nullptr, bool Reversed=false)
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition: SemaExpr.cpp:872
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
Definition: SemaExpr.cpp:3728
void ActOnStartFunctionDeclarationDeclarator(Declarator &D, unsigned TemplateParameterDepth)
Called before parsing a function declarator belonging to a function declaration.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition: SemaDecl.cpp:680
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
Definition: Sema.h:1994
Decl * ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *Ident, SourceLocation IdentLoc, SourceLocation LBrace)
Definition: SemaHLSL.cpp:15
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
ParsingClassState PushParsingClass()
Definition: Sema.h:5003
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
Definition: Sema.h:2763
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
ForRangeStatus
Definition: Sema.h:8605
@ FRS_Success
Definition: Sema.h:8606
@ FRS_DiagnosticIssued
Definition: Sema.h:8608
@ FRS_NoViableFunction
Definition: Sema.h:8607
bool CheckArgsForPlaceholders(MultiExprArg args)
Check an argument list for placeholders that we won't try to handle later.
Definition: SemaExpr.cpp:6924
void ActOnPragmaCXLimitedRange(SourceLocation Loc, LangOptions::ComplexRangeKind Range)
ActOnPragmaCXLimitedRange - Called on well formed #pragma STDC CX_LIMITED_RANGE.
Definition: SemaAttr.cpp:1355
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
Definition: SemaExpr.cpp:3335
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
Definition: SemaAttr.cpp:1363
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition: SemaAttr.cpp:111
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
Definition: SemaExpr.cpp:7787
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Definition: SemaExpr.cpp:16623
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
StmtResult ActOnOpenMPParallelMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop' after parsing of the associated statemen...
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition: Sema.h:734
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, std::optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition: Sema.h:7600
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
void CodeCompleteUsingDirective(Scope *S)
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition: Sema.h:7544
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
Definition: SemaDecl.cpp:4846
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
Definition: Sema.h:4655
@ Relational
This is an <, <=, >, or >= that should be implemented as a rewrite in terms of a <=> comparison.
@ NotEqual
This is an operator!= that should be implemented as a rewrite in terms of a == comparison.
@ ThreeWay
This is an operator<=> that should be implemented as a series of subobject comparisons.
@ None
This is not a defaultable comparison operator.
@ Equal
This is an operator== that should be implemented as a series of subobject comparisons.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, const SourceRange &, DeclAccessPair FoundDecl)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
Definition: SemaExpr.cpp:8694
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized.
Definition: Sema.h:7290
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
IsPointerConversion - Determines whether the conversion of the expression From, which has the (possib...
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
Definition: SemaType.cpp:9635
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr, TemplateSpecCandidateSet *FailedTSC=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
AllowedExplicit
Definition: Sema.h:8201
@ Conversions
Allow explicit conversion functions but not explicit constructors.
@ All
Allow both explicit conversion functions and explicit constructors.
void ActOnFinishRequiresExpr()
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
Definition: Sema.h:969
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Definition: SemaExpr.cpp:13916
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
void ProcessPragmaWeak(Scope *S, Decl *D)
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
Definition: SemaDecl.cpp:20688
void CodeCompleteTypeQualifiers(DeclSpec &DS)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation, bool IsUsingIfExists)
Builds a using declaration.
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaType.cpp:6816
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Definition: Sema.h:947
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
Decl * BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record, const PrintingPolicy &Policy)
BuildAnonymousStructOrUnion - Handle the declaration of an anonymous structure or union.
Definition: SemaDecl.cpp:5553
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
Definition: SemaAttr.cpp:522
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
Definition: Sema.h:2776
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition: Sema.cpp:1494
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:17092
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition: Sema.cpp:2400
unsigned InventedParameterInfosStart
The index of the first InventedParameterInfo that refers to the current context.
Definition: Sema.h:2668
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
Definition: SemaDecl.cpp:9114
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
Definition: SemaExpr.cpp:2199
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel master' after parsing of the associated statement.
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, std::optional< CXXRecordDecl::LambdaNumbering > NumberingOverride=std::nullopt)
Number lambda for linkage purposes if necessary.
Definition: SemaLambda.cpp:413
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=std::nullopt)
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition: Sema.h:9064
void setFunctionHasIndirectGoto()
Definition: Sema.cpp:2321
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
bool CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
Definition: SemaType.cpp:2371
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition: Sema.h:9508
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition: Sema.h:9526
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
Definition: Sema.h:9537
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
Definition: Sema.h:9516
@ TPL_TemplateParamsEquivalent
We are determining whether the template-parameters are equivalent according to C++ [temp....
Definition: Sema.h:9547
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16911
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition: Sema.h:3727
EnumDecl * getStdAlignValT() const
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
Definition: Sema.cpp:1508
QualType BuiltinRemoveReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:9979
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
Definition: SemaExpr.cpp:1668
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition: Sema.h:6707
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'reduction' clause.
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition: SemaAttr.cpp:273
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
Definition: SemaExpr.cpp:8021
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
AssumedTemplateKind
Definition: Sema.h:9124
@ FoundFunctions
This is assumed to be a template name because lookup found one or more functions (but no function tem...
@ FoundNothing
This is assumed to be a template name because lookup found nothing.
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, bool SkipTargetFirstParameter, SourceLocation TargetLoc, const FunctionProtoType *Source, bool SkipSourceFirstParameter, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition: SemaAttr.cpp:681
bool isInMaterializeTemporaryObjectContext() const
Definition: Sema.h:6727
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld)
MergeVarDeclTypes - We parsed a variable 'New' which has the same name and scope as a previous declar...
Definition: SemaDecl.cpp:4428
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
ExprResult ActOnUnevaluatedStringLiteral(ArrayRef< Token > StringToks)
Definition: SemaExpr.cpp:1966
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: Sema.h:12433
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
Definition: SemaType.cpp:1961
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind)
Called on correct id-expression from the '#pragma omp threadprivate'.
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
OMPClause * ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
bool isSameOrCompatibleFunctionType(QualType Param, QualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment,...
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition: SemaStmt.cpp:1242
AtomicArgumentOrder
Definition: Sema.h:2094
void PushFunctionScope()
Enter a new function scope.
Definition: Sema.cpp:2141
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
Definition: SemaDecl.cpp:1263
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
Definition: SemaCast.cpp:387
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition: Sema.cpp:1514
SourceRange getExprRange(Expr *E) const
Definition: SemaExpr.cpp:512
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
FunctionTemplateDecl * DeclareImplicitDeductionGuideFromInitList(TemplateDecl *Template, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc)
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
Definition: SemaStmt.cpp:3447
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaStmt.cpp:2237
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
Definition: SemaAttr.cpp:1331
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
void PrintPragmaAttributeInstantiationPoint()
Definition: SemaAttr.cpp:1127
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2972
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
Definition: Sema.h:9057
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition: SemaAttr.cpp:167
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
Definition: Sema.h:819
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
LazyVector< const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition: Sema.h:2749
std::optional< ExpressionEvaluationContextRecord::InitializationContext > OutermostDeclarationWithDelayedImmediateInvocations() const
Definition: Sema.h:6542
static DeclarationName getPrintable(DeclarationName N)
Definition: Sema.h:11682
llvm::function_ref< void(SourceLocation Loc, PartialDiagnostic PD)> DiagReceiverTy
Definition: Sema.h:3529
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
Definition: SemaDecl.cpp:16985
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
bool FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD)
void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
Definition: SemaStmt.cpp:221
FPOptions & getCurFPFeatures()
Definition: Sema.h:496
RecordDecl * StdSourceLocationImplDecl
The C++ "std::source_location::__impl" struct, defined in <source_location>.
Definition: Sema.h:6666
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition: Sema.h:1079
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK, bool MissingOK=false)
Definition: SemaExpr.cpp:21174
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:58
sema::LambdaScopeInfo * PushLambdaScope()
Definition: Sema.cpp:2159
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
StmtResult ActOnOpenMPInteropDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp interop'.
void PopCompoundScope()
Definition: Sema.cpp:2298
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11961
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, const MultiLevelTemplateArgumentList &TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
bool isObjCMethodDecl(Decl *D)
Definition: Sema.h:12263
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition: Sema.h:11027
@ UPPC_FixedUnderlyingType
The fixed underlying type of an enumeration.
Definition: Sema.h:11047
@ UPPC_RequiresClause
Definition: Sema.h:11098
@ UPPC_UsingDeclaration
A using declaration.
Definition: Sema.h:11053
@ UPPC_IfExists
Microsoft __if_exists.
Definition: Sema.h:11080
@ UPPC_Requirement
Definition: Sema.h:11095
@ UPPC_ExceptionType
The type of an exception.
Definition: Sema.h:11071
@ UPPC_EnumeratorValue
The enumerator value.
Definition: Sema.h:11050
@ UPPC_Lambda
Lambda expression.
Definition: Sema.h:11086
@ UPPC_IfNotExists
Microsoft __if_not_exists.
Definition: Sema.h:11083
@ UPPC_PartialSpecialization
Partial specialization.
Definition: Sema.h:11077
@ UPPC_Initializer
An initializer.
Definition: Sema.h:11062
@ UPPC_BaseType
The base type of a class type.
Definition: Sema.h:11032
@ UPPC_FriendDeclaration
A friend declaration.
Definition: Sema.h:11056
@ UPPC_DefaultArgument
A default argument.
Definition: Sema.h:11065
@ UPPC_DeclarationType
The type of an arbitrary declaration.
Definition: Sema.h:11035
@ UPPC_Expression
An arbitrary expression.
Definition: Sema.h:11029
@ UPPC_ExplicitSpecialization
Explicit specialization.
Definition: Sema.h:11074
@ UPPC_DeclarationQualifier
A declaration qualifier.
Definition: Sema.h:11059
@ UPPC_DataMemberType
The type of a data member.
Definition: Sema.h:11038
@ UPPC_StaticAssertExpression
The expression in a static assertion.
Definition: Sema.h:11044
@ UPPC_Block
Block expression.
Definition: Sema.h:11089
@ UPPC_BitFieldWidth
The size of a bit-field.
Definition: Sema.h:11041
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
Definition: Sema.h:11068
@ UPPC_TypeConstraint
A type constraint.
Definition: Sema.h:11092
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition: Sema.h:12448
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaStmt.cpp:4320
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
api_notes::APINotesManager APINotes
Definition: Sema.h:1034
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
bool IsLayoutCompatible(QualType T1, QualType T2) const
void checkAllowedCUDAInitializer(VarDecl *VD)
Definition: SemaCUDA.cpp:643
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UsingDecl, bool IsNested)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
bool ActOnOpenACCClause(OpenACCClauseKind ClauseKind, SourceLocation StartLoc)
Called after parsing an OpenACC Clause so that it can be checked.
Definition: SemaOpenACC.cpp:40
llvm::DenseMap< Decl *, SmallVector< PartialDiagnosticAt, 1 > > SuppressedDiagnosticsMap
For each declaration that involved template argument deduction, the set of diagnostics that were supp...
Definition: Sema.h:9817
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool Mutable)
Endow the lambda scope info with the relevant properties.
Definition: SemaLambda.cpp:480
const LangOptions & getLangOpts() const
Definition: Sema.h:494
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl, bool SupportedForCompatibility=false)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: Sema.h:11833
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
ExprResult BuildSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
Definition: SemaExpr.cpp:3773
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
Definition: SemaType.cpp:9219
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void DiagnoseInvalidJumps(Stmt *Body)
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acquire' clause.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition: Sema.h:4545
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
AccessResult CheckStructuredBindingMemberAccess(SourceLocation UseLoc, CXXRecordDecl *DecomposedClass, DeclAccessPair Field)
Checks implicit access to a member in a structured binding.
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:1716
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13070
SourceLocation CurInitSegLoc
Definition: Sema.h:1588
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
Definition: SemaExpr.cpp:8036
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Definition: SemaExpr.cpp:13845
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:610
bool currentModuleIsHeaderUnit() const
Is the module scope we are in a C++ Header Unit?
Definition: Sema.h:2770
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, const DeclSpec &DS)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
void SwapSatisfactionStack(llvm::SmallVectorImpl< SatisfactionStackEntryTy > &NewSS)
Definition: Sema.h:11456
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
Definition: SemaDecl.cpp:1407
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
ReuseLambdaContextDecl_t
Definition: Sema.h:5416
@ ReuseLambdaContextDecl
Definition: Sema.h:5416
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition: SemaCUDA.cpp:801
bool tryToFixVariablyModifiedVarType(TypeSourceInfo *&TInfo, QualType &T, SourceLocation Loc, unsigned FailedFoldDiagID)
Attempt to fold a variable-sized type to a constant-sized type, returning true if we were successful.
Definition: SemaDecl.cpp:6700
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind PrevMappedDirective=llvm::omp::OMPD_unknown)
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
void CodeCompleteObjCSelector(Scope *S, ArrayRef< IdentifierInfo * > SelIdents)
void MarkExpressionAsImmediateEscalating(Expr *E)
Definition: SemaExpr.cpp:18306
void NoteTemplateLocation(const NamedDecl &Decl, std::optional< SourceRange > ParamRange={})
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
Definition: SemaDecl.cpp:6738
bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old)
We've determined that New is a redeclaration of Old.
Definition: SemaDecl.cpp:1618
void ActOnLambdaClosureParameters(Scope *LambdaScope, MutableArrayRef< DeclaratorChunk::ParamInfo > ParamInfo)
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
void ActOnOpenMPIteratorVarDecl(VarDecl *VD)
ASTConsumer & getASTConsumer() const
Definition: Sema.h:502
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
Definition: SemaExpr.cpp:2247
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules,...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition: SemaCUDA.cpp:860
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
Definition: SemaExpr.cpp:20805
void * OpaqueParser
Definition: Sema.h:1077
void ActOnOpenACCConstruct(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the construct has been parsed, but clauses haven't been parsed.
Definition: SemaOpenACC.cpp:50
Preprocessor & PP
Definition: Sema.h:1029
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:11853
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
Definition: SemaExpr.cpp:6454
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
void CodeCompleteObjCImplementationDecl(Scope *S)
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
Definition: SemaExpr.cpp:7195
ExprResult BuildSynthesizedThreeWayComparison(SourceLocation OpLoc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, FunctionDecl *DefaultedFn)
QualType BuiltinEnumUnderlyingType(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:9904
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
bool CheckUseOfCXXMethodAsAddressOfOperand(SourceLocation OpLoc, const Expr *Op, const CXXMethodDecl *MD)
Definition: SemaExpr.cpp:14994
OMPClause * ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acq_rel' clause.
StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop simd' after parsing of the associated sta...
bool MSPragmaOptimizeIsOn
The "on" or "off" argument passed by #pragma optimize, that denotes whether the optimizations in the ...
Definition: Sema.h:1635
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
Definition: SemaExpr.cpp:17581
void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Decl *D, SmallVectorImpl< FunctionDecl * > &Bases)
Register D as specialization of all base functions in Bases in the current omp begin/end declare vari...
bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty, SourceLocation OpLoc, SourceRange R)
ActOnAlignasTypeArgument - Handle alignas(type-id) and _Alignas(type-name) .
Definition: SemaExpr.cpp:4946
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition: Sema.h:1070
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition: Sema.h:1613
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
Definition: SemaDecl.cpp:8323
void checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D=nullptr)
Check if the type is allowed to be used for the current target.
Definition: Sema.cpp:1934
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind, bool StrictlyPositive=true, bool SuppressExprDiags=false)
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void updateOutOfDateSelector(Selector Sel)
bool areMatrixTypesOfTheSameDimension(QualType srcTy, QualType destTy)
Are the two types matrix types and do they have the same dimensions i.e.
Definition: SemaExpr.cpp:8306
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
void DiagnoseInvalidExplicitObjectParameterInLambda(CXXMethodDecl *Method)
Definition: SemaLambda.cpp:389
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
LazyVector< VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition: Sema.h:2757
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition: Sema.cpp:636
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: Sema.h:12436
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition: Sema.h:4956
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
void CodeCompleteObjCPropertySetter(Scope *S)
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
Definition: Sema.h:11484
const LangOptions & LangOpts
Definition: Sema.h:1028
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
Definition: SemaStmt.cpp:3111
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: Sema.h:12693
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly=false)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From,...
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
Definition: SemaExpr.cpp:16725
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
Definition: Sema.h:975
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Definition: Sema.h:7095
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition: Sema.cpp:2375
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
Definition: SemaExpr.cpp:7463
static const uint64_t MaximumAlignment
Definition: Sema.h:970
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: Sema.h:12386
void ActOnHLSLTopLevelFunction(FunctionDecl *FD)
Definition: SemaDecl.cpp:12561
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
llvm::DenseMap< unsigned, CXXDeductionGuideDecl * > AggregateDeductionCandidates
Definition: Sema.h:7293
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
Definition: SemaExpr.cpp:18327
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
Definition: SemaInit.cpp:8541
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
void ActOnStartOfCompoundStmt(bool IsStmtExpr)
Definition: SemaStmt.cpp:391
bool isReachable(const NamedDecl *D)
Determine whether a declaration is reachable.
Definition: Sema.h:11974
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
Definition: SemaDecl.cpp:15492
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition: Sema.h:4958
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
Definition: SemaDecl.cpp:15359
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition: Sema.h:9073
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition: Sema.h:973
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition: Sema.h:7599
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
Definition: Sema.cpp:1042
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
Definition: SemaDecl.cpp:1875
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization, bool DeclIsDefn)
Perform semantic checking of a new function declaration.
Definition: SemaDecl.cpp:11970
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
Definition: SemaDecl.cpp:18651
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
Definition: SemaExpr.cpp:18291
ObjCLiteralKind
Definition: Sema.h:5938
@ LK_Boxed
Definition: Sema.h:5942
@ LK_Dictionary
Definition: Sema.h:5940
@ LK_String
Definition: Sema.h:5943
@ LK_Array
Definition: Sema.h:5939
@ LK_Numeric
Definition: Sema.h:5941
@ LK_None
Definition: Sema.h:5945
@ LK_Block
Definition: Sema.h:5944
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst)
Update instantiation attributes after template was late parsed.
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
PragmaClangSection PragmaClangRelroSection
Definition: Sema.h:1325
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, QualType BaseType)
Checks access to Target from the given class.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
bool checkConstantPointerAuthKey(Expr *keyExpr, unsigned &key)
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition: Sema.h:1302
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
Definition: Sema.h:4551
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *RetExpr, const AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec....
Definition: SemaStmt.cpp:3863
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
Definition: SemaLambda.cpp:741
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition: SemaExpr.cpp:201
void CheckCXXDefaultArguments(FunctionDecl *FD)
Helpers for dealing with blocks and functions.
ComparisonCategoryUsage
Definition: Sema.h:4034
@ OperatorInExpression
The '<=>' operator was used in an expression and a builtin operator was selected.
@ DefaultedOperator
A defaulted 'operator<=>' needed the comparison category.
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
Definition: Sema.h:10755
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
Definition: Sema.h:4951
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition: SemaExpr.cpp:68
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool isInOpenMPAssumeScope() const
Check if there is an active global omp begin assumes directive.
Definition: Sema.h:13578
void startOpenMPCXXRangeFor()
If the current region is a range loop-based region, mark the start of the loop construct.
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: Sema.h:12424
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
Definition: SemaExpr.cpp:20815
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level)
Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.) for FD based on DSA for the...
WebAssemblyImportModuleAttr * mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL)
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
Definition: SemaExpr.cpp:10793
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
static StringRef getPrintable(StringRef S)
Definition: Sema.h:11677
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
void MaybeAddCUDAConstantAttr(VarDecl *VD)
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings.
Definition: SemaCUDA.cpp:787
NamedDecl * BuildUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation NameLoc, TypeSourceInfo *EnumType, EnumDecl *ED)
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
Definition: SemaAttr.cpp:1209
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
Definition: SemaStmt.cpp:3854
PragmaStack< AlignPackInfo > AlignPackStack
Definition: Sema.h:1537
StmtResult ActOnOpenMPMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop simd' after parsing of the associated statement.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
bool canDelayFunctionBody(const Declarator &D)
Determine whether we can delay parsing the body of a function or function template until it is used,...
Definition: SemaDecl.cpp:15945
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition: Sema.h:5050
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition: Sema.h:5371
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
Definition: Sema.h:10529
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition: Sema.h:4984
void CodeCompleteNamespaceDecl(Scope *S)
StmtResult ActOnExprStmtError()
Definition: SemaStmt.cpp:65
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
AcceptableKind
Definition: Sema.h:7595
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:1547
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
Definition: SemaStmt.cpp:3542
void CodeCompleteDesignator(const QualType BaseType, llvm::ArrayRef< Expr * > InitExprs, const Designation &D)
Trigger code completion for a record of BaseType.
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed.
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
void completeExprArrayBound(Expr *E)
Definition: SemaType.cpp:9146
DeclContext * getCurLexicalContext() const
Definition: Sema.h:873
std::function< TypeResult(StringRef, StringRef, SourceLocation)> ParseTypeFromStringCallback
Callback to the parser to parse a type expressed as a string.
Definition: Sema.h:1088
ExprResult BuildConvertedConstantExpression(Expr *From, QualType T, CCEKind CCE, NamedDecl *Dest=nullptr)
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
Definition: Sema.h:1591
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
Definition: Sema.cpp:1501
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
Definition: SemaType.cpp:9733
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool UseMemberUsingDeclRules)
Determine whether the given New declaration is an overload of the declarations in Old.
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
bool hasExplicitCallingConv(QualType T)
Definition: SemaType.cpp:8323
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, CorrectionCandidateCallback *CCC=nullptr)
Perform name lookup on the given name, classifying it based on the results of name lookup and the fol...
Definition: SemaDecl.cpp:875
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: Sema.h:12442
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition: SemaStmt.cpp:70
OpenCLOptions OpenCLFeatures
Definition: Sema.h:1025
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
bool CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, SourceLocation DefaultLoc)
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
Decl * ActOnConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr)
SmallVector< std::deque< PendingImplicitInstantiation >, 8 > SavedPendingInstantiations
Definition: Sema.h:10759
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition: SemaExpr.cpp:937
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:17063
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
Definition: Sema.h:1638
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
void ExitDeclaratorContext(Scope *S)
Definition: SemaDecl.cpp:1394
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
Definition: SemaExpr.cpp:16534
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition: Sema.h:13706
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
Definition: SemaSYCL.cpp:42
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
Definition: SemaDecl.cpp:8475
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, OMPDeclareTargetDeclAttr::MapTypeTy MT, DeclareTargetContextInfo &DTCI)
Called on correct id-expression from the '#pragma omp declare target'.
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition: Sema.cpp:717
void CodeCompleteNaturalLanguage()
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
void CodeCompleteOperatorName(Scope *S)
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'in_reduction' clause.
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
Definition: SemaStmt.cpp:4771
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaAttr.cpp:851
bool buildCoroutineParameterMoves(SourceLocation Loc)
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
Definition: SemaCast.cpp:3331
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition: Sema.h:13581
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
Definition: SemaModule.cpp:161
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted)
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
Definition: SemaStmt.cpp:4838
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const TemplateCompareNewDeclInfo &New, const Expr *NewConstr)
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
Definition: SemaDecl.cpp:12526
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition: Sema.h:11671
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop simd' after parsing of the associated statement.
ProcessingContextState ParsingClassState
Definition: Sema.h:5002
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
void DiagnoseMisalignedMembers()
Diagnoses the current set of gathered accesses.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, const ParsedAttributesView &Attrs, SourceLocation EqualLoc, Expr *Val)
Definition: SemaDecl.cpp:20022
sema::FunctionScopeInfo * getCurFunction() const
Definition: Sema.h:1064
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
void PushCompoundScope(bool IsStmtExpr)
Definition: Sema.cpp:2293
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel sections' after parsing of the associated statement.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Definition: SemaDecl.cpp:15025
FunctionDecl * CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID, SourceLocation Loc)
Definition: SemaDecl.cpp:2384
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, QualType RawObj1Ty={}, QualType RawObj2Ty={}, bool Reversed=false)
Returns the more specialized function template according to the rules of function template partial or...
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
Definition: SemaDecl.cpp:2359
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Definition: SemaExpr.cpp:3165
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
bool isDeclaratorFunctionLike(Declarator &D)
Determine whether.
Definition: Sema.cpp:2737
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
Definition: SemaType.cpp:2264
bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent)
Determine whether it's plausible that E was intended to be a template-name.
Definition: Sema.h:3029
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition: Sema.h:2072
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
Definition: SemaDecl.cpp:20574
std::optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
void CUDARecordImplicitHostDeviceFuncUsedByDevice(const FunctionDecl *FD)
Record FD if it is a CUDA/HIP implicit host device function used on device side in device compilation...
Definition: SemaCUDA.cpp:690
QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, ArithConvKind OperationKind)
Definition: SemaExpr.cpp:11321
bool CheckNontrivialField(FieldDecl *FD)
Definition: SemaDecl.cpp:18841
CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
Definition: SemaCUDA.cpp:225
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
void CodeCompleteObjCAtVisibility(Scope *S)
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
HLSLNumThreadsAttr * mergeHLSLNumThreadsAttr(Decl *D, const AttributeCommonInfo &AL, int X, int Y, int Z)
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
Definition: SemaExpr.cpp:10562
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
Definition: SemaStmt.cpp:1660
llvm::DenseMap< const VarDecl *, int > RefsMinusAssignments
Increment when we find a reference; decrement when we find an ignored assignment.
Definition: Sema.h:5368
ExprResult ActOnFinishTrailingRequiresClause(ExprResult ConstraintExpr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
Definition: SemaAttr.cpp:1219
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, bool SkipSupersetFirstParameter, SourceLocation SuperLoc, const FunctionProtoType *Subset, bool SkipSubsetFirstParameter, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
ExprResult PerformQualificationConversion(Expr *E, QualType Ty, ExprValueKind VK=VK_PRValue, CheckedConversionKind CCK=CCK_ImplicitConversion)
Definition: SemaInit.cpp:8559
void CodeCompleteNamespaceAliasDecl(Scope *S)
ExplicitSpecifier instantiateExplicitSpecifier(const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES)
bool CheckCountedByAttr(Scope *Scope, const FieldDecl *FD)
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, bool IsAbstract, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
Definition: SemaDecl.cpp:18311
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
Definition: Sema.cpp:2094
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition: Sema.h:10046
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
Definition: SemaInit.cpp:10712
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body,...
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
StmtResult ActOnOpenMPParallelMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop simd' after parsing of the associated sta...
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width,...
Definition: SemaDecl.cpp:18447
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
Definition: SemaDecl.cpp:8987
void LateTemplateParserCleanupCB(void *P)
Definition: Sema.h:1074
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
Definition: Sema.h:4541
void MarkThisReferenced(CXXThisExpr *This)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
std::optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody)
Warn if a for/while loop statement S, which is followed by PossibleBody, has a suspicious null statem...
ExprResult DefaultLvalueConversion(Expr *E)
Definition: SemaExpr.cpp:645
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:10537
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Definition: SemaExpr.cpp:3423
SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition: Sema.h:11968
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
bool isInLifetimeExtendingContext() const
Definition: Sema.h:6513
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:1587
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
Definition: SemaDecl.cpp:20608
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
Definition: Sema.h:7993
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so,...
Definition: SemaDecl.cpp:9009
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: Sema.h:12466
void CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax, AttributeCompletion Completion=AttributeCompletion::Attribute, const IdentifierInfo *Scope=nullptr)
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
Definition: SemaExpr.cpp:8006
StmtResult ActOnOpenMPUnrollDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp unroll' after parsing of its clauses and the associated statement.
struct clang::Sema::CUDATargetContext CurCUDATargetCtx
static bool isCast(CheckedConversionKind CCK)
Definition: Sema.h:1930
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ControllingExprOrType is either an opaque pointer coming out of a ParsedType or an Expr *.
Definition: SemaExpr.cpp:1636
void DiagPlaceholderVariableDefinition(SourceLocation Loc)
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
Definition: SemaExpr.cpp:17100
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
Definition: SemaExpr.cpp:8452
void NoteOverloadCandidate(const NamedDecl *Found, const FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:15594
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition: Sema.cpp:2331
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
bool DiagnoseUseOfOverloadedDecl(NamedDecl *D, SourceLocation Loc)
Definition: Sema.h:5394
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition: Sema.h:4965
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
Definition: SemaDecl.cpp:18296
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
Definition: SemaDecl.cpp:15521
FunctionDecl * resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition: Sema.h:1163
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Sema.h:7688
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
Definition: Sema.h:7691
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition: Sema.h:7694
@ ForExternalRedeclaration
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Definition: Sema.h:7698
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true, bool WantSize=false, bool WantAligned=false)
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
Definition: SemaInit.cpp:8522
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition: Sema.h:7682
bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type, bool IsDeclareSimd=false)
Checks that the specified declaration matches requirements for the linear decls.
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
Definition: SemaExpr.cpp:21639
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
Definition: SemaCast.cpp:278
DeclGroupPtrTy ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, SourceLocation PrivateLoc)
The parser has processed a private-module-fragment declaration that begins the definition of the priv...
Definition: SemaModule.cpp:506
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
Definition: SemaDecl.cpp:15065
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition: Sema.h:9818
@ VAK_Invalid
Definition: Sema.h:6271
@ VAK_Valid
Definition: Sema.h:6267
@ VAK_ValidInCXX11
Definition: Sema.h:6268
@ VAK_MSVCUndefined
Definition: Sema.h:6270
@ VAK_Undefined
Definition: Sema.h:6269
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
Definition: SemaAttr.cpp:1155
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
Definition: SemaDecl.cpp:5889
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition: Sema.h:10768
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:9940
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:502
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
Definition: SemaExpr.cpp:17463
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition: Sema.h:1710
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
Definition: SemaType.cpp:4228
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
Definition: SemaCUDA.cpp:723
ExprResult ActOnPackIndexingExpr(Scope *S, Expr *PackExpression, SourceLocation EllipsisLoc, SourceLocation LSquareLoc, Expr *IndexExpr, SourceLocation RSquareLoc)
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:778
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
static SourceRange getPrintable(TypeLoc TL)
Definition: Sema.h:11687
bool DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
Definition: SemaExpr.cpp:8703
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation(), bool ForOverloadResolution=false)
Check whether the given function decl's trailing requires clause is satisfied, if any.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
QualType QIDNSCopying
id<NSCopying> type.
Definition: Sema.h:12463
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
TrivialABIHandling
Definition: Sema.h:4838
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
Definition: Sema.h:4840
@ TAH_ConsiderTrivialABI
The triviality of a method affected by "trivial_abi".
Definition: Sema.h:4843
FormatArgumentPassingKind
Definition: Sema.h:2004
@ FAPK_Fixed
Definition: Sema.h:2005
@ FAPK_Variadic
Definition: Sema.h:2006
@ FAPK_VAList
Definition: Sema.h:2007
void FillInlineAsmIdentifierInfo(Expr *Res, llvm::InlineAsmIdentifierInfo &Info)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
Definition: SemaExpr.cpp:20868
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
Definition: Sema.h:6505
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition: Sema.h:10037
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
Definition: Sema.cpp:1469
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, NamedReturnInfo &NRInfo, bool SupressSimplerImplicitMoves)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes.
Definition: SemaStmt.cpp:3648
MethodMatchStrategy
Definition: Sema.h:12094
@ MMS_strict
Definition: Sema.h:12094
@ MMS_loose
Definition: Sema.h:12094
void PushForceCUDAHostDevice()
Increments our count of the number of times we've seen a pragma forcing functions to be host device.
Definition: SemaCUDA.cpp:37
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
OMPClause * ActOnOpenMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'release' clause.
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
Definition: Sema.h:7593
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition: Sema.h:6309
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition: Sema.h:6353
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
Definition: Sema.h:6319
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition: Sema.h:6377
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition: Sema.h:6382
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
Definition: Sema.h:6369
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition: Sema.h:6348
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
Definition: Sema.h:6327
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
Definition: Sema.h:6386
@ Compatible
Compatible - the types are compatible according to the standard.
Definition: Sema.h:6311
@ IncompatibleFunctionPointerStrict
IncompatibleFunctionPointerStrict - The assignment is between two function pointer types that are not...
Definition: Sema.h:6338
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
Definition: Sema.h:6390
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition: Sema.h:6323
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
Definition: Sema.h:6332
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition: Sema.h:6344
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
Definition: Sema.h:6365
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
Definition: Sema.h:6359
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
Definition: Sema.h:6315
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition: Sema.h:6373
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
QualType ProduceCtorInitMemberSignatureHelp(Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy, ArrayRef< Expr * > ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc, bool Braced)
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
void MarkVirtualBaseDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl, llvm::SmallPtrSetImpl< const RecordType * > *DirectVirtualBases=nullptr)
Mark destructors of virtual bases of this class referenced.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
ParserCompletionContext
Describes the context in which code completion occurs.
Definition: Sema.h:12818
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition: Sema.h:12852
@ PCC_LocalDeclarationSpecifiers
Code completion occurs within a sequence of declaration specifiers within a function,...
Definition: Sema.h:12860
@ PCC_Template
Code completion occurs following one or more template headers.
Definition: Sema.h:12834
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
Definition: Sema.h:12837
@ PCC_Expression
Code completion occurs within an expression.
Definition: Sema.h:12839
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
Definition: Sema.h:12825
@ PCC_TopLevelOrExpression
Code completion occurs at top-level in a REPL session.
Definition: Sema.h:12862
@ PCC_Class
Code completion occurs within a class, struct, or union.
Definition: Sema.h:12822
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
Definition: Sema.h:12828
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition: Sema.h:12857
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
Definition: Sema.h:12820
@ PCC_Type
Code completion occurs where only a type is permitted.
Definition: Sema.h:12854
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition: Sema.h:12848
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition: Sema.h:12845
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition: Sema.h:12842
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
Definition: Sema.h:12831
void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD)
Check that the C++ class annoated with "trivial_abi" satisfies all the conditions that are needed for...
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool EmptyPack=false)
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
Definition: SemaDecl.cpp:8516
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
Definition: SemaDecl.cpp:19996
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
Definition: SemaDecl.cpp:1305
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnCapturedRegionEnd(Stmt *S)
Definition: SemaStmt.cpp:4942
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
Definition: Sema.h:6152
@ ACK_Arithmetic
An arithmetic operation.
Definition: Sema.h:6154
@ ACK_CompAssign
A compound assignment expression.
Definition: Sema.h:6162
@ ACK_BitwiseOp
A bitwise operation.
Definition: Sema.h:6156
@ ACK_Conditional
A conditional (?:) operator.
Definition: Sema.h:6160
@ ACK_Comparison
A comparison.
Definition: Sema.h:6158
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
Definition: SemaDecl.cpp:4789
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
Definition: SemaExpr.cpp:20762
StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp critical' after parsing of the associated statement.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind ActOnExplicitInstantiationNewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
Definition: Sema.h:11981
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
QualType getDecltypeForExpr(Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
Definition: SemaType.cpp:9760
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II, SourceLocation Loc)
DeclClonePragmaWeak - clone existing decl (maybe definition), #pragma weak needs a non-definition dec...
ObjCContainerDecl * getObjCDeclContext() const
Definition: SemaDecl.cpp:20604
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
StmtResult ActOnOpenMPParallelMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel masked' after parsing of the associated statement.
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool CheckTypeConstraint(TemplateIdAnnotation *TypeConstraint)
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition: Sema.h:13446
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:2161
bool isKnownName(StringRef name)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
Definition: SemaStmt.cpp:3337
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
Definition: Sema.h:6718
AMDGPUMaxNumWorkGroupsAttr * CreateAMDGPUMaxNumWorkGroupsAttr(const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
Create an AMDGPUMaxNumWorkGroupsAttr attribute.
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
Definition: SemaExpr.cpp:4341
ExprResult ActOnSourceLocExpr(SourceLocIdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
Definition: SemaExpr.cpp:17548
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition: Sema.h:2767
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
Definition: Sema.h:5184
bool MSStructPragmaOn
Definition: Sema.h:1299
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Definition: SemaExpr.cpp:21731
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
Definition: SemaType.cpp:9371
ExprResult TransformToPotentiallyEvaluated(Expr *E)
Definition: SemaExpr.cpp:18184
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
unsigned ActOnReenterTemplateScope(Decl *Template, llvm::function_ref< Scope *()> EnterScope)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
StmtResult ActOnOpenMPMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp masked' after parsing of the.
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore,...
Definition: Sema.h:10513
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:890
@ CCK_OtherCast
A cast other than a C-style cast.
Definition: Sema.h:898
@ CCK_ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
Definition: Sema.h:900
@ CCK_CStyleCast
A C-style cast.
Definition: Sema.h:894
@ CCK_ImplicitConversion
An implicit conversion.
Definition: Sema.h:892
@ CCK_FunctionalCast
A functional-style cast.
Definition: Sema.h:896
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: Sema.h:12076
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
Definition: SemaDecl.cpp:15969
bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, QualType NewT, QualType OldT)
Determines if we can perform a correct type check for D as a redeclaration of PrevDecl.
Definition: SemaDecl.cpp:11115
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
ExprResult CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, NestedNameSpecifierLoc NNSLoc, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL=true)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition: Sema.h:10722
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition: Sema.h:3298
@ NTK_Typedef
Definition: Sema.h:3303
@ NTK_NonUnion
Definition: Sema.h:3301
@ NTK_TypeAlias
Definition: Sema.h:3304
@ NTK_NonClass
Definition: Sema.h:3300
@ NTK_NonEnum
Definition: Sema.h:3302
@ NTK_NonStruct
Definition: Sema.h:3299
@ NTK_TemplateTemplateArgument
Definition: Sema.h:3307
@ NTK_TypeAliasTemplate
Definition: Sema.h:3306
@ NTK_Template
Definition: Sema.h:3305
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID)
Definition: Sema.h:11956
void ActOnObjCContainerFinishDefinition()
Definition: SemaDecl.cpp:18412
void ActOnOpenMPEndDeclareVariant()
Handle a omp end declare variant.
SourceManager & getSourceManager() const
Definition: Sema.h:499
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
Definition: SemaModule.cpp:721
TryCaptureKind
Definition: Sema.h:5458
@ TryCapture_Implicit
Definition: Sema.h:5459
@ TryCapture_ExplicitByVal
Definition: Sema.h:5460
@ TryCapture_ExplicitByRef
Definition: Sema.h:5461
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement.
QualType BuiltinAddReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:9956
bool isCFError(RecordDecl *D)
Definition: SemaType.cpp:4438
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition: Sema.h:6782
AssignmentAction
Definition: Sema.h:5379
@ AA_Returning
Definition: Sema.h:5382
@ AA_Passing_CFAudited
Definition: Sema.h:5387
@ AA_Initializing
Definition: Sema.h:5384
@ AA_Converting
Definition: Sema.h:5383
@ AA_Assigning
Definition: Sema.h:5380
@ AA_Passing
Definition: Sema.h:5381
@ AA_Casting
Definition: Sema.h:5386
@ AA_Sending
Definition: Sema.h:5385
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
CallingConventionIgnoredReason
Describes the reason a calling convention specification was ignored, used for diagnostics.
Definition: Sema.h:3712
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
Definition: SemaExpr.cpp:7430
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
Definition: SemaExpr.cpp:4614
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition: Sema.cpp:520
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
OMPClause * ActOnOpenMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'fail' clause.
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition: Sema.h:2720
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCUDACall has emitted a (maybe deferred) "bad call" d...
Definition: Sema.h:13106
void CodeCompleteBracketDeclarator(Scope *S)
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, Scope *S, bool MergeTypeWithOld)
Completes the merge of two function declarations that are known to be compatible.
Definition: SemaDecl.cpp:4346
bool hasVisibleMergedDefinition(const NamedDecl *Def)
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition: Sema.cpp:814
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
Definition: SemaDecl.cpp:20276
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
Definition: SemaDecl.cpp:1359
ClassTemplateDecl * lookupCoroutineTraits(SourceLocation KwLoc, SourceLocation FuncLoc)
Lookup 'coroutine_traits' in std namespace and std::experimental namespace.
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaStmt.cpp:4364
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
ExprResult FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Definition: Sema.h:9596
OMPClause * ActOnOpenMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'compare' clause.
bool areMultiversionVariantFunctionsCompatible(const FunctionDecl *OldFD, const FunctionDecl *NewFD, const PartialDiagnostic &NoProtoDiagID, const PartialDiagnosticAt &NoteCausedDiagIDAt, const PartialDiagnosticAt &NoSupportDiagIDAt, const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported, bool ConstexprSupported, bool CLinkageMayDiffer)
Checks if the variant/multiversion functions are compatible.
Definition: SemaDecl.cpp:11285
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)
Perform the initialization of a potentially-movable value, which is the result of return value.
Definition: SemaStmt.cpp:3605
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD, DefaultedComparisonKind DCK)
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: Sema.h:12451
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
Definition: SemaExpr.cpp:9709
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg)
Check a template argument against its corresponding template template parameter.
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
Definition: SemaExpr.cpp:13621
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
Definition: SemaLambda.cpp:502
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
Definition: SemaExpr.cpp:11496
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition: Sema.h:7587
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
Definition: SemaExpr.cpp:20393
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
Definition: SemaType.cpp:9860
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:14578
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition: SemaAttr.cpp:436
RedeclarationKind forRedeclarationInCurContext() const
Definition: Sema.h:7701
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification,...
bool ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc, QualType Type)
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e....
Definition: SemaDecl.cpp:18282
void FilterUsingLookup(Scope *S, LookupResult &lookup)
Remove decls we can't actually see from a lookup being used to declare shadow using decls.
ExprResult ActOnSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
Definition: SemaExpr.cpp:3780
CanThrowResult canThrow(const Stmt *E)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
StmtResult ActOnOpenMPTargetParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel loop' after parsing of the associated statement.
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Definition: Sema.h:9750
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
void ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace)
Definition: SemaHLSL.cpp:30
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
PragmaClangSection PragmaClangTextSection
Definition: Sema.h:1326
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
Definition: SemaExpr.cpp:21904
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
CallExpr::ADLCallKind ADLCallKind
Definition: Sema.h:5781
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
NonTrivialCUnionKind
Definition: Sema.h:3168
@ NTCUK_Destruct
Definition: Sema.h:3170
@ NTCUK_Init
Definition: Sema.h:3169
@ NTCUK_Copy
Definition: Sema.h:3171
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
DelayedDiagnosticsState ProcessingContextState
Definition: Sema.h:1105
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
ParsedType getDestructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
void ActOnPragmaFPValueChangingOption(SourceLocation Loc, PragmaFPKind Kind, bool IsEnabled)
Called on well formed #pragma clang fp reassociate or #pragma clang fp reciprocal.
Definition: SemaAttr.cpp:1288
QualType BuildAtomicType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:10143
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
PragmaClangSection PragmaClangDataSection
Definition: Sema.h:1323
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Definition: SemaExpr.cpp:21009
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
Definition: SemaDecl.cpp:15997
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
Definition: SemaExpr.cpp:6256
SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
Definition: SemaCUDA.cpp:831
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, SmallVectorImpl< FunctionDecl * > &Bases)
The declarator D defines a function in the scope S which is nested in an omp begin/end declare varian...
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
Definition: Sema.h:7383
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=std::nullopt, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
void CheckHLSLSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param, const HLSLAnnotationAttr *AnnotationAttr)
Definition: SemaDecl.cpp:12646
OMPClause * ActOnOpenMPWhenClause(OMPTraitInfo &TI, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'when' clause.
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
Definition: SemaDecl.cpp:14015
bool anyAltivecTypes(QualType srcType, QualType destType)
Definition: SemaExpr.cpp:8337
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
TypeSourceInfo * SubstAutoTypeSourceInfoDependent(TypeSourceInfo *TypeWithAuto)
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
Definition: SemaExpr.cpp:8383
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
Definition: SemaAttr.cpp:1368
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, SourceLocation AsmLoc)
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
Definition: SemaDecl.cpp:1244
void keepInLifetimeExtendingContext()
keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext flag from previous context.
Definition: Sema.h:6560
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
Definition: SemaStmt.cpp:2514
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition: Sema.cpp:2153
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef< const Expr * > AC1, NamedDecl *D2, MutableArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
sema::FunctionScopeInfo * getCurFunctionAvailabilityContext()
Retrieve the current function, if any, that should be analyzed for potential availability violations.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
void ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname.
Definition: SemaDecl.cpp:20547
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition: Sema.h:1536
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:89
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
TypeResult ActOnTypeName(Declarator &D)
Definition: SemaType.cpp:6787
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: Sema.h:12392
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraints=true)
MaybeODRUseExprSet MaybeODRUseExprs
Definition: Sema.h:5182
void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro, SourceLocation MutableLoc)
ExternalSemaSource * getExternalSource() const
Definition: Sema.h:504
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
unsigned FunctionScopesStart
The index of the first FunctionScope that corresponds to the current context.
Definition: Sema.h:983
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:1594
NamedDecl * lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id)
Searches for the provided declaration name for OpenMP declare target directive.
SourceLocation getTopMostPointOfInstantiation(const NamedDecl *) const
Returns the top most location responsible for the definition of N.
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition: Sema.h:7050
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
Definition: SemaExpr.cpp:224
static SourceRange getPrintable(SourceRange R)
Definition: Sema.h:11684
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
CheckParmsForFunctionDef - Check that the parameters of the given function are appropriate for the de...
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI)
Handle a omp begin declare variant.
TopLevelStmtDecl * ActOnStartTopLevelStmtDecl(Scope *S)
Definition: SemaDecl.cpp:20531
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
Definition: SemaDecl.cpp:8357
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
Definition: SemaExpr.cpp:2051
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
void PushSatisfactionStackEntry(const NamedDecl *D, const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:11421
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:4315
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
Given a implicit special member, infer its CUDA target from the calls it needs to make to underlying ...
Definition: SemaCUDA.cpp:360
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc, ImplicitTypenameContext IsImplicitTypename=ImplicitTypenameContext::No)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
Definition: SemaStmt.cpp:4017
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
Definition: Sema.h:11943
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, const PartialDiagnostic &PD, const FunctionDecl *FD=nullptr)
Definition: Sema.h:879
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
Definition: SemaDecl.cpp:18423
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:16072
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Definition: Sema.cpp:2701
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
bool CheckImmediateEscalatingFunctionDefinition(FunctionDecl *FD, const sema::FunctionScopeInfo *FSI)
void emitDeferredDiags()
Definition: Sema.cpp:1807
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
void setFunctionHasMustTail()
Definition: Sema.cpp:2326
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration,...
bool WarnedStackExhausted
Definition: Sema.h:1004
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
Definition: SemaExpr.cpp:8485
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Definition: SemaDecl.cpp:2310
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition: Sema.h:6714
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
CorrectTypoKind
Definition: Sema.h:7857
@ CTK_NonError
Definition: Sema.h:7858
@ CTK_ErrorRecovery
Definition: Sema.h:7859
void CheckCompleteVariableDeclaration(VarDecl *VD)
Definition: SemaDecl.cpp:14425
bool CanPerformAggregateInitializationForOverloadResolution(const InitializedEntity &Entity, InitListExpr *From)
Determine whether we can perform aggregate initialization for the purposes of overload resolution.
Definition: SemaInit.cpp:3329
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
TUFragmentKind
Definition: Sema.h:777
@ Global
The global module fragment, between 'module;' and a module-declaration.
Definition: Sema.h:779
@ Private
The private module fragment, between 'module :private;' and the end of the translation unit.
Definition: Sema.h:786
@ Normal
A normal translation unit fragment.
Definition: Sema.h:783
bool IsOverride(FunctionDecl *MD, FunctionDecl *BaseMD, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
void PopSatisfactionStackEntry()
Definition: Sema.h:11427
void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
Definition: SemaType.cpp:2199
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL,...
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:14948
void setFunctionHasBranchProtectedScope()
Definition: Sema.cpp:2316
bool hasReachableDefinition(NamedDecl *D)
Definition: Sema.h:12002
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
Definition: SemaDecl.cpp:4552
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
Definition: SemaExpr.cpp:5531
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
Definition: SemaExpr.cpp:3897
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
bool isConstantEvaluatedContext() const
Definition: Sema.h:1996
void CUDASetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
Definition: SemaCUDA.cpp:974
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition: Sema.h:4976
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
Definition: SemaStmt.cpp:4729
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition: SemaDecl.cpp:588
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind)
bool DeclareRISCVVBuiltins
Indicate RISC-V vector builtin functions enabled or not.
Definition: Sema.h:13054
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
void keepInMaterializeTemporaryObjectContext()
keepInMaterializeTemporaryObjectContext - Pull down InMaterializeTemporaryObjectContext flag from pre...
Definition: Sema.h:6573
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
std::pair< const NamedDecl *, llvm::FoldingSetNodeID > SatisfactionStackEntryTy
Definition: Sema.h:11437
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
bool SubstDefaultArgument(SourceLocation Loc, ParmVarDecl *Param, const MultiLevelTemplateArgumentList &TemplateArgs, bool ForCallExpr=false)
Substitute the given template arguments into the default argument.
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
Definition: SemaStmt.cpp:3377
QualType BuiltinAddPointer(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:9923
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called on the start of target region i.e. '#pragma omp declare target'.
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective()
Called at the end of target region i.e. '#pragma omp end declare target'.
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition: Sema.cpp:1036
CCEKind
Contexts in which a converted constant expression is required.
Definition: Sema.h:8275
@ CCEK_StaticAssertMessageSize
Call to size() in a static assert message.
Definition: Sema.h:8282
@ CCEK_ExplicitBool
Condition in an explicit(bool) specifier.
Definition: Sema.h:8280
@ CCEK_Noexcept
Condition in a noexcept(bool) specifier.
Definition: Sema.h:8281
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
Definition: Sema.h:8279
@ CCEK_CaseValue
Expression in a case label.
Definition: Sema.h:8276
@ CCEK_TemplateArg
Value of a non-type template parameter.
Definition: Sema.h:8278
@ CCEK_StaticAssertMessageData
Call to data() in a static assert message.
Definition: Sema.h:8284
@ CCEK_Enumerator
Enumerator value with fixed underlying type.
Definition: Sema.h:8277
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
Definition: SemaStmt.cpp:2773
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
CUDAVariableTarget
Definition: Sema.h:13152
@ CVT_Both
Emitted on host side only.
Definition: Sema.h:13155
@ CVT_Device
Definition: Sema.h:13153
@ CVT_Unified
Emitted on both sides with different addresses.
Definition: Sema.h:13156
@ CVT_Host
Emitted on device side with a shadow variable on host side.
Definition: Sema.h:13154
ExprResult ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr &A, SourceRange Range)
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
Definition: SemaStmt.cpp:1737
StmtResult ActOnOpenMPDispatchDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp dispatch' after parsing of the.
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions.
Definition: SemaDecl.cpp:19030
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'to' clause.
std::pair< StringRef, QualType > CapturedParamNameType
Definition: Sema.h:8934
CUDAFunctionTarget
Definition: Sema.h:3833
@ CFT_Device
Definition: Sema.h:3834
@ CFT_HostDevice
Definition: Sema.h:3837
@ CFT_Global
Definition: Sema.h:3835
@ CFT_Host
Definition: Sema.h:3836
@ CFT_InvalidTarget
Definition: Sema.h:3838
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:1118
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
Definition: SemaDecl.cpp:3179
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
Definition: SemaDecl.cpp:1938
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared.
Definition: Sema.h:2741
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
Definition: SemaDecl.cpp:286
ExprResult SubstConstraintExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
Definition: SemaDecl.cpp:19815
OMPClause * ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be provided to the given template, converting the argumen...
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
Definition: SemaType.cpp:1112
bool isInOpenMPTargetExecutionDirective() const
Return true inside OpenMP target region.
ASTConsumer & Consumer
Definition: Sema.h:1031
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition: Sema.h:3561
const DeclContext * getCurObjCLexicalContext() const
Definition: Sema.h:5984
void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
Definition: SemaCUDA.cpp:1028
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
OverloadKind
Definition: Sema.h:8177
@ Ovl_NonFunction
This is not an overload because the lookup results contain a non-function.
Definition: Sema.h:8188
@ Ovl_Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition: Sema.h:8180
@ Ovl_Match
This is not an overload because the signature exactly matches an existing declaration.
Definition: Sema.h:8184
PragmaAlignPackDiagnoseKind
Definition: Sema.h:1688
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'task_reduction' clause.
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition: Sema.h:5375
void CodeCompleteObjCMethodDecl(Scope *S, std::optional< bool > IsInstanceMethod, ParsedType ReturnType)
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition: SemaExpr.cpp:117
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
Definition: SemaDecl.cpp:2095
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition: Sema.h:1069
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
Definition: Sema.cpp:1617
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
Definition: Sema.h:10751
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:5898
bool CheckImplicitNullabilityTypeSpecifier(QualType &Type, NullabilityKind Nullability, SourceLocation DiagLoc, bool AllowArrayTypes, bool OverrideExisting)
Check whether a nullability type specifier can be added to the given type through some means not writ...
Definition: SemaType.cpp:7724
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
ModuleImportState
An enumeration to represent the transition of states in parsing module fragments and imports.
Definition: Sema.h:8020
@ PrivateFragmentImportFinished
after 'module :private;' but a non-import decl has already been seen.
@ ImportFinished
after any non-import decl.
@ PrivateFragmentImportAllowed
after 'module :private;' but before any non-import decl.
@ FirstDecl
Parsing the first decl in a TU.
@ GlobalFragment
after 'module;' but before 'module X;'
@ NotACXX20Module
Not a C++20 TU, or an invalid state was found.
@ ImportAllowed
after 'module X;' but before any non-import decl.
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
StmtResult ActOnOpenMPTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams loop' after parsing of the associated statement.
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
static QualType getPrintable(QualType T)
Definition: Sema.h:11683
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
Definition: SemaExpr.cpp:3795
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
QualType GetSignedVectorType(QualType V)
Definition: SemaExpr.cpp:13562
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition: Sema.cpp:62
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
Definition: SemaStmt.cpp:4759
OMPClause * ActOnOpenMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'atomic_default_mem_order' clause.
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void incrementMSManglingNumber() const
Definition: Sema.h:1006
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void AddNonMemberOperatorCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
Add all of the non-member operator function declarations in the given function set to the overload ca...
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
Definition: SemaExpr.cpp:9191
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
Definition: SemaDecl.cpp:16656
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool inferObjCARCLifetime(ValueDecl *decl)
Definition: SemaDecl.cpp:6964
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
Definition: Sema.h:5126
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void ActOnOpenMPDeclareTargetInitializer(Decl *D)
Adds OMPDeclareTargetDeclAttr to referenced variables in declare target directive.
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
Definition: Sema.h:13185
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
Definition: SemaCast.cpp:2034
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
Definition: SemaType.cpp:9828
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced.
Definition: Sema.h:10521
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10087
AvailabilityPriority
Describes the kind of priority given to an availability attribute.
Definition: Sema.h:3697
@ AP_PragmaClangAttribute
The availability attribute was applied using '#pragma clang attribute'.
Definition: Sema.h:3703
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
Definition: Sema.h:3707
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
Definition: Sema.h:3700
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
Definition: Sema.h:3483
@ AMK_None
Don't merge availability attributes at all.
Definition: Sema.h:3485
@ AMK_Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition: Sema.h:3491
@ AMK_ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
Definition: Sema.h:3494
@ AMK_OptionalProtocolImplementation
Merge availability attributes for an implementation of an optional protocol requirement.
Definition: Sema.h:3497
@ AMK_Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
Definition: Sema.h:3488
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:15069
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
Definition: SemaExpr.cpp:7422
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: SemaStmt.cpp:4709
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
Definition: SemaExpr.cpp:4840
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Definition: SemaType.cpp:6102
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
Definition: SemaDecl.cpp:14734
ExprResult BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc)
std::pair< SourceLocation, bool > DeleteExprLoc
Definition: Sema.h:733
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
Definition: SemaExpr.cpp:21015
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
Definition: SemaExpr.cpp:4451
DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, OffsetOfKind OOK, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
Definition: SemaDecl.cpp:17286
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, const ParsedAttributesView &DeclAttrs, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e....
Definition: SemaDecl.cpp:4871
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
void CodeCompletePreprocessorMacroName(bool IsDefinition)
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition: Sema.cpp:2166
void DiagnoseHLSLAttrStageMismatch(const Attr *A, HLSLShaderAttr::ShaderType Stage, std::initializer_list< HLSLShaderAttr::ShaderType > AllowedStages)
Definition: SemaDecl.cpp:12666
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
Definition: SemaExpr.cpp:17301
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
void ActOnAfterCompoundStatementLeadingPragmas()
Definition: SemaStmt.cpp:395
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
Definition: SemaType.cpp:6215
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition: SemaStmt.cpp:75
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition: Sema.h:3724
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Definition: SemaType.cpp:9249
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
Definition: SemaDecl.cpp:15444
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition: Sema.h:1002
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
Definition: SemaDecl.cpp:1352
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Definition: SemaInternal.h:24
void DiagnoseUnterminatedPragmaAttribute()
Definition: SemaAttr.cpp:1133
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
Definition: SemaAttr.cpp:1239
bool SatisfactionStackContains(const NamedDecl *D, const llvm::FoldingSetNodeID &ID) const
Definition: Sema.h:11429
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
Definition: SemaExpr.cpp:21659
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
LateTemplateParserCB * LateTemplateParser
Definition: Sema.h:1075
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
StmtResult ActOnOpenMPTargetTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams loop' after parsing of the associated statement.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
Definition: SemaDecl.cpp:19273
void CheckExplicitObjectLambda(Declarator &D)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
QualType getCapturedDeclRefType(ValueDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
Definition: SemaExpr.cpp:20026
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
Definition: SemaExpr.cpp:8520
void ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD)
Only called on function definitions; if there is a MSVC #pragma optimize in scope,...
Definition: SemaAttr.cpp:1188
bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
Definition: SemaCUDA.cpp:497
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:1377
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Delete-expressions to be analyzed at the end of translation unit.
Definition: Sema.h:6725
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
Definition: SemaDecl.cpp:11148
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition: Sema.h:2760
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
void CodeCompleteObjCPropertyGetter(Scope *S)
bool DeferDiags
Whether deferrable diagnostics should be deferred.
Definition: Sema.h:8156
void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init)
Check that the lifetime of the initializer (and its subobjects) is sufficient for initializing the en...
Definition: SemaInit.cpp:8123
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement.
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaType.cpp:4254
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
Definition: Sema.h:6495
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()
Definition: Sema.cpp:76
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: Sema.h:12245
@ RTC_Incompatible
Definition: Sema.h:12247
@ RTC_Compatible
Definition: Sema.h:12246
@ RTC_Unknown
Definition: Sema.h:12248
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
Definition: Sema.cpp:2721
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
Definition: SemaExpr.cpp:18709
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:9968
bool NeedToCaptureVariable(ValueDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
Definition: SemaExpr.cpp:20018
StmtResult ActOnOpenMPErrorDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, bool InExContext=true)
Called on well-formed '#pragma omp error'.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition: Sema.h:6669
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1324
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
Definition: SemaExpr.cpp:8432
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
void makeModuleVisible(Module *Mod, SourceLocation ImportLoc)
Definition: Sema.h:8006
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary – that is,...
Definition: SemaType.cpp:9190
StmtResult ActOnAttributedStmt(const ParsedAttributes &AttrList, Stmt *SubStmt)
Definition: SemaStmt.cpp:620
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
QualType BuiltinChangeCVRQualifiers(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:9994
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
SourceManager & SourceMgr
Definition: Sema.h:1033
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateNameIsRequiredTag
Definition: Sema.h:9101
@ TemplateNameIsRequired
Definition: Sema.h:9101
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition: Sema.h:13745
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness,...
bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo, SourceLocation OpLoc, SourceRange R)
Definition: SemaExpr.cpp:4931
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
Definition: SemaExpr.cpp:8593
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure.
Definition: SemaDecl.cpp:5839
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, CXXScopeSpec &SS, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition: SemaAttr.cpp:322
static bool CanBeGetReturnTypeOnAllocFailure(const FunctionDecl *FD)
Definition: SemaDecl.cpp:16054
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
LazyVector< CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition: Sema.h:4969
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
bool DiagnoseDependentMemberLookup(const LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
Definition: SemaExpr.cpp:2407
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition: Sema.h:7684
DiagnosticsEngine & Diags
Definition: Sema.h:1032
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
CXXMethodDecl * CreateLambdaCallOperator(SourceRange IntroducerRange, CXXRecordDecl *Class)
Definition: SemaLambda.cpp:930
void DiagnoseUnterminatedPragmaAlignPack()
Definition: SemaAttr.cpp:475
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
Definition: SemaStmt.cpp:3404
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition: Sema.h:6066
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:495
FPOptions CurFPFeatures
Definition: Sema.h:1026
void ActOnStartSEHFinallyBlock()
Definition: SemaStmt.cpp:4721
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
static bool CanBeGetReturnObject(const FunctionDecl *FD)
Definition: SemaDecl.cpp:16050
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
NamespaceDecl * getStdNamespace() const
QualType BuiltinRemovePointer(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:9932
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition: Sema.h:4960
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
void DeclareImplicitEqualityComparison(CXXRecordDecl *RD, FunctionDecl *Spaceship)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
Definition: SemaDecl.cpp:15328
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
Definition: SemaDecl.cpp:6763
void CodeCompleteAfterFunctionEquals(Declarator &D)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
Definition: SemaType.cpp:2494
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition: SemaExpr.cpp:521
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:1546
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
Definition: SemaLambda.cpp:648
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition: Sema.h:1076
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
Definition: SemaExpr.cpp:8367
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
@ TUK_Definition
Definition: Sema.h:3321
@ TUK_Declaration
Definition: Sema.h:3320
@ TUK_Friend
Definition: Sema.h:3322
@ TUK_Reference
Definition: Sema.h:3319
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
Definition: SemaInit.cpp:10642
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
Definition: SemaDecl.cpp:7381
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
Definition: SemaDecl.cpp:15102
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition: Sema.h:9252
@ TPC_ClassTemplate
Definition: Sema.h:9253
@ TPC_FriendFunctionTemplate
Definition: Sema.h:9258
@ TPC_ClassTemplateMember
Definition: Sema.h:9256
@ TPC_FunctionTemplate
Definition: Sema.h:9255
@ TPC_FriendClassTemplate
Definition: Sema.h:9257
@ TPC_FriendFunctionTemplateDefinition
Definition: Sema.h:9259
@ TPC_TypeAliasTemplate
Definition: Sema.h:9260
@ TPC_VarTemplate
Definition: Sema.h:9254
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
Definition: SemaAttr.cpp:1253
void ActOnAbortSEHFinallyBlock()
Definition: SemaStmt.cpp:4725
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name,...
Definition: SemaDecl.cpp:6850
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
Definition: SemaDecl.cpp:16503
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2165
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition: Sema.h:10873
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Definition: SemaExpr.cpp:6331
Decl * ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
void CodeCompleteObjCAtStatement(Scope *S)
bool checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal, Decl *D, bool &HasDefault, bool &HasCommas, bool &HasNotDefault, SmallVectorImpl< SmallString< 64 > > &StringsBuffer)
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition,...
Definition: SemaExpr.cpp:21058
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: Sema.h:12092
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition: Sema.h:1622
bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
Definition: SemaCUDA.cpp:535
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
void DiagnoseUnusedDecl(const NamedDecl *ND)
Definition: SemaDecl.cpp:2113
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
friend class ArgumentPackSubstitutionRAII
Definition: Sema.h:10558
bool hasAcceptableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
Determine if the template parameter D has a reachable default argument.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
Definition: SemaType.cpp:2347
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
void PopDeclContext()
Definition: SemaDecl.cpp:1331
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
void CodeCompleteObjCInterfaceDecl(Scope *S)
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
bool CheckIfFunctionSpecializationIsImmediate(FunctionDecl *FD, SourceLocation Loc)
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
Definition: SemaType.cpp:3333
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13967
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition: Sema.h:4988
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
Definition: Sema.h:10488
bool ActOnStartOpenACCDeclDirective(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
void PrintStats() const
Print out statistics about the semantic analysis.
Definition: Sema.cpp:565
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16650
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
ExprResult ConvertParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
static unsigned getPrintable(unsigned I)
Definition: Sema.h:11674
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
Definition: SemaExpr.cpp:992
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
Definition: SemaExpr.cpp:6803
FormatStringType
Definition: Sema.h:2027
@ FST_NSString
Definition: Sema.h:2030
@ FST_Unknown
Definition: Sema.h:2037
@ FST_Strftime
Definition: Sema.h:2031
@ FST_Printf
Definition: Sema.h:2029
@ FST_FreeBSDKPrintf
Definition: Sema.h:2034
@ FST_Scanf
Definition: Sema.h:2028
@ FST_Strfmon
Definition: Sema.h:2032
@ FST_OSLog
Definition: Sema.h:2036
@ FST_Kprintf
Definition: Sema.h:2033
@ FST_OSTrace
Definition: Sema.h:2035
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition: Sema.h:1297
QualType SubstAutoTypeDependent(QualType TypeWithAuto)
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
Definition: SemaDecl.cpp:1597
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W)
DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak applied to it,...
QualType CheckSizelessVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13682
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
llvm::BumpPtrAllocator BumpAlloc
Definition: Sema.h:988
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
Definition: SemaType.cpp:1057
ExprResult ConvertMemberDefaultInitExpression(FieldDecl *FD, Expr *InitExpr, SourceLocation InitLoc)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
Definition: SemaType.cpp:2359
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddSurrogateCandidate - Adds a "surrogate" candidate function that converts the given Object to a fun...
StmtResult ActOnOpenMPTileDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp tile' after parsing of its clauses and the associated statement.
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
BuildForRangeKind
Definition: Sema.h:8824
@ BFRK_Check
Determining whether a for-range statement could be built.
Definition: Sema.h:8832
@ BFRK_Build
Initial building of a for-range statement.
Definition: Sema.h:8826
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
Definition: Sema.h:8829
bool IsInvalidSMECallConversion(QualType FromType, QualType ToType)
Definition: SemaExpr.cpp:9813
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
StmtResult ActOnOpenMPScopeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scope' after parsing of the associated statement.
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition: Sema.h:12815
StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock)
ActOnCXXCatchBlock - Takes an exception declaration and a handler block and creates a proper catch ha...
Definition: SemaStmt.cpp:4430
StmtResult ActOnOpenMPParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel loop' after parsing of the associated statement.
void ActOnPragmaMSStrictGuardStackCheck(SourceLocation PragmaLocation, PragmaMsStackAction Action, bool Value)
ActOnPragmaMSStrictGuardStackCheck - Called on well formed #pragma strict_gs_check.
Definition: SemaAttr.cpp:762
void ActOnUninitializedDecl(Decl *dcl)
Definition: SemaDecl.cpp:14057
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
Definition: SemaDecl.cpp:13227
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
Definition: SemaDecl.cpp:1580
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
Definition: SemaDecl.cpp:16928
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc)
Definition: SemaType.cpp:9842
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
Definition: Sema.cpp:2358
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition: SemaStmt.cpp:544
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
Definition: SemaExpr.cpp:17112
OffsetOfKind
Definition: Sema.h:3325
@ OOK_Outside
Definition: Sema.h:3327
@ OOK_Macro
Definition: Sema.h:3332
@ OOK_Builtin
Definition: Sema.h:3329
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
Definition: SemaDecl.cpp:13503
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
Definition: SemaType.cpp:9742
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
PragmaSectionKind
Definition: Sema.h:1566
@ PSK_ConstSeg
Definition: Sema.h:1569
@ PSK_DataSeg
Definition: Sema.h:1567
@ PSK_CodeSeg
Definition: Sema.h:1570
@ PSK_BSSSeg
Definition: Sema.h:1568
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[] { return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement.
void CheckConceptRedefinition(ConceptDecl *NewDecl, LookupResult &Previous, bool &AddToScope)
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
HLSLShaderAttr * mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL, HLSLShaderAttr::ShaderType ShaderType)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Definition: Sema.cpp:511
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
Definition: SemaExpr.cpp:20785
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition: Sema.cpp:550
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition: SemaCast.cpp:301
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
Definition: SemaExpr.cpp:17663
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition: Sema.h:4800
void ActOnOpenMPAssumesDirective(SourceLocation Loc, OpenMPDirectiveKind DKind, ArrayRef< std::string > Assumptions, bool SkippedClauses)
Called on well-formed '#pragma omp [begin] assume[s]'.
Decl * ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth)
ActOnField - Each field of a C struct/union is passed into this in order to create a FieldDecl object...
Definition: SemaDecl.cpp:18536
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
Definition: SemaExpr.cpp:18892
CodeAlignAttr * BuildCodeAlignAttr(const AttributeCommonInfo &CI, Expr *E)
ExprResult ActOnStmtExprResult(ExprResult E)
Definition: SemaExpr.cpp:16694
void EndOpenMPClause()
End analysis of clauses.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
Definition: Sema.cpp:93
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
Definition: SemaExpr.cpp:4991
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
Definition: SemaDecl.cpp:4382
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
void ActOnCXXForRangeDecl(Decl *D)
Definition: SemaDecl.cpp:14342
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant,...
bool isOpenMPRebuildMemberExpr(ValueDecl *D)
The member expression(this->fd) needs to be rebuilt in the template instantiation to generate private...
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
Definition: SemaExpr.cpp:6681
StmtResult ActOnOpenMPGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp loop' after parsing of the associated statement.
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
Definition: SemaLambda.cpp:278
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
Definition: SemaExpr.cpp:17589
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
Definition: SemaType.cpp:2896
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
Definition: SemaExpr.cpp:21116
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition: Sema.h:2735
static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D)
Definition: SemaCUDA.cpp:302
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD=nullptr)
Definition: Sema.cpp:1894
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
Definition: SemaExpr.cpp:21957
void CompleteLambdaCallOperator(CXXMethodDecl *Method, SourceLocation LambdaLoc, SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause, TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind, StorageClass SC, ArrayRef< ParmVarDecl * > Params, bool HasExplicitResultType)
Definition: SemaLambda.cpp:966
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
Definition: SemaType.cpp:9278
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:16135
PragmaClangSection PragmaClangBSSSection
Definition: Sema.h:1322
Decl * ActOnDeclarator(Scope *S, Declarator &D)
Definition: SemaDecl.cpp:6151
bool PopForceCUDAHostDevice()
Decrements our count of the number of times we've seen a pragma forcing functions to be host device.
Definition: SemaCUDA.cpp:42
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3925
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition: Sema.h:1092
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaStmt.cpp:4304
AbstractDiagSelID
Definition: Sema.h:4755
@ AbstractSynthesizedIvarType
Definition: Sema.h:4762
@ AbstractVariableType
Definition: Sema.h:4759
@ AbstractReturnType
Definition: Sema.h:4757
@ AbstractNone
Definition: Sema.h:4756
@ AbstractFieldType
Definition: Sema.h:4760
@ AbstractArrayType
Definition: Sema.h:4763
@ AbstractParamType
Definition: Sema.h:4758
@ AbstractIvarType
Definition: Sema.h:4761
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Definition: SemaExpr.cpp:3203
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:905
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:7980
void CodeCompletePreprocessorDirective(bool InConditional)
PragmaOptionsAlignKind
Definition: Sema.h:1658
@ POAK_Power
Definition: Sema.h:1662
@ POAK_Reset
Definition: Sema.h:1664
@ POAK_Packed
Definition: Sema.h:1661
@ POAK_Mac68k
Definition: Sema.h:1663
@ POAK_Natural
Definition: Sema.h:1660
@ POAK_Native
Definition: Sema.h:1659
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
Definition: SemaExpr.cpp:16950
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
void CheckAlignasUnderalignment(Decl *D)
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
Definition: SemaExpr.cpp:5064
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old)
Definition: SemaDecl.cpp:1720
OMPClause * ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'reverse_offload' clause.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition: Sema.h:6711
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
Definition: SemaDecl.cpp:1253
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
bool SubstTemplateArgument(const TemplateArgumentLoc &Input, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentLoc &Output)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
Definition: SemaExpr.cpp:15604
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
Definition: SemaModule.cpp:976
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
Definition: SemaLambda.cpp:498
ObjCSubscriptKind
Definition: Sema.h:8708
@ OS_Array
Definition: Sema.h:8708
@ OS_Dictionary
Definition: Sema.h:8708
@ OS_Error
Definition: Sema.h:8708
QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10061
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
Definition: SemaExpr.cpp:10088
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
Definition: SemaAttr.cpp:1268
void adjustMemberFunctionCC(QualType &T, bool HasThisPointer, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
Definition: SemaType.cpp:8337
SwiftNameAttr * mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:1139
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
Definition: SemaExpr.cpp:7162
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
Definition: SemaExpr.cpp:4914
QualType PreferredConditionType(ConditionKind K) const
Definition: Sema.h:6228
CUDALaunchBoundsAttr * CreateLaunchBoundsAttr(const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
Create an CUDALaunchBoundsAttr attribute.
ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, SourceLocation RangeLoc, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
Build a call to 'begin' or 'end' for a C++11 for-range statement.
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition: Sema.h:12538
@ ObjCSuperMessage
The message is sent to 'super'.
Definition: Sema.h:12540
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition: Sema.h:12545
@ ObjCInstanceMessage
The message is an instance message.
Definition: Sema.h:12542
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition: Sema.h:7656
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
Definition: Sema.h:7660
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition: Sema.h:7666
@ LOLR_Error
The lookup resulted in an error.
Definition: Sema.h:7658
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition: Sema.h:7663
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition: Sema.h:7674
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition: Sema.h:7670
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
Definition: SemaDecl.cpp:20586
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition: Sema.cpp:2346
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Definition: Sema.h:13115
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
Definition: SemaExpr.cpp:16979
StmtResult ActOnOpenMPMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop' after parsing of the associated statement.
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
void CodeCompletePreprocessorExpression()
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:11535
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
CheckConstexprKind
Definition: Sema.h:4898
@ CheckValid
Identify whether this function satisfies the formal rules for constexpr functions in the current lanu...
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
ExprResult InitializeExplicitObjectArgument(Sema &S, Expr *Obj, FunctionDecl *Fun)
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition: Sema.h:10747
void CheckVariableDeclarationType(VarDecl *NewVD)
Definition: SemaDecl.cpp:8687
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition: SemaStmt.cpp:407
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition: Sema.cpp:2713
OpaquePtr< TemplateName > TemplateTy
Definition: Sema.h:1022
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
Definition: Sema.cpp:503
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
Definition: SemaDecl.cpp:18916
CXXSpecialMember
Kinds of C++ special members.
Definition: Sema.h:4270
@ CXXCopyConstructor
Definition: Sema.h:4272
@ CXXMoveConstructor
Definition: Sema.h:4273
@ CXXDestructor
Definition: Sema.h:4276
@ CXXDefaultConstructor
Definition: Sema.h:4271
@ CXXInvalid
Definition: Sema.h:4277
@ CXXMoveAssignment
Definition: Sema.h:4275
@ CXXCopyAssignment
Definition: Sema.h:4274
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
Definition: SemaInit.cpp:10627
std::optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, unsigned NumAppendArgs, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
Definition: SemaDecl.cpp:1338
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition: Sema.cpp:588
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:13193
std::string getCudaConfigureFuncName() const
Returns the name of the launch configuration function.
Definition: SemaCUDA.cpp:1036
TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)
Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
Definition: SemaAttr.cpp:1339
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition: SemaSYCL.cpp:21
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Definition: SemaType.cpp:3213
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: Sema.h:12460
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition: Sema.h:2716
void ActOnFinishOfCompoundStmt()
Definition: SemaStmt.cpp:403
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
StmtResult ActOnOpenACCAssociatedStmt(OpenACCDirectiveKind K, StmtResult AssocStmt)
Called when we encounter an associated statement for our construct, this should check legality of the...
Definition: SemaOpenACC.cpp:95
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
Definition: SemaExpr.cpp:21923
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
Definition: SemaAttr.cpp:1172
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
Definition: SemaDecl.cpp:15934
ObjCSpecialMethodKind
Definition: Sema.h:12040
@ OSMK_Copy
Definition: Sema.h:12044
@ OSMK_NonRetainingInit
Definition: Sema.h:12046
@ OSMK_RetainingInit
Definition: Sema.h:12045
@ OSMK_None
Definition: Sema.h:12041
@ OSMK_Alloc
Definition: Sema.h:12042
@ OSMK_New
Definition: Sema.h:12043
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11889
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
Definition: SemaDecl.cpp:13479
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:11968
static ConditionResult ConditionError()
Definition: Sema.h:6103
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition: SemaStmt.cpp:411
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
void NoteTemplateParameterLocation(const NamedDecl &Decl)
HLSLParamModifierAttr * mergeHLSLParamModifierAttr(Decl *D, const AttributeCommonInfo &AL, HLSLParamModifierAttr::Spelling Spelling)
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
Definition: SemaExpr.cpp:7449
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={}, OverloadCandidateParamOrder PO={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
void ActOnStartTrailingRequiresClause(Scope *S, Declarator &D)
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop' after parsing of the associated statemen...
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
Definition: SemaExpr.cpp:5606
AttributeCompletion
Definition: Sema.h:12887
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
IdentifierResolver IdResolver
Definition: Sema.h:2664
DeclResult ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition: Sema.h:10484
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
Definition: SemaExpr.cpp:21663
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaStmt.cpp:4420
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement.
bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, bool AllowMask) const
IsValueInFlagEnum - Determine if a value is allowed as part of a flag enum.
Definition: SemaDecl.cpp:20247
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
Definition: SemaExpr.cpp:6543
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
Definition: SemaExpr.cpp:16892
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition: Sema.cpp:2307
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition: SemaStmt.cpp:569
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
Definition: Sema.h:9066
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
Definition: SemaStmt.cpp:4558
FullExprArg MakeFullExpr(Expr *Arg)
Definition: Sema.h:6059
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition: SemaDecl.cpp:696
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
Definition: SemaDecl.cpp:15302
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
Definition: Sema.h:6677
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: Sema.h:1021
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: Sema.h:12427
static int getPrintable(int I)
Definition: Sema.h:11673
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:773
bool hasReachableDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is reachable.
Definition: Sema.h:7815
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition: Sema.h:9969
OMPRequiresDecl * CheckOMPRequiresDecl(SourceLocation Loc, ArrayRef< OMPClause * > Clauses)
Check restrictions on Requires directive.
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition: SemaStmt.cpp:549
ObjCContainerKind getObjCContainerKind() const
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition: Sema.h:3015
bool CheckAltivecInitFromScalar(SourceRange R, QualType VecTy, QualType SrcTy)
Definition: SemaCast.cpp:2695
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
void checkCUDATargetOverload(FunctionDecl *NewFD, const LookupResult &Previous)
Check whether NewFD is a valid overload for CUDA.
Definition: SemaCUDA.cpp:982
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
Definition: SemaExpr.cpp:18717
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
static const std::string & getPrintable(const std::string &S)
Definition: Sema.h:11678
PragmaClangSectionKind
pragma clang section kind
Definition: Sema.h:1305
@ PCSK_Invalid
Definition: Sema.h:1306
@ PCSK_BSS
Definition: Sema.h:1307
@ PCSK_Data
Definition: Sema.h:1308
@ PCSK_Text
Definition: Sema.h:1310
@ PCSK_Relro
Definition: Sema.h:1311
@ PCSK_Rodata
Definition: Sema.h:1309
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:7912
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
bool ActOnStartOpenACCStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
Definition: SemaOpenACC.cpp:71
void warnOnReservedIdentifier(const NamedDecl *D)
Definition: SemaDecl.cpp:6138
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
Definition: SemaStmt.cpp:512
bool isCheckingDefaultArgumentOrInitializer() const
Definition: Sema.h:6519
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
Definition: SemaDecl.cpp:17004
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaDecl.cpp:18417
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined.
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=std::nullopt)
Definition: SemaDecl.cpp:7549
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.
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
StmtResult ActOnOpenMPTargetDataDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target data' after parsing of the associated statement.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
static const char * getPrintable(const char *S)
Definition: Sema.h:11676
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, const FunctionProtoType *Proto)
CheckFunctionCall - Check a direct function call for various correctness and safety properties not st...
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'from' clause.
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, OverloadCandidateParamOrder PO={})
Add overload candidates for overloaded operators that are member functions.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
Definition: SemaType.cpp:3133
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
AllocationFunctionScope
The scope in which to find allocation functions.
Definition: Sema.h:6889
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
Definition: Sema.h:6897
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
Definition: Sema.h:6894
@ AFS_Global
Only look for allocation functions in the global scope.
Definition: Sema.h:6891
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
bool isAbstractType(SourceLocation Loc, QualType T)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr, bool SkipImmediateInvocations=true)
Instantiate or parse a C++ default argument expression as necessary.
Definition: SemaExpr.cpp:6126
ValueDecl * tryLookupUnambiguousFieldDecl(RecordDecl *ClassDecl, const IdentifierInfo *MemberOrBase)
ASTMutationListener * getASTMutationListener() const
Definition: Sema.cpp:541
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Definition: SemaType.cpp:3196
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
PragmaMsStackAction
Definition: Sema.h:1328
@ PSK_Push_Set
Definition: Sema.h:1334
@ PSK_Reset
Definition: Sema.h:1329
@ PSK_Pop_Set
Definition: Sema.h:1335
@ PSK_Show
Definition: Sema.h:1333
@ PSK_Pop
Definition: Sema.h:1332
@ PSK_Set
Definition: Sema.h:1330
@ PSK_Push
Definition: Sema.h:1331
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
Definition: SemaStmt.cpp:3304
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called once a target context is completed, that can be when a '#pragma omp end declare target' was en...
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
void DiagnoseImmediateEscalatingReason(FunctionDecl *FD)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Definition: Sema.h:6967
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals, bool EvaluateConstraints=true)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
Definition: SemaExpr.cpp:5231
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
Definition: SemaDecl.cpp:1280
OMPClause * ActOnOpenMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'relaxed' clause.
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
Definition: SemaModule.cpp:819
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
unsigned getHashValue() const
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition: Overload.h:264
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:326
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1773
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3549
Exposes information about the current target.
Definition: TargetInfo.h:213
A convenient class for passing around template argument information.
Definition: TemplateBase.h:632
A template argument list.
Definition: DeclTemplate.h:244
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
Represents a template argument.
Definition: TemplateBase.h:61
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
Represents a C++ template name within the type system.
Definition: TemplateName.h:202
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:73
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Token - This structure provides full information about a lexed token.
Definition: Token.h:36
A declaration that models statements at global scope.
Definition: Decl.h:4422
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition: ASTConcept.h:231
Represents a declaration of a type.
Definition: Decl.h:3357
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:59
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:153
A container of type source information.
Definition: Type.h:6873
The base class of the type hierarchy.
Definition: Type.h:1606
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
Definition: Type.cpp:2403
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3501
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3399
Simple class containing the result of Sema::CorrectTypo.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6579
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:1024
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3163
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3905
A set of unresolved declarations.
Definition: UnresolvedSet.h:61
Represents a C++ using-declaration.
Definition: DeclCXX.h:3505
Represents C++ using-directive.
Definition: DeclCXX.h:3008
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3313
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:706
Represents a variable declaration or definition.
Definition: Decl.h:918
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a GCC generic vector type.
Definition: Type.h:3512
Represents a C++11 virt-specifier-seq.
Definition: DeclSpec.h:2779
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition: Lookup.h:831
Captures information about a #pragma weak directive.
Definition: Weak.h:25
The API notes manager helps find API notes associated with declarations.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
Definition: ExprConcepts.h:280
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
Definition: ExprConcepts.h:429
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:168
A requires-expression requirement which queries the existence of a type name or type template special...
Definition: ExprConcepts.h:225
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:784
Retains information about a captured region.
Definition: ScopeInfo.h:810
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:67
A collection of diagnostics which were delayed.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:104
Provides information about an attempted template argument deduction, whose success or failure was des...
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
void threadSafetyCleanup(BeforeSet *Cache)
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition: TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition: TokenKinds.h:25
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
Definition: OpenACCKinds.h:158
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Device
'device' clause, allowed on the 'update' construct.
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:55
ImplicitTypenameContext
Definition: DeclSpec.h:1882
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
PragmaFPKind
Definition: PragmaKinds.h:38
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:42
@ CPlusPlus
Definition: LangStandard.h:54
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:842
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:24
CanThrowResult
Possible results from evaluation of a noexcept expression.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:118
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
Definition: OpenMPKinds.h:171
PragmaMSCommentKind
Definition: PragmaKinds.h:14
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition: Specifiers.h:35
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
Definition: Specifiers.h:39
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
Definition: ModuleLoader.h:32
ObjCPropertyQueryKind
Definition: DeclObjC.h:717
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:332
InClassInitStyle
In-class initialization styles for non-static data members.
Definition: Specifiers.h:268
CXXConstructionKind
Definition: ExprCXX.h:1522
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:146
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
Definition: OpenMPKinds.h:135
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
Definition: OpenMPKinds.h:186
BinaryOperatorKind
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition: Overload.h:84
std::unique_ptr< sema::RISCVIntrinsicManager > CreateRISCVIntrinsicManager(Sema &S)
TypeOfKind
The kind of 'typeof' expression we're after.
Definition: Type.h:718
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
Definition: CallGraph.h:207
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:38
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:27
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:16
StorageClass
Storage classes.
Definition: Specifiers.h:245
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Definition: OpenMPKinds.h:103
TypeResult TypeError()
Definition: Ownership.h:266
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
Definition: OpenMPKinds.h:219
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:51
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition: Overload.h:89
LambdaCaptureInitKind
Definition: DeclSpec.h:2823
@ CopyInit
[a = b], [a = {b}]
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
ActionResult< CXXCtorInitializer * > MemInitResult
Definition: Ownership.h:252
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
Definition: OpenMPKinds.h:200
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:3144
ParameterABI
Kinds of parameter ABI.
Definition: Specifiers.h:362
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
Definition: OpenMPKinds.h:157
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:54
OpenMPGrainsizeClauseModifier
Definition: OpenMPKinds.h:206
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition: LangOptions.h:35
OpenMPNumTasksClauseModifier
Definition: OpenMPKinds.h:212
UnaryOperatorKind
ActionResult< Expr * > ExprResult
Definition: Ownership.h:248
TagTypeKind
The kind of a tag type.
Definition: Type.h:5842
OpenACCDirectiveKind
Definition: OpenACCKinds.h:25
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
Definition: DeclTemplate.h:65
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
Definition: OpenMPKinds.h:142
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
CastKind
CastKind - The kind of operation required for a conversion.
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:982
@ TU_Complete
The translation unit is a complete translation unit.
Definition: LangOptions.h:984
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
Definition: LangOptions.h:988
ComparisonCategoryType
An enumeration representing the different comparison categories types.
PragmaMSStructKind
Definition: PragmaKinds.h:23
ActionResult< Stmt * > StmtResult
Definition: Ownership.h:249
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:110
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:62
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
Definition: TemplateKinds.h:20
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
Definition: TemplateKinds.h:33
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
Definition: TemplateKinds.h:30
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
Definition: TemplateKinds.h:26
@ TNK_Concept_template
The name refers to a concept.
Definition: TemplateKinds.h:52
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
Definition: TemplateKinds.h:50
ActionResult< ParsedType > TypeResult
Definition: Ownership.h:250
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:22
PragmaFloatControlKind
Definition: PragmaKinds.h:28
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:129
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:132
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:62
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition: Specifiers.h:388
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:298
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
Definition: OpenMPKinds.h:127
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:246
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
TemplateDeductionResult
Describes the result of template argument deduction.
Definition: Sema.h:367
@ MiscellaneousDeductionFailure
Deduction failed; that's all we know.
@ NonDependentConversionFailure
Checking non-dependent argument conversions failed.
@ ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
@ Underqualified
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
@ InstantiationDepth
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
@ InvalidExplicitArguments
The explicitly-specified template arguments were not valid template arguments for the given template.
@ CUDATargetMismatch
CUDA Target attributes do not match.
@ TooFewArguments
When performing template argument deduction for a function template, there were too few call argument...
@ Incomplete
Template argument deduction did not deduce a value for every template parameter.
@ Success
Template argument deduction was successful.
@ SubstitutionFailure
Substitution of the deduced template argument values resulted in an error.
@ IncompletePack
Template argument deduction did not deduce a value for every expansion of an expanded template parame...
@ DeducedMismatch
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
@ Inconsistent
Template argument deduction produced inconsistent deduced values for the given template parameter.
@ TooManyArguments
When performing template argument deduction for a function template, there were too many call argumen...
@ AlreadyDiagnosed
Some error which was already diagnosed.
@ DeducedMismatchNested
After substituting deduced template arguments, an element of a dependent parameter type did not match...
@ NonDeducedMismatch
A non-depnedent component of the parameter did not match the corresponding component of the argument.
ActionResult< Decl * > DeclResult
Definition: Ownership.h:254
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:185
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:275
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition: DeclObjC.h:553
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition: OpenMPKinds.h:47
SourceLocIdentKind
Definition: Expr.h:4708
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:5817
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
Definition: OpenMPKinds.h:164
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
@ Parens
New-expression has a C++98 paren-delimited initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DynamicNone
throw()
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Dynamic
throw(T1, T2)
PredefinedIdentKind
Definition: Expr.h:1970
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:30
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:120
@ AS_none
Definition: Specifiers.h:124
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:70
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition: Specifiers.h:170
YAML serialization mapping.
Definition: Dominators.h:30
Definition: Format.h:5304
#define true
Definition: stdbool.h:21
#define false
Definition: stdbool.h:22
#define bool
Definition: stdbool.h:20
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:93
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1329
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2769
Describes whether we've seen any nullability information for the given file.
Definition: Sema.h:250
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
Definition: Sema.h:257
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition: Sema.h:253
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition: Sema.h:263
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition: Sema.h:260
Holds information about the various types of exception specification.
Definition: Type.h:4250
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:4252
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:4255
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition: Type.h:4258
Extra information about a function prototype.
Definition: Type.h:4278
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:100
Represents a complete lambda introducer.
Definition: DeclSpec.h:2831
Contains a late templated function.
Definition: Sema.h:14802
CachedTokens Toks
Definition: Sema.h:14803
FPOptions FPO
Floating-point options in the point of definition.
Definition: Sema.h:14807
Decl * D
The template function declaration to be late parsed.
Definition: Sema.h:14805
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
Definition: SemaConcept.h:81
Iterator range representation begin:end[:step].
Definition: ExprOpenMP.h:278
This structure contains most locations needed for by an OMPVarListClause.
Definition: OpenMPClause.h:259
a linked list of methods with the same selector name but different signatures.
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
SourceLocation CurrentPragmaLocation
Definition: Sema.h:1541
CUDATargetContext SavedCtx
Definition: Sema.h:13179
Define the current global CUDA host/device context where a function may be called.
Definition: Sema.h:13171
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition: Sema.h:10051
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition: Sema.h:10209
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition: Sema.h:10162
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition: Sema.h:10178
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition: Sema.h:10204
ArrayRef< TemplateArgument > template_arguments() const
Definition: Sema.h:10197
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation,...
Definition: Sema.h:10173
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition: Sema.h:10165
unsigned NumCallArgs
The number of expressions in CallArgs.
Definition: Sema.h:10191
const Expr *const * CallArgs
The list of argument expressions in a synthesized call.
Definition: Sema.h:10181
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: Sema.h:10188
SynthesisKind
The kind of template instantiation we are performing.
Definition: Sema.h:10053
@ MarkingClassDllexported
We are marking a class as __dllexport.
Definition: Sema.h:10145
@ DefaultTemplateArgumentInstantiation
We are instantiating a default argument for a template parameter.
Definition: Sema.h:10063
@ ExplicitTemplateArgumentSubstitution
We are substituting explicit template arguments provided for a function template.
Definition: Sema.h:10072
@ DefaultTemplateArgumentChecking
We are checking the validity of a default template argument that has been used when naming a template...
Definition: Sema.h:10091
@ InitializingStructuredBinding
We are initializing a structured binding.
Definition: Sema.h:10142
@ ExceptionSpecInstantiation
We are instantiating the exception specification for a function template which was deferred until it ...
Definition: Sema.h:10099
@ NestedRequirementConstraintsCheck
We are checking the satisfaction of a nested requirement of a requires expression.
Definition: Sema.h:10106
@ BuildingBuiltinDumpStructCall
We are building an implied call from __builtin_dump_struct.
Definition: Sema.h:10149
@ DefiningSynthesizedFunction
We are defining a synthesized function (such as a defaulted special member).
Definition: Sema.h:10117
@ Memoization
Added for Template instantiation observation.
Definition: Sema.h:10155
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Definition: Sema.h:10082
@ BuildingDeductionGuides
We are building deduction guides for a class.
Definition: Sema.h:10158
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
Definition: Sema.h:10079
@ PriorTemplateArgumentSubstitution
We are substituting prior template arguments into a new template parameter.
Definition: Sema.h:10087
@ ExceptionSpecEvaluation
We are computing the exception specification for a defaulted special member function.
Definition: Sema.h:10095
@ TemplateInstantiation
We are instantiating a template declaration.
Definition: Sema.h:10056
@ DeclaringSpecialMember
We are declaring an implicit special member function.
Definition: Sema.h:10109
@ DeclaringImplicitEqualityComparison
We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.
Definition: Sema.h:10113
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Definition: Sema.h:10068
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Definition: Sema.h:10139
@ RequirementInstantiation
We are instantiating a requirement of a requires expression.
Definition: Sema.h:10102
CXXSpecialMember SpecialMember
The special member being declared or defined.
Definition: Sema.h:10194
Decl * Entity
The entity that is being synthesized.
Definition: Sema.h:10168
ConstraintEvalRAII(InstTy &TI)
Definition: Sema.h:10630
OMPDeclareTargetDeclAttr::MapTypeTy MT
Definition: Sema.h:13638
std::optional< Expr * > Indirect
The directive with indirect clause.
Definition: Sema.h:13651
OpenMPDirectiveKind Kind
The directive kind, begin declare target or declare target.
Definition: Sema.h:13648
DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
Definition: Sema.h:13656
SourceLocation Loc
The directive location.
Definition: Sema.h:13654
llvm::DenseMap< NamedDecl *, MapInfo > ExplicitlyMapped
Explicitly listed variables and functions in a 'to' or 'link' clause.
Definition: Sema.h:13642
InitializationContext(SourceLocation Loc, ValueDecl *Decl, DeclContext *Context)
Definition: Sema.h:5302
Data structure used to record current or nested expression evaluation contexts.
Definition: Sema.h:5188
SmallVector< CXXBindTemporaryExpr *, 8 > DelayedDecltypeBinds
If we are processing a decltype type, a set of temporary binding expressions for which we have deferr...
Definition: Sema.h:5220
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
Definition: Sema.h:5222
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition: Sema.h:5212
SmallVector< CallExpr *, 8 > DelayedDecltypeCalls
If we are processing a decltype type, a set of call expressions for which we have deferred checking t...
Definition: Sema.h:5216
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
Definition: Sema.h:5227
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
Definition: Sema.h:5235
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
Definition: Sema.h:5231
SmallVector< MaterializeTemporaryExpr *, 8 > ForRangeLifetimeExtendTemps
P2718R0 - Lifetime extension in range-based for loops.
Definition: Sema.h:5241
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition: Sema.h:5207
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
Definition: Sema.h:5245
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition: Sema.h:5193
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition: Sema.h:5201
std::optional< InitializationContext > DelayedDefaultInitializationContext
Definition: Sema.h:5312
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, ExpressionKind ExprContext)
Definition: Sema.h:5314
ExpressionEvaluationContext Context
The expression evaluation context.
Definition: Sema.h:5190
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition: Sema.h:5197
FormatArgumentPassingKind ArgPassingKind
Definition: Sema.h:2015
A pair of a canonical FunctionDecl and a SourceLocation.
Definition: Sema.h:13098
CanonicalDeclPtr< const FunctionDecl > FD
Definition: Sema.h:13099
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:1050
A stack object to be created when performing template instantiation.
Definition: Sema.h:10233
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition: Sema.h:10381
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition: Sema.h:10385
LocalInstantiationScope * Scope
Definition: Sema.h:10866
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition: Sema.h:10869
bool isMoveEligible() const
Definition: Sema.h:8861
bool isCopyElidable() const
Definition: Sema.h:8862
const VarDecl * Candidate
Definition: Sema.h:8856
Keeps information about an identifier in a nested-name-spec.
Definition: Sema.h:2508
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition: Sema.h:2514
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition: Sema.h:2523
SourceLocation IdentifierLoc
The location of the identifier.
Definition: Sema.h:2517
SourceLocation CCLoc
The location of the '::'.
Definition: Sema.h:2520
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
Definition: Sema.h:2511
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition: Sema.h:2529
Data structure for iterator expression.
Definition: Sema.h:5746
OMPIteratorExpr::IteratorRange Range
Definition: Sema.h:5750
SourceLocation DeclIdentLoc
Definition: Sema.h:5748
SourceLocation AssignLoc
Definition: Sema.h:5751
SourceLocation ColonLoc
Definition: Sema.h:5752
SourceLocation SecColonLoc
Definition: Sema.h:5753
IdentifierInfo * Name
Definition: Sema.h:12211
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition: Sema.h:12219
ObjCDeclSpec DeclSpec
Definition: Sema.h:12216
SourceLocation NameLoc
Definition: Sema.h:12212
SourceLocation LocEnd
Definition: Sema.h:5848
IdentifierInfo * IdentInfo
Definition: Sema.h:5851
Data used for processing a list of variables in OpenMP clauses.
Definition: Sema.h:14419
CXXScopeSpec ReductionOrMapperIdScopeSpec
Definition: Sema.h:14424
SmallVector< OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers > MapTypeModifiers
Definition: Sema.h:14429
SmallVector< OpenMPMotionModifierKind, NumberOfOMPMotionModifiers > MotionModifiers
Definition: Sema.h:14433
SourceLocation ExtraModifierLoc
Definition: Sema.h:14436
DeclarationNameInfo ReductionOrMapperId
Definition: Sema.h:14425
SmallVector< SourceLocation, NumberOfOMPMotionModifiers > MotionModifiersLoc
Definition: Sema.h:14434
SourceLocation OmpAllMemoryLoc
Definition: Sema.h:14437
SmallVector< SourceLocation, NumberOfOMPMapClauseModifiers > MapTypeModifiersLoc
Definition: Sema.h:14431
SourceLocation StepModifierLoc
Definition: Sema.h:14439
brief A function argument from which we performed template argument
Definition: Sema.h:9864
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition: Sema.h:9865
This an attribute introduced by #pragma clang attribute.
Definition: Sema.h:1597
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition: Sema.h:1600
A push'd group of PragmaAttributeEntries.
Definition: Sema.h:1605
SourceLocation Loc
The location of the push attribute.
Definition: Sema.h:1607
SmallVector< PragmaAttributeEntry, 2 > Entries
Definition: Sema.h:1610
const IdentifierInfo * Namespace
The namespace of this push group.
Definition: Sema.h:1609
SourceLocation PragmaLocation
Definition: Sema.h:1319
PragmaMsStackAction Action
Definition: Sema.h:1339
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
Definition: Sema.h:1452
llvm::StringRef StackSlotLabel
Definition: Sema.h:1448
SourceLocation PragmaLocation
Definition: Sema.h:1450
SourceLocation PragmaPushLocation
Definition: Sema.h:1451
ValueType CurrentValue
Definition: Sema.h:1522
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition: Sema.h:1508
bool hasValue() const
Definition: Sema.h:1518
SmallVector< Slot, 2 > Stack
Definition: Sema.h:1520
ValueType DefaultValue
Definition: Sema.h:1521
SourceLocation CurrentPragmaLocation
Definition: Sema.h:1523
PragmaStack(const ValueType &Default)
Definition: Sema.h:1515
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: Sema.h:1459
ProcessDeclAttributeOptions WithIgnoreTypeAttributes(bool Val)
Definition: Sema.h:3955
ProcessDeclAttributeOptions WithIncludeCXX11Attributes(bool Val)
Definition: Sema.h:3949
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Definition: Sema.h:8405
Abstract class used to diagnose incomplete types.
Definition: Sema.h:6610
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
virtual ~TypeDiagnoser()
Definition: Sema.h:6614
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition: Sema.h:2056
unsigned LayoutCompatible
If true, Type should be compared with other expression's types for layout-compatibility.
Definition: Sema.h:2065
std::unique_ptr< TypoCorrectionConsumer > Consumer
Definition: Sema.h:7897
TypoDiagnosticGenerator DiagHandler
Definition: Sema.h:7898
TypoRecoveryCallback RecoveryHandler
Definition: Sema.h:7899
Data for list of allocators.
Definition: Sema.h:14614
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Definition: Sema.h:14620
Information about a template-id annotation token.
static FunctionDeclAndLoc getTombstoneKey()
Definition: Sema.h:14832
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
Definition: Sema.h:14841
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
Definition: Sema.h:14836
DenseMapInfo< clang::CanonicalDeclPtr< const clang::FunctionDecl > > FDBaseInfo
Definition: Sema.h:14826