clang  3.8.0
Sema.h
Go to the documentation of this file.
1 //===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the Sema class, which performs semantic analysis and
11 // builds ASTs.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_SEMA_SEMA_H
16 #define LLVM_CLANG_SEMA_SEMA_H
17 
18 #include "clang/AST/Attr.h"
20 #include "clang/AST/Expr.h"
21 #include "clang/AST/ExprObjC.h"
24 #include "clang/AST/NSAPI.h"
26 #include "clang/AST/TypeLoc.h"
29 #include "clang/Basic/Module.h"
31 #include "clang/Basic/Specifiers.h"
33 #include "clang/Basic/TypeTraits.h"
35 #include "clang/Sema/DeclSpec.h"
38 #include "clang/Sema/LocInfoType.h"
40 #include "clang/Sema/Ownership.h"
41 #include "clang/Sema/Scope.h"
42 #include "clang/Sema/ScopeInfo.h"
44 #include "clang/Sema/Weak.h"
45 #include "llvm/ADT/ArrayRef.h"
46 #include "llvm/ADT/Optional.h"
47 #include "llvm/ADT/SetVector.h"
48 #include "llvm/ADT/SmallPtrSet.h"
49 #include "llvm/ADT/SmallVector.h"
50 #include "llvm/ADT/TinyPtrVector.h"
51 #include <deque>
52 #include <memory>
53 #include <string>
54 #include <vector>
55 
56 namespace llvm {
57  class APSInt;
58  template <typename ValueT> struct DenseMapInfo;
59  template <typename ValueT, typename ValueInfoT> class DenseSet;
60  class SmallBitVector;
61  class InlineAsmIdentifierInfo;
62 }
63 
64 namespace clang {
65  class ADLResult;
66  class ASTConsumer;
67  class ASTContext;
68  class ASTMutationListener;
69  class ASTReader;
70  class ASTWriter;
71  class ArrayType;
72  class AttributeList;
73  class BlockDecl;
74  class CapturedDecl;
75  class CXXBasePath;
76  class CXXBasePaths;
77  class CXXBindTemporaryExpr;
79  class CXXConstructorDecl;
80  class CXXConversionDecl;
81  class CXXDeleteExpr;
82  class CXXDestructorDecl;
83  class CXXFieldCollector;
84  class CXXMemberCallExpr;
85  class CXXMethodDecl;
86  class CXXScopeSpec;
87  class CXXTemporary;
88  class CXXTryStmt;
89  class CallExpr;
90  class ClassTemplateDecl;
91  class ClassTemplatePartialSpecializationDecl;
92  class ClassTemplateSpecializationDecl;
93  class VarTemplatePartialSpecializationDecl;
94  class CodeCompleteConsumer;
95  class CodeCompletionAllocator;
96  class CodeCompletionTUInfo;
97  class CodeCompletionResult;
98  class Decl;
99  class DeclAccessPair;
100  class DeclContext;
101  class DeclRefExpr;
102  class DeclaratorDecl;
103  class DeducedTemplateArgument;
104  class DependentDiagnostic;
105  class DesignatedInitExpr;
106  class Designation;
107  class EnableIfAttr;
108  class EnumConstantDecl;
109  class Expr;
110  class ExtVectorType;
111  class ExternalSemaSource;
112  class FormatAttr;
113  class FriendDecl;
114  class FunctionDecl;
115  class FunctionProtoType;
116  class FunctionTemplateDecl;
117  class ImplicitConversionSequence;
118  class InitListExpr;
119  class InitializationKind;
120  class InitializationSequence;
121  class InitializedEntity;
122  class IntegerLiteral;
123  class LabelStmt;
124  class LambdaExpr;
125  class LangOptions;
126  class LocalInstantiationScope;
127  class LookupResult;
128  class MacroInfo;
130  class ModuleLoader;
131  class MultiLevelTemplateArgumentList;
132  class NamedDecl;
133  class ObjCCategoryDecl;
134  class ObjCCategoryImplDecl;
135  class ObjCCompatibleAliasDecl;
136  class ObjCContainerDecl;
137  class ObjCImplDecl;
138  class ObjCImplementationDecl;
139  class ObjCInterfaceDecl;
140  class ObjCIvarDecl;
141  template <class T> class ObjCList;
142  class ObjCMessageExpr;
143  class ObjCMethodDecl;
144  class ObjCPropertyDecl;
145  class ObjCProtocolDecl;
146  class OMPThreadPrivateDecl;
147  class OMPClause;
148  struct OverloadCandidate;
149  class OverloadCandidateSet;
150  class OverloadExpr;
151  class ParenListExpr;
152  class ParmVarDecl;
153  class Preprocessor;
154  class PseudoDestructorTypeStorage;
155  class PseudoObjectExpr;
156  class QualType;
157  class StandardConversionSequence;
158  class Stmt;
159  class StringLiteral;
160  class SwitchStmt;
161  class TemplateArgument;
162  class TemplateArgumentList;
163  class TemplateArgumentLoc;
164  class TemplateDecl;
165  class TemplateParameterList;
166  class TemplatePartialOrderingContext;
167  class TemplateTemplateParmDecl;
168  class Token;
169  class TypeAliasDecl;
170  class TypedefDecl;
171  class TypedefNameDecl;
172  class TypeLoc;
173  class TypoCorrectionConsumer;
174  class UnqualifiedId;
175  class UnresolvedLookupExpr;
176  class UnresolvedMemberExpr;
177  class UnresolvedSetImpl;
178  class UnresolvedSetIterator;
179  class UsingDecl;
180  class UsingShadowDecl;
181  class ValueDecl;
182  class VarDecl;
183  class VarTemplateSpecializationDecl;
184  class VisibilityAttr;
185  class VisibleDeclConsumer;
186  class IndirectFieldDecl;
187  struct DeductionFailureInfo;
188  class TemplateSpecCandidateSet;
189 
190 namespace sema {
191  class AccessedEntity;
192  class BlockScopeInfo;
193  class CapturedRegionScopeInfo;
194  class CapturingScopeInfo;
195  class CompoundScopeInfo;
196  class DelayedDiagnostic;
197  class DelayedDiagnosticPool;
198  class FunctionScopeInfo;
199  class LambdaScopeInfo;
200  class PossiblyUnreachableDiag;
201  class TemplateDeductionInfo;
202 }
203 
204 namespace threadSafety {
205  class BeforeSet;
206  void threadSafetyCleanup(BeforeSet* Cache);
207 }
208 
209 // FIXME: No way to easily map from TemplateTypeParmTypes to
210 // TemplateTypeParmDecls, so we have this horrible PointerUnion.
211 typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
213 
214 /// Describes whether we've seen any nullability information for the given
215 /// file.
217  /// The first pointer declarator (of any pointer kind) in the file that does
218  /// not have a corresponding nullability annotation.
220 
221  /// Which kind of pointer declarator we saw.
222  uint8_t PointerKind;
223 
224  /// Whether we saw any type nullability annotations in the given file.
225  bool SawTypeNullability = false;
226 };
227 
228 /// A mapping from file IDs to a record of whether we've seen nullability
229 /// information in that file.
231  /// A mapping from file IDs to the nullability information for each file ID.
232  llvm::DenseMap<FileID, FileNullability> Map;
233 
234  /// A single-element cache based on the file ID.
235  struct {
238  } Cache;
239 
240 public:
242  // Check the single-element cache.
243  if (file == Cache.File)
244  return Cache.Nullability;
245 
246  // It's not in the single-element cache; flush the cache if we have one.
247  if (!Cache.File.isInvalid()) {
248  Map[Cache.File] = Cache.Nullability;
249  }
250 
251  // Pull this entry into the cache.
252  Cache.File = file;
253  Cache.Nullability = Map[file];
254  return Cache.Nullability;
255  }
256 };
257 
258 /// Sema - This implements semantic analysis and AST building for C.
259 class Sema {
260  Sema(const Sema &) = delete;
261  void operator=(const Sema &) = delete;
262 
263  ///\brief Source of additional semantic information.
264  ExternalSemaSource *ExternalSource;
265 
266  ///\brief Whether Sema has generated a multiplexer and has to delete it.
267  bool isMultiplexExternalSource;
268 
269  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
270 
271  bool isVisibleSlow(const NamedDecl *D);
272 
273  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
274  const NamedDecl *New) {
275  // We are about to link these. It is now safe to compute the linkage of
276  // the new decl. If the new decl has external linkage, we will
277  // link it with the hidden decl (which also has external linkage) and
278  // it will keep having external linkage. If it has internal linkage, we
279  // will not link it. Since it has no previous decls, it will remain
280  // with internal linkage.
281  return isVisible(Old) || New->isExternallyVisible();
282  }
283  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
284 
285 public:
289 
292 
299 
300  /// \brief Flag indicating whether or not to collect detailed statistics.
302 
303  /// \brief Code-completion consumer.
305 
306  /// CurContext - This is the current declaration context of parsing.
308 
309  /// \brief Generally null except when we temporarily switch decl contexts,
310  /// like in \see ActOnObjCTemporaryExitContainerContext.
312 
313  /// VAListTagName - The declaration name corresponding to __va_list_tag.
314  /// This is used as part of a hack to omit that class from ADL results.
316 
317  /// PackContext - Manages the stack for \#pragma pack. An alignment
318  /// of 0 indicates default alignment.
319  void *PackContext; // Really a "PragmaPackStack*"
320 
321  bool MSStructPragmaOn; // True when \#pragma ms_struct on
322 
323  /// \brief Controls member pointer representation format under the MS ABI.
326 
328  PVDK_Push, ///< #pragma vtordisp(push, mode)
329  PVDK_Set, ///< #pragma vtordisp(mode)
330  PVDK_Pop, ///< #pragma vtordisp(pop)
331  PVDK_Reset ///< #pragma vtordisp()
332  };
333 
335  PSK_Reset, // #pragma ()
336  PSK_Set, // #pragma ("name")
337  PSK_Push, // #pragma (push[, id])
338  PSK_Push_Set, // #pragma (push[, id], "name")
339  PSK_Pop, // #pragma (pop[, id])
340  PSK_Pop_Set, // #pragma (pop[, id], "name")
341  };
342 
343  /// \brief Whether to insert vtordisps prior to virtual bases in the Microsoft
344  /// C++ ABI. Possible values are 0, 1, and 2, which mean:
345  ///
346  /// 0: Suppress all vtordisps
347  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
348  /// structors
349  /// 2: Always insert vtordisps to support RTTI on partially constructed
350  /// objects
351  ///
352  /// The stack always has at least one element in it.
354 
355  /// Stack of active SEH __finally scopes. Can be empty.
357 
358  /// \brief Source location for newly created implicit MSInheritanceAttrs
360 
361  template<typename ValueType>
362  struct PragmaStack {
363  struct Slot {
364  llvm::StringRef StackSlotLabel;
365  ValueType Value;
367  Slot(llvm::StringRef StackSlotLabel,
368  ValueType Value,
370  : StackSlotLabel(StackSlotLabel), Value(Value),
371  PragmaLocation(PragmaLocation) {}
372  };
373  void Act(SourceLocation PragmaLocation,
375  llvm::StringRef StackSlotLabel,
376  ValueType Value);
377  explicit PragmaStack(const ValueType &Value)
378  : CurrentValue(Value) {}
380  ValueType CurrentValue;
382  };
383  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
384  // we shouldn't do so if they're in a module).
389 
390  /// A mapping that describes the nullability we've seen in each header file.
392 
393  /// Last section used with #pragma init_seg.
396 
397  /// VisContext - Manages the stack for \#pragma GCC visibility.
398  void *VisContext; // Really a "PragmaVisStack*"
399 
400  /// \brief This represents the last location of a "#pragma clang optimize off"
401  /// directive if such a directive has not been closed by an "on" yet. If
402  /// optimizations are currently "on", this is set to an invalid location.
404 
405  /// \brief Flag indicating if Sema is building a recovery call expression.
406  ///
407  /// This flag is used to avoid building recovery call expressions
408  /// if Sema is already doing so, which would cause infinite recursions.
410 
411  /// ExprNeedsCleanups - True if the current evaluation context
412  /// requires cleanups to be run at its conclusion.
414 
415  /// ExprCleanupObjects - This is the stack of objects requiring
416  /// cleanup that are created by the current full expression. The
417  /// element type here is ExprWithCleanups::Object.
419 
420  /// \brief Store a list of either DeclRefExprs or MemberExprs
421  /// that contain a reference to a variable (constant) that may or may not
422  /// be odr-used in this Expr, and we won't know until all lvalue-to-rvalue
423  /// and discarded value conversions have been applied to all subexpressions
424  /// of the enclosing full expression. This is cleared at the end of each
425  /// full expression.
426  llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
427 
428  /// \brief Stack containing information about each of the nested
429  /// function, block, and method scopes that are currently active.
430  ///
431  /// This array is never empty. Clients should ignore the first
432  /// element, which is used to cache a single FunctionScopeInfo
433  /// that's used to parse every top-level function.
435 
439 
440  /// ExtVectorDecls - This is a list all the extended vector types. This allows
441  /// us to associate a raw vector type with one of the ext_vector type names.
442  /// This is only necessary for issuing pretty diagnostics.
444 
445  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
446  std::unique_ptr<CXXFieldCollector> FieldCollector;
447 
449 
450  /// \brief Set containing all declared private fields that are not used.
452 
453  /// \brief Set containing all typedefs that are likely unused.
456 
457  /// \brief Delete-expressions to be analyzed at the end of translation unit
458  ///
459  /// This list contains class members, and locations of delete-expressions
460  /// that could not be proven as to whether they mismatch with new-expression
461  /// used in initializer of the field.
462  typedef std::pair<SourceLocation, bool> DeleteExprLoc;
464  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
465 
466  typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy;
467 
468  /// PureVirtualClassDiagSet - a set of class declarations which we have
469  /// emitted a list of pure virtual functions. Used to prevent emitting the
470  /// same list more than once.
471  std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
472 
473  /// ParsingInitForAutoVars - a set of declarations with auto types for which
474  /// we are currently parsing the initializer.
475  llvm::SmallPtrSet<const Decl*, 4> ParsingInitForAutoVars;
476 
477  /// \brief Look for a locally scoped extern "C" declaration by the given name.
479 
483 
484  /// \brief All the tentative definitions encountered in the TU.
486 
490 
491  /// \brief The set of file scoped decls seen so far that have not been used
492  /// and must warn if not used. Only contains the first declaration.
494 
498 
499  /// \brief All the delegating constructors seen so far in the file, used for
500  /// cycle detection at the end of the TU.
502 
503  /// \brief All the overriding functions seen during a class definition
504  /// that had their exception spec checks delayed, plus the overridden
505  /// function.
508 
509  /// \brief All the members seen during a class definition which were both
510  /// explicitly defaulted and had explicitly-specified exception
511  /// specifications, along with the function type containing their
512  /// user-specified exception specification. Those exception specifications
513  /// were overridden with the default specifications, but we still need to
514  /// check whether they are compatible with the default specification, and
515  /// we can't do that until the nesting set of class definitions is complete.
518 
519  typedef llvm::MapVector<const FunctionDecl *, LateParsedTemplate *>
522 
523  /// \brief Callback to the parser to parse templated functions when needed.
524  typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
525  typedef void LateTemplateParserCleanupCB(void *P);
529 
531  LateTemplateParserCleanupCB *LTPCleanup,
532  void *P) {
533  LateTemplateParser = LTP;
534  LateTemplateParserCleanup = LTPCleanup;
535  OpaqueParser = P;
536  }
537 
538  class DelayedDiagnostics;
539 
541  sema::DelayedDiagnosticPool *SavedPool;
543  };
546 
547  /// A class which encapsulates the logic for delaying diagnostics
548  /// during parsing and other processing.
550  /// \brief The current pool of diagnostics into which delayed
551  /// diagnostics should go.
553 
554  public:
555  DelayedDiagnostics() : CurPool(nullptr) {}
556 
557  /// Adds a delayed diagnostic.
558  void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
559 
560  /// Determines whether diagnostics should be delayed.
561  bool shouldDelayDiagnostics() { return CurPool != nullptr; }
562 
563  /// Returns the current delayed-diagnostics pool.
565  return CurPool;
566  }
567 
568  /// Enter a new scope. Access and deprecation diagnostics will be
569  /// collected in this pool.
572  state.SavedPool = CurPool;
573  CurPool = &pool;
574  return state;
575  }
576 
577  /// Leave a delayed-diagnostic state that was previously pushed.
578  /// Do not emit any of the diagnostics. This is performed as part
579  /// of the bookkeeping of popping a pool "properly".
581  CurPool = state.SavedPool;
582  }
583 
584  /// Enter a new scope where access and deprecation diagnostics are
585  /// not delayed.
588  state.SavedPool = CurPool;
589  CurPool = nullptr;
590  return state;
591  }
592 
593  /// Undo a previous pushUndelayed().
595  assert(CurPool == nullptr);
596  CurPool = state.SavedPool;
597  }
599 
600  /// A RAII object to temporarily push a declaration context.
601  class ContextRAII {
602  private:
603  Sema &S;
604  DeclContext *SavedContext;
605  ProcessingContextState SavedContextState;
606  QualType SavedCXXThisTypeOverride;
607 
608  public:
609  ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
610  : S(S), SavedContext(S.CurContext),
611  SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
612  SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
613  {
614  assert(ContextToPush && "pushing null context");
615  S.CurContext = ContextToPush;
616  if (NewThisContext)
618  }
619 
620  void pop() {
621  if (!SavedContext) return;
622  S.CurContext = SavedContext;
623  S.DelayedDiagnostics.popUndelayed(SavedContextState);
624  S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
625  SavedContext = nullptr;
626  }
627 
629  pop();
630  }
631  };
632 
633  /// \brief RAII object to handle the state changes required to synthesize
634  /// a function body.
636  Sema &S;
637  Sema::ContextRAII SavedContext;
638 
639  public:
641  : S(S), SavedContext(S, DC)
642  {
643  S.PushFunctionScope();
645  }
646 
650  }
651  };
652 
653  /// WeakUndeclaredIdentifiers - Identifiers contained in
654  /// \#pragma weak before declared. rare. may alias another
655  /// identifier, declared or undeclared
656  llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
657 
658  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
659  /// \#pragma redefine_extname before declared. Used in Solaris system headers
660  /// to define functions that occur in multiple standards to call the version
661  /// in the currently selected standard.
662  llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
663 
664 
665  /// \brief Load weak undeclared identifiers from the external source.
667 
668  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
669  /// \#pragma weak during processing of other Decls.
670  /// I couldn't figure out a clean way to generate these in-line, so
671  /// we store them here and handle separately -- which is a hack.
672  /// It would be best to refactor this.
674 
676 
677  /// Translation Unit Scope - useful to Objective-C actions that need
678  /// to lookup file scope declarations in the "ordinary" C decl namespace.
679  /// For example, user-defined classes, built-in "id" type, etc.
681 
682  /// \brief The C++ "std" namespace, where the standard library resides.
684 
685  /// \brief The C++ "std::bad_alloc" class, which is defined by the C++
686  /// standard library.
688 
689  /// \brief The C++ "std::initializer_list" template, which is defined in
690  /// <initializer_list>.
692 
693  /// \brief The C++ "type_info" declaration, which is defined in <typeinfo>.
695 
696  /// \brief The MSVC "_GUID" struct, which is defined in MSVC header files.
698 
699  /// \brief Caches identifiers/selectors for NSFoundation APIs.
700  std::unique_ptr<NSAPI> NSAPIObj;
701 
702  /// \brief The declaration of the Objective-C NSNumber class.
704 
705  /// \brief The declaration of the Objective-C NSValue class.
707 
708  /// \brief Pointer to NSNumber type (NSNumber *).
710 
711  /// \brief Pointer to NSValue type (NSValue *).
713 
714  /// \brief The Objective-C NSNumber methods used to create NSNumber literals.
716 
717  /// \brief The declaration of the Objective-C NSString class.
719 
720  /// \brief Pointer to NSString type (NSString *).
722 
723  /// \brief The declaration of the stringWithUTF8String: method.
725 
726  /// \brief The declaration of the valueWithBytes:objCType: method.
728 
729  /// \brief The declaration of the Objective-C NSArray class.
731 
732  /// \brief The declaration of the arrayWithObjects:count: method.
734 
735  /// \brief The declaration of the Objective-C NSDictionary class.
737 
738  /// \brief The declaration of the dictionaryWithObjects:forKeys:count: method.
740 
741  /// \brief id<NSCopying> type.
743 
744  /// \brief will hold 'respondsToSelector:'
746 
747  /// \brief counter for internal MS Asm label names.
749 
750  /// A flag to remember whether the implicit forms of operator new and delete
751  /// have been declared.
753 
754  /// A flag to indicate that we're in a context that permits abstract
755  /// references to fields. This is really a
757 
758  /// \brief Describes how the expressions currently being parsed are
759  /// evaluated at run-time, if at all.
761  /// \brief The current expression and its subexpressions occur within an
762  /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
763  /// \c sizeof, where the type of the expression may be significant but
764  /// no code will be generated to evaluate the value of the expression at
765  /// run time.
767 
768  /// \brief The current expression occurs within an unevaluated
769  /// operand that unconditionally permits abstract references to
770  /// fields, such as a SIZE operator in MS-style inline assembly.
772 
773  /// \brief The current context is "potentially evaluated" in C++11 terms,
774  /// but the expression is evaluated at compile-time (like the values of
775  /// cases in a switch statement).
777 
778  /// \brief The current expression is potentially evaluated at run time,
779  /// which means that code may be generated to evaluate the value of the
780  /// expression at run time.
782 
783  /// \brief The current expression is potentially evaluated, but any
784  /// declarations referenced inside that expression are only used if
785  /// in fact the current expression is used.
786  ///
787  /// This value is used when parsing default function arguments, for which
788  /// we would like to provide diagnostics (e.g., passing non-POD arguments
789  /// through varargs) but do not want to mark declarations as "referenced"
790  /// until the default argument is used.
792  };
793 
794  /// \brief Data structure used to record current or nested
795  /// expression evaluation contexts.
797  /// \brief The expression evaluation context.
799 
800  /// \brief Whether the enclosing context needed a cleanup.
802 
803  /// \brief Whether we are in a decltype expression.
805 
806  /// \brief The number of active cleanup objects when we entered
807  /// this expression evaluation context.
809 
810  /// \brief The number of typos encountered during this expression evaluation
811  /// context (i.e. the number of TypoExprs created).
812  unsigned NumTypos;
813 
814  llvm::SmallPtrSet<Expr*, 2> SavedMaybeODRUseExprs;
815 
816  /// \brief The lambdas that are present within this context, if it
817  /// is indeed an unevaluated context.
819 
820  /// \brief The declaration that provides context for lambda expressions
821  /// and block literals if the normal declaration context does not
822  /// suffice, e.g., in a default function argument.
824 
825  /// \brief The context information used to mangle lambda expressions
826  /// and block literals within this context.
827  ///
828  /// This mangling information is allocated lazily, since most contexts
829  /// do not have lambda expressions or block literals.
831 
832  /// \brief If we are processing a decltype type, a set of call expressions
833  /// for which we have deferred checking the completeness of the return type.
835 
836  /// \brief If we are processing a decltype type, a set of temporary binding
837  /// expressions for which we have deferred checking the destructor.
839 
841  unsigned NumCleanupObjects,
842  bool ParentNeedsCleanups,
844  bool IsDecltype)
845  : Context(Context), ParentNeedsCleanups(ParentNeedsCleanups),
846  IsDecltype(IsDecltype), NumCleanupObjects(NumCleanupObjects),
847  NumTypos(0),
848  ManglingContextDecl(ManglingContextDecl), MangleNumbering() { }
849 
850  /// \brief Retrieve the mangling numbering context, used to consistently
851  /// number constructs like lambdas for mangling.
853 
854  bool isUnevaluated() const {
856  }
857  };
858 
859  /// A stack of expression evaluation contexts.
861 
862  /// \brief Compute the mangling number context for a lambda expression or
863  /// block literal.
864  ///
865  /// \param DC - The DeclContext containing the lambda expression or
866  /// block literal.
867  /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl
868  /// associated with the context, if relevant.
870  const DeclContext *DC,
871  Decl *&ManglingContextDecl);
872 
873 
874  /// SpecialMemberOverloadResult - The overloading result for a special member
875  /// function.
876  ///
877  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
878  /// integer are used to determine whether overload resolution succeeded.
879  class SpecialMemberOverloadResult : public llvm::FastFoldingSetNode {
880  public:
881  enum Kind {
885  };
886 
887  private:
888  llvm::PointerIntPair<CXXMethodDecl*, 2> Pair;
889 
890  public:
891  SpecialMemberOverloadResult(const llvm::FoldingSetNodeID &ID)
892  : FastFoldingSetNode(ID)
893  {}
894 
895  CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
896  void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
897 
898  Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
899  void setKind(Kind K) { Pair.setInt(K); }
900  };
901 
902  /// \brief A cache of special member function overload resolution results
903  /// for C++ records.
904  llvm::FoldingSet<SpecialMemberOverloadResult> SpecialMemberCache;
905 
906  /// \brief A cache of the flags available in enumerations with the flag_bits
907  /// attribute.
908  mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
909 
910  /// \brief The kind of translation unit we are processing.
911  ///
912  /// When we're processing a complete translation unit, Sema will perform
913  /// end-of-translation-unit semantic tasks (such as creating
914  /// initializers for tentative definitions in C) once parsing has
915  /// completed. Modules and precompiled headers perform different kinds of
916  /// checks.
918 
919  llvm::BumpPtrAllocator BumpAlloc;
920 
921  /// \brief The number of SFINAE diagnostics that have been trapped.
922  unsigned NumSFINAEErrors;
923 
924  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
926 
927  /// \brief A mapping from parameters with unparsed default arguments to the
928  /// set of instantiations of each parameter.
929  ///
930  /// This mapping is a temporary data structure used when parsing
931  /// nested class templates or nested classes of class templates,
932  /// where we might end up instantiating an inner class before the
933  /// default arguments of its methods have been parsed.
935 
936  // Contains the locations of the beginning of unparsed default
937  // argument locations.
938  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
939 
940  /// UndefinedInternals - all the used, undefined objects which require a
941  /// definition in this translation unit.
942  llvm::DenseMap<NamedDecl *, SourceLocation> UndefinedButUsed;
943 
944  /// Obtain a sorted list of functions that are undefined but ODR-used.
945  void getUndefinedButUsed(
946  SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
947 
948  /// Retrieves list of suspicious delete-expressions that will be checked at
949  /// the end of translation unit.
950  const llvm::MapVector<FieldDecl *, DeleteLocs> &
952 
953  typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods;
954  typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
955 
956  /// Method Pool - allows efficient lookup when typechecking messages to "id".
957  /// We need to maintain a list, since selectors can have differing signatures
958  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
959  /// of selectors are "overloaded").
960  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
961  /// methods inside categories with a particular selector.
963 
964  /// Method selectors used in a \@selector expression. Used for implementation
965  /// of -Wselector.
966  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
967 
968  /// Kinds of C++ special members.
977  };
978 
979  typedef std::pair<CXXRecordDecl*, CXXSpecialMember> SpecialMemberDecl;
980 
981  /// The C++ special members which we are currently in the process of
982  /// declaring. If this process recursively triggers the declaration of the
983  /// same special member, we should act as if it is not yet declared.
984  llvm::SmallSet<SpecialMemberDecl, 4> SpecialMembersBeingDeclared;
985 
986  void ReadMethodPool(Selector Sel);
987 
988  /// Private Helper predicate to check for 'self'.
989  bool isSelfExpr(Expr *RExpr);
990  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
991 
992  /// \brief Cause the active diagnostic on the DiagosticsEngine to be
993  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
994  /// should not be used elsewhere.
995  void EmitCurrentDiagnostic(unsigned DiagID);
996 
997  /// Records and restores the FP_CONTRACT state on entry/exit of compound
998  /// statements.
1000  public:
1002  : S(S), OldFPContractState(S.FPFeatures.fp_contract) {}
1004  S.FPFeatures.fp_contract = OldFPContractState;
1005  }
1006  private:
1007  Sema& S;
1008  bool OldFPContractState : 1;
1009  };
1010 
1011  /// Records and restores the vtordisp state on entry/exit of C++ method body.
1013  public:
1014  VtorDispStackRAII(Sema &S, bool ShouldSaveAndRestore)
1015  : S(S), ShouldSaveAndRestore(ShouldSaveAndRestore), OldVtorDispStack() {
1016  if (ShouldSaveAndRestore)
1017  OldVtorDispStack = S.VtorDispModeStack;
1018  }
1020  if (ShouldSaveAndRestore)
1021  S.VtorDispModeStack = OldVtorDispStack;
1022  }
1023  private:
1024  Sema &S;
1025  bool ShouldSaveAndRestore;
1026  SmallVector<MSVtorDispAttr::Mode, 2> OldVtorDispStack;
1027  };
1028 
1029  void addImplicitTypedef(StringRef Name, QualType T);
1030 
1031 public:
1032  Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1034  CodeCompleteConsumer *CompletionConsumer = nullptr);
1035  ~Sema();
1036 
1037  /// \brief Perform initialization that occurs after the parser has been
1038  /// initialized but before it parses anything.
1039  void Initialize();
1040 
1041  const LangOptions &getLangOpts() const { return LangOpts; }
1044 
1047  Preprocessor &getPreprocessor() const { return PP; }
1048  ASTContext &getASTContext() const { return Context; }
1049  ASTConsumer &getASTConsumer() const { return Consumer; }
1051  ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1052 
1053  ///\brief Registers an external source. If an external source already exists,
1054  /// creates a multiplex external source and appends to it.
1055  ///
1056  ///\param[in] E - A non-null external sema source.
1057  ///
1059 
1060  void PrintStats() const;
1061 
1062  /// \brief Helper class that creates diagnostics with optional
1063  /// template instantiation stacks.
1064  ///
1065  /// This class provides a wrapper around the basic DiagnosticBuilder
1066  /// class that emits diagnostics. SemaDiagnosticBuilder is
1067  /// responsible for emitting the diagnostic (as DiagnosticBuilder
1068  /// does) and, if the diagnostic comes from inside a template
1069  /// instantiation, printing the template instantiation stack as
1070  /// well.
1072  Sema &SemaRef;
1073  unsigned DiagID;
1074 
1075  public:
1076  SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1077  : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
1078 
1079  // This is a cunning lie. DiagnosticBuilder actually performs move
1080  // construction in its copy constructor (but due to varied uses, it's not
1081  // possible to conveniently express this as actual move construction). So
1082  // the default copy ctor here is fine, because the base class disables the
1083  // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op
1084  // in that case anwyay.
1085  SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;
1086 
1088  // If we aren't active, there is nothing to do.
1089  if (!isActive()) return;
1090 
1091  // Otherwise, we need to emit the diagnostic. First flush the underlying
1092  // DiagnosticBuilder data, and clear the diagnostic builder itself so it
1093  // won't emit the diagnostic in its own destructor.
1094  //
1095  // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1096  // do its own needless checks to see if the diagnostic needs to be
1097  // emitted. However, because we take care to ensure that the builder
1098  // objects never escape, a sufficiently smart compiler will be able to
1099  // eliminate that code.
1100  FlushCounts();
1101  Clear();
1102 
1103  // Dispatch to Sema to emit the diagnostic.
1104  SemaRef.EmitCurrentDiagnostic(DiagID);
1105  }
1106 
1107  /// Teach operator<< to produce an object of the correct type.
1108  template<typename T>
1110  const SemaDiagnosticBuilder &Diag, const T &Value) {
1111  const DiagnosticBuilder &BaseDiag = Diag;
1112  BaseDiag << Value;
1113  return Diag;
1114  }
1115  };
1116 
1117  /// \brief Emit a diagnostic.
1119  DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
1120  return SemaDiagnosticBuilder(DB, *this, DiagID);
1121  }
1122 
1123  /// \brief Emit a partial diagnostic.
1124  SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic& PD);
1125 
1126  /// \brief Build a partial diagnostic.
1127  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1128 
1129  bool findMacroSpelling(SourceLocation &loc, StringRef name);
1130 
1131  /// \brief Get a string to suggest for zero-initialization of a type.
1132  std::string
1134  std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1135 
1136  /// \brief Calls \c Lexer::getLocForEndOfToken()
1138 
1139  /// \brief Retrieve the module loader associated with the preprocessor.
1140  ModuleLoader &getModuleLoader() const;
1141 
1143 
1145 
1147 
1149 
1150  void PushFunctionScope();
1151  void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1153 
1154  /// \brief This is used to inform Sema what the current TemplateParameterDepth
1155  /// is during Parsing. Currently it is used to pass on the depth
1156  /// when parsing generic lambda 'auto' parameters.
1158 
1159  void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1160  RecordDecl *RD,
1161  CapturedRegionKind K);
1162  void
1164  const Decl *D = nullptr,
1165  const BlockExpr *blkExpr = nullptr);
1166 
1168  return FunctionScopes.back();
1169  }
1170 
1172  if (FunctionScopes.empty())
1173  return nullptr;
1174 
1175  for (int e = FunctionScopes.size()-1; e >= 0; --e) {
1176  if (isa<sema::BlockScopeInfo>(FunctionScopes[e]))
1177  continue;
1178  return FunctionScopes[e];
1179  }
1180  return nullptr;
1181  }
1182 
1183  template <typename ExprT>
1184  void recordUseOfEvaluatedWeak(const ExprT *E, bool IsRead=true) {
1185  if (!isUnevaluatedContext())
1186  getCurFunction()->recordUseOfWeak(E, IsRead);
1187  }
1188 
1189  void PushCompoundScope();
1190  void PopCompoundScope();
1191 
1193 
1195 
1196  /// \brief Retrieve the current block, if any.
1198 
1199  /// \brief Retrieve the current lambda scope info, if any.
1201 
1202  /// \brief Retrieve the current generic lambda info, if any.
1204 
1205  /// \brief Retrieve the current captured region, if any.
1207 
1208  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1210 
1211  void ActOnComment(SourceRange Comment);
1212 
1213  //===--------------------------------------------------------------------===//
1214  // Type Analysis / Processing: SemaType.cpp.
1215  //
1216 
1218  const DeclSpec *DS = nullptr);
1219  QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
1220  const DeclSpec *DS = nullptr);
1222  SourceLocation Loc, DeclarationName Entity);
1223  QualType BuildReferenceType(QualType T, bool LValueRef,
1224  SourceLocation Loc, DeclarationName Entity);
1226  Expr *ArraySize, unsigned Quals,
1227  SourceRange Brackets, DeclarationName Entity);
1228  QualType BuildExtVectorType(QualType T, Expr *ArraySize,
1229  SourceLocation AttrLoc);
1230 
1232 
1233  /// \brief Build a function type.
1234  ///
1235  /// This routine checks the function type according to C++ rules and
1236  /// under the assumption that the result type and parameter types have
1237  /// just been instantiated from a template. It therefore duplicates
1238  /// some of the behavior of GetTypeForDeclarator, but in a much
1239  /// simpler form that is only suitable for this narrow use case.
1240  ///
1241  /// \param T The return type of the function.
1242  ///
1243  /// \param ParamTypes The parameter types of the function. This array
1244  /// will be modified to account for adjustments to the types of the
1245  /// function parameters.
1246  ///
1247  /// \param Loc The location of the entity whose type involves this
1248  /// function type or, if there is no such entity, the location of the
1249  /// type that will have function type.
1250  ///
1251  /// \param Entity The name of the entity that involves the function
1252  /// type, if known.
1253  ///
1254  /// \param EPI Extra information about the function type. Usually this will
1255  /// be taken from an existing function with the same prototype.
1256  ///
1257  /// \returns A suitable function type, if there are no errors. The
1258  /// unqualified type will always be a FunctionProtoType.
1259  /// Otherwise, returns a NULL type.
1261  MutableArrayRef<QualType> ParamTypes,
1262  SourceLocation Loc, DeclarationName Entity,
1263  const FunctionProtoType::ExtProtoInfo &EPI);
1264 
1266  SourceLocation Loc,
1267  DeclarationName Entity);
1269  SourceLocation Loc, DeclarationName Entity);
1273  SourceLocation Loc);
1274 
1278  TypeSourceInfo *ReturnTypeInfo);
1279 
1280  /// \brief Package the given type and TSI into a ParsedType.
1285  TypeSourceInfo **TInfo = nullptr);
1286  CanThrowResult canThrow(const Expr *E);
1288  const FunctionProtoType *FPT);
1295  const FunctionProtoType *Old, SourceLocation OldLoc,
1296  const FunctionProtoType *New, SourceLocation NewLoc);
1298  const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1299  const FunctionProtoType *Old, SourceLocation OldLoc,
1300  const FunctionProtoType *New, SourceLocation NewLoc,
1301  bool *MissingExceptionSpecification = nullptr,
1302  bool *MissingEmptyExceptionSpecification = nullptr,
1303  bool AllowNoexceptAllMatchWithNoSpec = false,
1304  bool IsOperatorNew = false);
1306  const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1307  const FunctionProtoType *Superset, SourceLocation SuperLoc,
1308  const FunctionProtoType *Subset, SourceLocation SubLoc);
1309  bool CheckParamExceptionSpec(const PartialDiagnostic & NoteID,
1310  const FunctionProtoType *Target, SourceLocation TargetLoc,
1311  const FunctionProtoType *Source, SourceLocation SourceLoc);
1312 
1314 
1315  /// \brief The parser has parsed the context-sensitive type 'instancetype'
1316  /// in an Objective-C message declaration. Return the appropriate type.
1318 
1319  /// \brief Abstract class used to diagnose incomplete types.
1320  struct TypeDiagnoser {
1322 
1323  virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
1324  virtual ~TypeDiagnoser() {}
1325  };
1326 
1327  static int getPrintable(int I) { return I; }
1328  static unsigned getPrintable(unsigned I) { return I; }
1329  static bool getPrintable(bool B) { return B; }
1330  static const char * getPrintable(const char *S) { return S; }
1331  static StringRef getPrintable(StringRef S) { return S; }
1332  static const std::string &getPrintable(const std::string &S) { return S; }
1333  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
1334  return II;
1335  }
1337  static QualType getPrintable(QualType T) { return T; }
1338  static SourceRange getPrintable(SourceRange R) { return R; }
1339  static SourceRange getPrintable(SourceLocation L) { return L; }
1340  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
1341  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
1342 
1343  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
1344  unsigned DiagID;
1345  std::tuple<const Ts &...> Args;
1346 
1347  template <std::size_t... Is>
1348  void emit(const SemaDiagnosticBuilder &DB,
1349  llvm::index_sequence<Is...>) const {
1350  // Apply all tuple elements to the builder in order.
1351  bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1352  (void)Dummy;
1353  }
1354 
1355  public:
1356  BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
1357  : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1358  assert(DiagID != 0 && "no diagnostic for type diagnoser");
1359  }
1360 
1361  void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1362  const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1363  emit(DB, llvm::index_sequence_for<Ts...>());
1364  DB << T;
1365  }
1366  };
1367 
1368 private:
1369  bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
1370  TypeDiagnoser *Diagnoser);
1371 
1372  VisibleModuleSet VisibleModules;
1373  llvm::SmallVector<VisibleModuleSet, 16> VisibleModulesStack;
1374 
1375  Module *CachedFakeTopLevelModule;
1376 
1377 public:
1378  /// \brief Get the module owning an entity.
1379  Module *getOwningModule(Decl *Entity);
1380 
1381  /// \brief Make a merged definition of an existing hidden definition \p ND
1382  /// visible at the specified location.
1384 
1385  bool isModuleVisible(Module *M) { return VisibleModules.isVisible(M); }
1386 
1387  /// Determine whether a declaration is visible to name lookup.
1388  bool isVisible(const NamedDecl *D) {
1389  return !D->isHidden() || isVisibleSlow(D);
1390  }
1392 
1393  /// Determine if \p D has a visible definition. If not, suggest a declaration
1394  /// that should be made visible to expose the definition.
1395  bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
1396  bool OnlyNeedComplete = false);
1398  NamedDecl *Hidden;
1399  return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
1400  }
1401 
1402  /// Determine if the template parameter \p D has a visible default argument.
1403  bool
1405  llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1406 
1407  /// Determine if \p A and \p B are equivalent internal linkage declarations
1408  /// from different modules, and thus an ambiguity error can be downgraded to
1409  /// an extension warning.
1411  const NamedDecl *B);
1413  SourceLocation Loc, const NamedDecl *D,
1415 
1417  return !RequireCompleteTypeImpl(Loc, T, nullptr);
1418  }
1420  TypeDiagnoser &Diagnoser);
1422  unsigned DiagID);
1423 
1424  template <typename... Ts>
1425  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
1426  const Ts &...Args) {
1427  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1428  return RequireCompleteType(Loc, T, Diagnoser);
1429  }
1430 
1431  void completeExprArrayBound(Expr *E);
1432  bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser);
1433  bool RequireCompleteExprType(Expr *E, unsigned DiagID);
1434 
1435  template <typename... Ts>
1436  bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
1437  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1438  return RequireCompleteExprType(E, Diagnoser);
1439  }
1440 
1442  TypeDiagnoser &Diagnoser);
1443  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
1444 
1445  template <typename... Ts>
1446  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
1447  const Ts &...Args) {
1448  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1449  return RequireLiteralType(Loc, T, Diagnoser);
1450  }
1451 
1453  const CXXScopeSpec &SS, QualType T);
1454 
1456  /// If AsUnevaluated is false, E is treated as though it were an evaluated
1457  /// context, such as when building a type for decltype(auto).
1459  bool AsUnevaluated = true);
1462  SourceLocation Loc);
1463 
1464  //===--------------------------------------------------------------------===//
1465  // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
1466  //
1467 
1468  struct SkipBodyInfo {
1469  SkipBodyInfo() : ShouldSkip(false), Previous(nullptr) {}
1472  };
1473 
1474  /// List of decls defined in a function prototype. This contains EnumConstants
1475  /// that incorrectly end up in translation unit scope because there is no
1476  /// function to pin them on. ActOnFunctionDeclarator reads this list and patches
1477  /// them into the FunctionDecl.
1478  std::vector<NamedDecl*> DeclsInPrototypeScope;
1479 
1480  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
1481 
1483 
1485 
1487  Scope *S, CXXScopeSpec *SS = nullptr,
1488  bool isClassName = false,
1489  bool HasTrailingDot = false,
1490  ParsedType ObjectType = ParsedType(),
1491  bool IsCtorOrDtorName = false,
1492  bool WantNontrivialTypeSourceInfo = false,
1493  IdentifierInfo **CorrectedII = nullptr);
1495  bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
1497  SourceLocation IILoc,
1498  Scope *S,
1499  CXXScopeSpec *SS,
1500  ParsedType &SuggestedType,
1501  bool AllowClassTemplates = false);
1502 
1503  /// \brief For compatibility with MSVC, we delay parsing of some default
1504  /// template type arguments until instantiation time. Emits a warning and
1505  /// returns a synthesized DependentNameType that isn't really dependent on any
1506  /// other template arguments.
1508  SourceLocation NameLoc);
1509 
1510  /// \brief Describes the result of the name lookup and resolution performed
1511  /// by \c ClassifyName().
1522  };
1523 
1526  ExprResult Expr;
1527  TemplateName Template;
1528  ParsedType Type;
1529  const IdentifierInfo *Keyword;
1530 
1531  explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
1532 
1533  public:
1535 
1536  NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {}
1537 
1539  : Kind(NC_Keyword), Keyword(Keyword) { }
1540 
1542  return NameClassification(NC_Error);
1543  }
1544 
1547  }
1548 
1551  }
1552 
1555  Result.Template = Name;
1556  return Result;
1557  }
1558 
1561  Result.Template = Name;
1562  return Result;
1563  }
1564 
1567  Result.Template = Name;
1568  return Result;
1569  }
1570 
1572 
1574  assert(Kind == NC_Type);
1575  return Type;
1576  }
1577 
1579  assert(Kind == NC_Expression);
1580  return Expr;
1581  }
1582 
1584  assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
1585  Kind == NC_VarTemplate);
1586  return Template;
1587  }
1588 
1590  switch (Kind) {
1591  case NC_TypeTemplate:
1592  return TNK_Type_template;
1593  case NC_FunctionTemplate:
1594  return TNK_Function_template;
1595  case NC_VarTemplate:
1596  return TNK_Var_template;
1597  default:
1598  llvm_unreachable("unsupported name classification.");
1599  }
1600  }
1601  };
1602 
1603  /// \brief Perform name lookup on the given name, classifying it based on
1604  /// the results of name lookup and the following token.
1605  ///
1606  /// This routine is used by the parser to resolve identifiers and help direct
1607  /// parsing. When the identifier cannot be found, this routine will attempt
1608  /// to correct the typo and classify based on the resulting name.
1609  ///
1610  /// \param S The scope in which we're performing name lookup.
1611  ///
1612  /// \param SS The nested-name-specifier that precedes the name.
1613  ///
1614  /// \param Name The identifier. If typo correction finds an alternative name,
1615  /// this pointer parameter will be updated accordingly.
1616  ///
1617  /// \param NameLoc The location of the identifier.
1618  ///
1619  /// \param NextToken The token following the identifier. Used to help
1620  /// disambiguate the name.
1621  ///
1622  /// \param IsAddressOfOperand True if this name is the operand of a unary
1623  /// address of ('&') expression, assuming it is classified as an
1624  /// expression.
1625  ///
1626  /// \param CCC The correction callback, if typo correction is desired.
1627  NameClassification
1629  SourceLocation NameLoc, const Token &NextToken,
1630  bool IsAddressOfOperand,
1631  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr);
1632 
1634 
1636  MultiTemplateParamsArg TemplateParameterLists);
1641  SourceLocation Loc);
1642  void
1643  diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
1644  SourceLocation FallbackLoc,
1645  SourceLocation ConstQualLoc = SourceLocation(),
1646  SourceLocation VolatileQualLoc = SourceLocation(),
1647  SourceLocation RestrictQualLoc = SourceLocation(),
1648  SourceLocation AtomicQualLoc = SourceLocation());
1649 
1650  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
1651  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
1652  void CheckShadow(Scope *S, VarDecl *D, const LookupResult& R);
1653  void CheckShadow(Scope *S, VarDecl *D);
1654  void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
1655  void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
1656  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
1657  TypedefNameDecl *NewTD);
1660  TypeSourceInfo *TInfo,
1663  LookupResult &Previous, bool &Redeclaration);
1665  TypeSourceInfo *TInfo,
1667  MultiTemplateParamsArg TemplateParamLists,
1668  bool &AddToScope);
1669  // Returns true if the variable declaration is a redeclaration
1674 
1676  TypeSourceInfo *TInfo,
1678  MultiTemplateParamsArg TemplateParamLists,
1679  bool &AddToScope);
1681 
1682  bool CheckConstexprFunctionDecl(const FunctionDecl *FD);
1683  bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body);
1684 
1687  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1689  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1690  // Returns true if the function declaration is a redeclaration
1693  bool IsExplicitSpecialization);
1694  void CheckMain(FunctionDecl *FD, const DeclSpec &D);
1698  SourceLocation Loc,
1699  QualType T);
1702  QualType T, TypeSourceInfo *TSInfo,
1703  StorageClass SC);
1704  void ActOnParamDefaultArgument(Decl *param,
1705  SourceLocation EqualLoc,
1706  Expr *defarg);
1708  SourceLocation EqualLoc,
1709  SourceLocation ArgLoc);
1710  void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
1711  bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
1712  SourceLocation EqualLoc);
1713 
1714  void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit,
1715  bool TypeMayContainAuto);
1716  void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto);
1717  void ActOnInitializerError(Decl *Dcl);
1718  void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
1719  void ActOnCXXForRangeDecl(Decl *D);
1721  IdentifierInfo *Ident,
1722  ParsedAttributes &Attrs,
1723  SourceLocation AttrEnd);
1724  void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
1725  void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
1726  void FinalizeDeclaration(Decl *D);
1728  ArrayRef<Decl *> Group);
1730  bool TypeMayContainAuto = true);
1731 
1732  /// Should be called on all declarations that might have attached
1733  /// documentation comments.
1734  void ActOnDocumentableDecl(Decl *D);
1736 
1738  SourceLocation LocAfterDecls);
1740  FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
1741  SkipBodyInfo *SkipBody = nullptr);
1743  MultiTemplateParamsArg TemplateParamLists,
1744  SkipBodyInfo *SkipBody = nullptr);
1746  SkipBodyInfo *SkipBody = nullptr);
1747  void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
1749  return D && isa<ObjCMethodDecl>(D);
1750  }
1751 
1752  /// \brief Determine whether we can delay parsing the body of a function or
1753  /// function template until it is used, assuming we don't care about emitting
1754  /// code for that function.
1755  ///
1756  /// This will be \c false if we may need the body of the function in the
1757  /// middle of parsing an expression (where it's impractical to switch to
1758  /// parsing a different function), for instance, if it's constexpr in C++11
1759  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
1760  bool canDelayFunctionBody(const Declarator &D);
1761 
1762  /// \brief Determine whether we can skip parsing the body of a function
1763  /// definition, assuming we don't care about analyzing its body or emitting
1764  /// code for that function.
1765  ///
1766  /// This will be \c false only if we may need the body of the function in
1767  /// order to parse the rest of the program (for instance, if it is
1768  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
1769  bool canSkipFunctionBody(Decl *D);
1770 
1773  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
1776 
1777  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
1778  /// attribute for which parsing is delayed.
1780 
1781  /// \brief Diagnose any unused parameters in the given sequence of
1782  /// ParmVarDecl pointers.
1783  void DiagnoseUnusedParameters(ParmVarDecl * const *Begin,
1784  ParmVarDecl * const *End);
1785 
1786  /// \brief Diagnose whether the size of parameters or return value of a
1787  /// function or obj-c method definition is pass-by-value and larger than a
1788  /// specified threshold.
1790  ParmVarDecl * const *End,
1791  QualType ReturnTy,
1792  NamedDecl *D);
1793 
1794  void DiagnoseInvalidJumps(Stmt *Body);
1796  SourceLocation AsmLoc,
1797  SourceLocation RParenLoc);
1798 
1799  /// \brief Handle a C++11 empty-declaration and attribute-declaration.
1801  AttributeList *AttrList,
1802  SourceLocation SemiLoc);
1803 
1804  /// \brief The parser has processed a module import declaration.
1805  ///
1806  /// \param AtLoc The location of the '@' symbol, if any.
1807  ///
1808  /// \param ImportLoc The location of the 'import' keyword.
1809  ///
1810  /// \param Path The module access path.
1812  ModuleIdPath Path);
1813 
1814  /// \brief The parser has processed a module import translated from a
1815  /// #include or similar preprocessing directive.
1816  void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
1817 
1818  /// \brief The parsed has entered a submodule.
1819  void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
1820  /// \brief The parser has left a submodule.
1821  void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
1822 
1823  /// \brief Check if module import may be found in the current context,
1824  /// emit error if not.
1826 
1827  /// \brief Create an implicit import of the given module at the given
1828  /// source location, for error recovery, if possible.
1829  ///
1830  /// This routine is typically used when an entity found by name lookup
1831  /// is actually hidden within a module that we know about but the user
1832  /// has forgotten to import.
1834  Module *Mod);
1835 
1836  /// Kinds of missing import. Note, the values of these enumerators correspond
1837  /// to %select values in diagnostics.
1838  enum class MissingImportKind {
1839  Declaration,
1840  Definition,
1841  DefaultArgument
1842  };
1843 
1844  /// \brief Diagnose that the specified declaration needs to be visible but
1845  /// isn't, and suggest a module import that would resolve the problem.
1847  bool NeedDefinition, bool Recover = true);
1849  SourceLocation DeclLoc, ArrayRef<Module *> Modules,
1850  MissingImportKind MIK, bool Recover);
1851 
1852  /// \brief Retrieve a suitable printing policy.
1854  return getPrintingPolicy(Context, PP);
1855  }
1856 
1857  /// \brief Retrieve a suitable printing policy.
1858  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
1859  const Preprocessor &PP);
1860 
1861  /// Scope actions.
1862  void ActOnPopScope(SourceLocation Loc, Scope *S);
1864 
1866  DeclSpec &DS);
1868  DeclSpec &DS,
1869  MultiTemplateParamsArg TemplateParams,
1870  bool IsExplicitInstantiation = false);
1871 
1873  AccessSpecifier AS,
1874  RecordDecl *Record,
1875  const PrintingPolicy &Policy);
1876 
1878  RecordDecl *Record);
1879 
1881  TagTypeKind NewTag, bool isDefinition,
1882  SourceLocation NewTagLoc,
1883  const IdentifierInfo *Name);
1884 
1885  enum TagUseKind {
1886  TUK_Reference, // Reference to a tag: 'struct foo *X;'
1887  TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
1888  TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
1889  TUK_Friend // Friend declaration: 'friend struct foo;'
1890  };
1891 
1892  Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
1893  SourceLocation KWLoc, CXXScopeSpec &SS,
1896  SourceLocation ModulePrivateLoc,
1897  MultiTemplateParamsArg TemplateParameterLists,
1898  bool &OwnedDecl, bool &IsDependent,
1899  SourceLocation ScopedEnumKWLoc,
1900  bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
1901  bool IsTypeSpecifier, SkipBodyInfo *SkipBody = nullptr);
1902 
1904  unsigned TagSpec, SourceLocation TagLoc,
1905  CXXScopeSpec &SS,
1908  MultiTemplateParamsArg TempParamLists);
1909 
1911  unsigned TagSpec,
1912  TagUseKind TUK,
1913  const CXXScopeSpec &SS,
1915  SourceLocation TagLoc,
1916  SourceLocation NameLoc);
1917 
1918  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
1919  IdentifierInfo *ClassName,
1920  SmallVectorImpl<Decl *> &Decls);
1921  Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
1922  Declarator &D, Expr *BitfieldWidth);
1923 
1924  FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
1925  Declarator &D, Expr *BitfieldWidth,
1926  InClassInitStyle InitStyle,
1927  AccessSpecifier AS);
1929  SourceLocation DeclStart,
1930  Declarator &D, Expr *BitfieldWidth,
1931  InClassInitStyle InitStyle,
1932  AccessSpecifier AS,
1933  AttributeList *MSPropertyAttr);
1934 
1936  TypeSourceInfo *TInfo,
1937  RecordDecl *Record, SourceLocation Loc,
1938  bool Mutable, Expr *BitfieldWidth,
1939  InClassInitStyle InitStyle,
1940  SourceLocation TSSL,
1941  AccessSpecifier AS, NamedDecl *PrevDecl,
1942  Declarator *D = nullptr);
1943 
1944  bool CheckNontrivialField(FieldDecl *FD);
1945  void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
1947  bool Diagnose = false);
1949  void ActOnLastBitfield(SourceLocation DeclStart,
1950  SmallVectorImpl<Decl *> &AllIvarDecls);
1951  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
1952  Declarator &D, Expr *BitfieldWidth,
1953  tok::ObjCKeywordKind visibility);
1954 
1955  // This is used for both record definitions and ObjC interface declarations.
1956  void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl,
1957  ArrayRef<Decl *> Fields,
1958  SourceLocation LBrac, SourceLocation RBrac,
1959  AttributeList *AttrList);
1960 
1961  /// ActOnTagStartDefinition - Invoked when we have entered the
1962  /// scope of a tag's definition (e.g., for an enumeration, class,
1963  /// struct, or union).
1965 
1967 
1968  /// \brief Invoked when we enter a tag definition that we're skipping.
1970 
1972 
1973  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
1974  /// C++ record definition's base-specifiers clause and are starting its
1975  /// member declarations.
1977  SourceLocation FinalLoc,
1978  bool IsFinalSpelledSealed,
1979  SourceLocation LBraceLoc);
1980 
1981  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
1982  /// the definition of a tag (enumeration, class, struct, or union).
1984  SourceLocation RBraceLoc);
1985 
1987 
1989 
1990  /// \brief Invoked when we must temporarily exit the objective-c container
1991  /// scope for parsing/looking-up C constructs.
1992  ///
1993  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
1996 
1997  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
1998  /// error parsing the definition of a tag.
2000 
2002  EnumConstantDecl *LastEnumConst,
2003  SourceLocation IdLoc,
2004  IdentifierInfo *Id,
2005  Expr *val);
2007  bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
2008  QualType EnumUnderlyingTy,
2009  bool EnumUnderlyingIsImplicit,
2010  const EnumDecl *Prev);
2011 
2012  /// Determine whether the body of an anonymous enumeration should be skipped.
2013  /// \param II The name of the first enumerator.
2015  SourceLocation IILoc);
2016 
2017  Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
2018  SourceLocation IdLoc, IdentifierInfo *Id,
2019  AttributeList *Attrs,
2020  SourceLocation EqualLoc, Expr *Val);
2021  void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
2022  SourceLocation RBraceLoc, Decl *EnumDecl,
2023  ArrayRef<Decl *> Elements,
2024  Scope *S, AttributeList *Attr);
2025 
2027 
2028  /// Set the current declaration context until it gets popped.
2029  void PushDeclContext(Scope *S, DeclContext *DC);
2030  void PopDeclContext();
2031 
2032  /// EnterDeclaratorContext - Used when we must lookup names in the context
2033  /// of a declarator's nested name specifier.
2035  void ExitDeclaratorContext(Scope *S);
2036 
2037  /// Push the parameters of D, which must be a function, into scope.
2038  void ActOnReenterFunctionContext(Scope* S, Decl* D);
2039  void ActOnExitFunctionContext();
2040 
2042 
2043  /// getCurFunctionDecl - If inside of a function body, this returns a pointer
2044  /// to the function decl for the function being parsed. If we're currently
2045  /// in a 'block', this returns the containing context.
2047 
2048  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
2049  /// the method decl for the method being parsed. If we're currently
2050  /// in a 'block', this returns the containing context.
2052 
2053  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
2054  /// or C function we're in, otherwise return null. If we're currently
2055  /// in a 'block', this returns the containing context.
2057 
2058  /// Add this decl to the scope shadowed decl chains.
2059  void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
2060 
2061  /// \brief Make the given externally-produced declaration visible at the
2062  /// top level scope.
2063  ///
2064  /// \param D The externally-produced declaration to push.
2065  ///
2066  /// \param Name The name of the externally-produced declaration.
2068 
2069  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
2070  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
2071  /// true if 'D' belongs to the given declaration context.
2072  ///
2073  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
2074  /// enclosing namespace set of the context, rather than contained
2075  /// directly within it.
2076  bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
2077  bool AllowInlineNamespace = false);
2078 
2079  /// Finds the scope corresponding to the given decl context, if it
2080  /// happens to be an enclosing scope. Otherwise return NULL.
2081  static Scope *getScopeForDeclContext(Scope *S, DeclContext *DC);
2082 
2083  /// Subroutines of ActOnDeclarator().
2085  TypeSourceInfo *TInfo);
2087 
2088  /// \brief Describes the kind of merge to perform for availability
2089  /// attributes (including "deprecated", "unavailable", and "availability").
2091  /// \brief Don't merge availability attributes at all.
2093  /// \brief Merge availability attributes for a redeclaration, which requires
2094  /// an exact match.
2096  /// \brief Merge availability attributes for an override, which requires
2097  /// an exact match or a weakening of constraints.
2099  /// \brief Merge availability attributes for an implementation of
2100  /// a protocol requirement.
2102  };
2103 
2104  /// Attribute merging methods. Return true if a new attribute was added.
2105  AvailabilityAttr *mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
2106  IdentifierInfo *Platform,
2107  VersionTuple Introduced,
2108  VersionTuple Deprecated,
2109  VersionTuple Obsoleted,
2110  bool IsUnavailable,
2111  StringRef Message,
2113  unsigned AttrSpellingListIndex);
2114  TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
2115  TypeVisibilityAttr::VisibilityType Vis,
2116  unsigned AttrSpellingListIndex);
2117  VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range,
2118  VisibilityAttr::VisibilityType Vis,
2119  unsigned AttrSpellingListIndex);
2120  DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
2121  unsigned AttrSpellingListIndex);
2122  DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
2123  unsigned AttrSpellingListIndex);
2124  MSInheritanceAttr *
2125  mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
2126  unsigned AttrSpellingListIndex,
2127  MSInheritanceAttr::Spelling SemanticSpelling);
2128  FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range,
2129  IdentifierInfo *Format, int FormatIdx,
2130  int FirstArg, unsigned AttrSpellingListIndex);
2131  SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
2132  unsigned AttrSpellingListIndex);
2133  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
2134  IdentifierInfo *Ident,
2135  unsigned AttrSpellingListIndex);
2136  MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
2137  unsigned AttrSpellingListIndex);
2138  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
2139  unsigned AttrSpellingListIndex);
2140  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, SourceRange Range,
2141  IdentifierInfo *Ident,
2142  unsigned AttrSpellingListIndex);
2143  CommonAttr *mergeCommonAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident,
2144  unsigned AttrSpellingListIndex);
2145 
2146  void mergeDeclAttributes(NamedDecl *New, Decl *Old,
2149  LookupResult &OldDecls);
2150  bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
2151  bool MergeTypeWithOld);
2153  Scope *S, bool MergeTypeWithOld);
2156  void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
2157  void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
2158  bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
2159 
2160  // AssignmentAction - This is used by all the assignment diagnostic functions
2161  // to represent what is actually causing the operation
2171  };
2172 
2173  /// C++ Overloading.
2175  /// This is a legitimate overload: the existing declarations are
2176  /// functions or function templates with different signatures.
2178 
2179  /// This is not an overload because the signature exactly matches
2180  /// an existing declaration.
2182 
2183  /// This is not an overload because the lookup results contain a
2184  /// non-function.
2186  };
2188  FunctionDecl *New,
2189  const LookupResult &OldDecls,
2190  NamedDecl *&OldDecl,
2191  bool IsForUsingDecl);
2192  bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl);
2193 
2194  /// \brief Checks availability of the function depending on the current
2195  /// function context.Inside an unavailable function,unavailability is ignored.
2196  ///
2197  /// \returns true if \p FD is unavailable and current context is inside
2198  /// an available function, false otherwise.
2200 
2202  TryImplicitConversion(Expr *From, QualType ToType,
2203  bool SuppressUserConversions,
2204  bool AllowExplicit,
2205  bool InOverloadResolution,
2206  bool CStyle,
2207  bool AllowObjCWritebackConversion);
2208 
2209  bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
2210  bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
2211  bool IsComplexPromotion(QualType FromType, QualType ToType);
2212  bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
2213  bool InOverloadResolution,
2214  QualType& ConvertedType, bool &IncompatibleObjC);
2215  bool isObjCPointerConversion(QualType FromType, QualType ToType,
2216  QualType& ConvertedType, bool &IncompatibleObjC);
2217  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
2218  QualType &ConvertedType);
2219  bool IsBlockPointerConversion(QualType FromType, QualType ToType,
2220  QualType& ConvertedType);
2221  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
2222  const FunctionProtoType *NewType,
2223  unsigned *ArgPos = nullptr);
2225  QualType FromType, QualType ToType);
2226 
2229  bool CheckPointerConversion(Expr *From, QualType ToType,
2230  CastKind &Kind,
2231  CXXCastPath& BasePath,
2232  bool IgnoreBaseAccess,
2233  bool Diagnose = true);
2234  bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
2235  bool InOverloadResolution,
2236  QualType &ConvertedType);
2237  bool CheckMemberPointerConversion(Expr *From, QualType ToType,
2238  CastKind &Kind,
2239  CXXCastPath &BasePath,
2240  bool IgnoreBaseAccess);
2241  bool IsQualificationConversion(QualType FromType, QualType ToType,
2242  bool CStyle, bool &ObjCLifetimeConversion);
2243  bool IsNoReturnConversion(QualType FromType, QualType ToType,
2244  QualType &ResultTy);
2247 
2249  const VarDecl *NRVOCandidate,
2250  QualType ResultType,
2251  Expr *Value,
2252  bool AllowNRVO = true);
2253 
2255  ExprResult Init);
2257  SourceLocation EqualLoc,
2258  ExprResult Init,
2259  bool TopLevelOfInitList = false,
2260  bool AllowExplicit = false);
2262  NestedNameSpecifier *Qualifier,
2263  NamedDecl *FoundDecl,
2264  CXXMethodDecl *Method);
2265 
2268 
2269  /// Contexts in which a converted constant expression is required.
2270  enum CCEKind {
2271  CCEK_CaseValue, ///< Expression in a case label.
2272  CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
2273  CCEK_TemplateArg, ///< Value of a non-type template parameter.
2274  CCEK_NewExpr ///< Constant expression in a noptr-new-declarator.
2275  };
2277  llvm::APSInt &Value, CCEKind CCE);
2279  APValue &Value, CCEKind CCE);
2280 
2281  /// \brief Abstract base class used to perform a contextual implicit
2282  /// conversion from an expression to any type passing a filter.
2284  public:
2285  bool Suppress;
2287 
2288  ContextualImplicitConverter(bool Suppress = false,
2289  bool SuppressConversion = false)
2290  : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
2291 
2292  /// \brief Determine whether the specified type is a valid destination type
2293  /// for this conversion.
2294  virtual bool match(QualType T) = 0;
2295 
2296  /// \brief Emits a diagnostic complaining that the expression does not have
2297  /// integral or enumeration type.
2298  virtual SemaDiagnosticBuilder
2299  diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) = 0;
2300 
2301  /// \brief Emits a diagnostic when the expression has incomplete class type.
2302  virtual SemaDiagnosticBuilder
2303  diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0;
2304 
2305  /// \brief Emits a diagnostic when the only matching conversion function
2306  /// is explicit.
2307  virtual SemaDiagnosticBuilder diagnoseExplicitConv(
2308  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2309 
2310  /// \brief Emits a note for the explicit conversion function.
2311  virtual SemaDiagnosticBuilder
2312  noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2313 
2314  /// \brief Emits a diagnostic when there are multiple possible conversion
2315  /// functions.
2316  virtual SemaDiagnosticBuilder
2317  diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) = 0;
2318 
2319  /// \brief Emits a note for one of the candidate conversions.
2320  virtual SemaDiagnosticBuilder
2321  noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2322 
2323  /// \brief Emits a diagnostic when we picked a conversion function
2324  /// (for cases when we are not allowed to pick a conversion function).
2325  virtual SemaDiagnosticBuilder diagnoseConversion(
2326  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2327 
2329  };
2330 
2332  bool AllowScopedEnumerations;
2333 
2334  public:
2335  ICEConvertDiagnoser(bool AllowScopedEnumerations,
2336  bool Suppress, bool SuppressConversion)
2337  : ContextualImplicitConverter(Suppress, SuppressConversion),
2338  AllowScopedEnumerations(AllowScopedEnumerations) {}
2339 
2340  /// Match an integral or (possibly scoped) enumeration type.
2341  bool match(QualType T) override;
2342 
2345  return diagnoseNotInt(S, Loc, T);
2346  }
2347 
2348  /// \brief Emits a diagnostic complaining that the expression does not have
2349  /// integral or enumeration type.
2350  virtual SemaDiagnosticBuilder
2351  diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0;
2352  };
2353 
2354  /// Perform a contextual implicit conversion.
2356  SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
2357 
2358 
2363  };
2365 
2366  // Note that LK_String is intentionally after the other literals, as
2367  // this is used for diagnostics logic.
2376  };
2378 
2380  NestedNameSpecifier *Qualifier,
2381  NamedDecl *FoundDecl,
2382  NamedDecl *Member);
2383 
2384  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
2385  // TODO: make this is a typesafe union.
2386  typedef llvm::SmallPtrSet<DeclContext *, 16> AssociatedNamespaceSet;
2387  typedef llvm::SmallPtrSet<CXXRecordDecl *, 16> AssociatedClassSet;
2388 
2389  void AddOverloadCandidate(FunctionDecl *Function,
2390  DeclAccessPair FoundDecl,
2391  ArrayRef<Expr *> Args,
2392  OverloadCandidateSet& CandidateSet,
2393  bool SuppressUserConversions = false,
2394  bool PartialOverloading = false,
2395  bool AllowExplicit = false);
2396  void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
2397  ArrayRef<Expr *> Args,
2398  OverloadCandidateSet &CandidateSet,
2399  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
2400  bool SuppressUserConversions = false,
2401  bool PartialOverloading = false);
2402  void AddMethodCandidate(DeclAccessPair FoundDecl,
2403  QualType ObjectType,
2404  Expr::Classification ObjectClassification,
2405  ArrayRef<Expr *> Args,
2406  OverloadCandidateSet& CandidateSet,
2407  bool SuppressUserConversion = false);
2408  void AddMethodCandidate(CXXMethodDecl *Method,
2409  DeclAccessPair FoundDecl,
2410  CXXRecordDecl *ActingContext, QualType ObjectType,
2411  Expr::Classification ObjectClassification,
2412  ArrayRef<Expr *> Args,
2413  OverloadCandidateSet& CandidateSet,
2414  bool SuppressUserConversions = false,
2415  bool PartialOverloading = false);
2417  DeclAccessPair FoundDecl,
2418  CXXRecordDecl *ActingContext,
2419  TemplateArgumentListInfo *ExplicitTemplateArgs,
2420  QualType ObjectType,
2421  Expr::Classification ObjectClassification,
2422  ArrayRef<Expr *> Args,
2423  OverloadCandidateSet& CandidateSet,
2424  bool SuppressUserConversions = false,
2425  bool PartialOverloading = false);
2426  void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
2427  DeclAccessPair FoundDecl,
2428  TemplateArgumentListInfo *ExplicitTemplateArgs,
2429  ArrayRef<Expr *> Args,
2430  OverloadCandidateSet& CandidateSet,
2431  bool SuppressUserConversions = false,
2432  bool PartialOverloading = false);
2433  void AddConversionCandidate(CXXConversionDecl *Conversion,
2434  DeclAccessPair FoundDecl,
2435  CXXRecordDecl *ActingContext,
2436  Expr *From, QualType ToType,
2437  OverloadCandidateSet& CandidateSet,
2438  bool AllowObjCConversionOnExplicit);
2440  DeclAccessPair FoundDecl,
2441  CXXRecordDecl *ActingContext,
2442  Expr *From, QualType ToType,
2443  OverloadCandidateSet &CandidateSet,
2444  bool AllowObjCConversionOnExplicit);
2445  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
2446  DeclAccessPair FoundDecl,
2447  CXXRecordDecl *ActingContext,
2448  const FunctionProtoType *Proto,
2449  Expr *Object, ArrayRef<Expr *> Args,
2450  OverloadCandidateSet& CandidateSet);
2452  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2453  OverloadCandidateSet& CandidateSet,
2454  SourceRange OpRange = SourceRange());
2455  void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
2456  ArrayRef<Expr *> Args,
2457  OverloadCandidateSet& CandidateSet,
2458  bool IsAssignmentOperator = false,
2459  unsigned NumContextualBoolArguments = 0);
2461  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2462  OverloadCandidateSet& CandidateSet);
2464  SourceLocation Loc,
2465  ArrayRef<Expr *> Args,
2466  TemplateArgumentListInfo *ExplicitTemplateArgs,
2467  OverloadCandidateSet& CandidateSet,
2468  bool PartialOverloading = false);
2469 
2470  // Emit as a 'note' the specific overload candidate
2471  void NoteOverloadCandidate(FunctionDecl *Fn, QualType DestType = QualType(),
2472  bool TakingAddress = false);
2473 
2474  // Emit as a series of 'note's all template and non-templates identified by
2475  // the expression Expr
2476  void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
2477  bool TakingAddress = false);
2478 
2479  /// Check the enable_if expressions on the given function. Returns the first
2480  /// failing attribute, or NULL if they were all successful.
2481  EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
2482  bool MissingImplicitThis = false);
2483 
2484  /// Returns whether the given function's address can be taken or not,
2485  /// optionally emitting a diagnostic if the address can't be taken.
2486  ///
2487  /// Returns false if taking the address of the function is illegal.
2488  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
2489  bool Complain = false,
2490  SourceLocation Loc = SourceLocation());
2491 
2492  // [PossiblyAFunctionType] --> [Return]
2493  // NonFunctionType --> NonFunctionType
2494  // R (A) --> R(A)
2495  // R (*)(A) --> R (A)
2496  // R (&)(A) --> R (A)
2497  // R (S::*)(A) --> R (A)
2498  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
2499 
2500  FunctionDecl *
2502  QualType TargetType,
2503  bool Complain,
2504  DeclAccessPair &Found,
2505  bool *pHadMultipleCandidates = nullptr);
2506 
2507  FunctionDecl *
2509  bool Complain = false,
2510  DeclAccessPair *Found = nullptr);
2511 
2513  ExprResult &SrcExpr,
2514  bool DoFunctionPointerConverion = false,
2515  bool Complain = false,
2516  SourceRange OpRangeForComplaining = SourceRange(),
2517  QualType DestTypeForComplaining = QualType(),
2518  unsigned DiagIDForComplaining = 0);
2519 
2520 
2522  DeclAccessPair FoundDecl,
2523  FunctionDecl *Fn);
2525  DeclAccessPair FoundDecl,
2526  FunctionDecl *Fn);
2527 
2529  ArrayRef<Expr *> Args,
2530  OverloadCandidateSet &CandidateSet,
2531  bool PartialOverloading = false);
2532 
2533  // An enum used to represent the different possible results of building a
2534  // range-based for loop.
2539  };
2540 
2542  SourceLocation RangeLoc,
2543  const DeclarationNameInfo &NameInfo,
2544  LookupResult &MemberLookup,
2545  OverloadCandidateSet *CandidateSet,
2546  Expr *Range, ExprResult *CallExpr);
2547 
2549  UnresolvedLookupExpr *ULE,
2550  SourceLocation LParenLoc,
2551  MultiExprArg Args,
2552  SourceLocation RParenLoc,
2553  Expr *ExecConfig,
2554  bool AllowTypoCorrection=true,
2555  bool CalleesAddressIsTaken=false);
2556 
2558  MultiExprArg Args, SourceLocation RParenLoc,
2559  OverloadCandidateSet *CandidateSet,
2560  ExprResult *Result);
2561 
2563  UnaryOperatorKind Opc,
2564  const UnresolvedSetImpl &Fns,
2565  Expr *input);
2566 
2568  BinaryOperatorKind Opc,
2569  const UnresolvedSetImpl &Fns,
2570  Expr *LHS, Expr *RHS);
2571 
2573  SourceLocation RLoc,
2574  Expr *Base,Expr *Idx);
2575 
2576  ExprResult
2577  BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
2578  SourceLocation LParenLoc,
2579  MultiExprArg Args,
2580  SourceLocation RParenLoc);
2581  ExprResult
2582  BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc,
2583  MultiExprArg Args,
2584  SourceLocation RParenLoc);
2585 
2587  SourceLocation OpLoc,
2588  bool *NoArrowOperatorFound = nullptr);
2589 
2590  /// CheckCallReturnType - Checks that a call expression's return type is
2591  /// complete. Returns true on failure. The location passed in is the location
2592  /// that best represents the call.
2593  bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
2594  CallExpr *CE, FunctionDecl *FD);
2595 
2596  /// Helpers for dealing with blocks and functions.
2597  bool CheckParmsForFunctionDef(ParmVarDecl *const *Param,
2598  ParmVarDecl *const *ParamEnd,
2599  bool CheckParameterNames);
2603 
2604  /// \name Name lookup
2605  ///
2606  /// These routines provide name lookup that is used during semantic
2607  /// analysis to resolve the various kinds of names (identifiers,
2608  /// overloaded operator names, constructor names, etc.) into zero or
2609  /// more declarations within a particular scope. The major entry
2610  /// points are LookupName, which performs unqualified name lookup,
2611  /// and LookupQualifiedName, which performs qualified name lookup.
2612  ///
2613  /// All name lookup is performed based on some specific criteria,
2614  /// which specify what names will be visible to name lookup and how
2615  /// far name lookup should work. These criteria are important both
2616  /// for capturing language semantics (certain lookups will ignore
2617  /// certain names, for example) and for performance, since name
2618  /// lookup is often a bottleneck in the compilation of C++. Name
2619  /// lookup criteria is specified via the LookupCriteria enumeration.
2620  ///
2621  /// The results of name lookup can vary based on the kind of name
2622  /// lookup performed, the current language, and the translation
2623  /// unit. In C, for example, name lookup will either return nothing
2624  /// (no entity found) or a single declaration. In C++, name lookup
2625  /// can additionally refer to a set of overloaded functions or
2626  /// result in an ambiguity. All of the possible results of name
2627  /// lookup are captured by the LookupResult class, which provides
2628  /// the ability to distinguish among them.
2629  //@{
2630 
2631  /// @brief Describes the kind of name lookup to perform.
2633  /// Ordinary name lookup, which finds ordinary names (functions,
2634  /// variables, typedefs, etc.) in C and most kinds of names
2635  /// (functions, variables, members, types, etc.) in C++.
2637  /// Tag name lookup, which finds the names of enums, classes,
2638  /// structs, and unions.
2640  /// Label name lookup.
2642  /// Member name lookup, which finds the names of
2643  /// class/struct/union members.
2645  /// Look up of an operator name (e.g., operator+) for use with
2646  /// operator overloading. This lookup is similar to ordinary name
2647  /// lookup, but will ignore any declarations that are class members.
2649  /// Look up of a name that precedes the '::' scope resolution
2650  /// operator in C++. This lookup completely ignores operator, object,
2651  /// function, and enumerator names (C++ [basic.lookup.qual]p1).
2653  /// Look up a namespace name within a C++ using directive or
2654  /// namespace alias definition, ignoring non-namespace names (C++
2655  /// [basic.lookup.udir]p1).
2657  /// Look up all declarations in a scope with the given name,
2658  /// including resolved using declarations. This is appropriate
2659  /// for checking redeclarations for a using declaration.
2661  /// Look up an ordinary name that is going to be redeclared as a
2662  /// name with linkage. This lookup ignores any declarations that
2663  /// are outside of the current scope unless they have linkage. See
2664  /// C99 6.2.2p4-5 and C++ [basic.link]p6.
2666  /// Look up a friend of a local class. This lookup does not look
2667  /// outside the innermost non-class scope. See C++11 [class.friend]p11.
2669  /// Look up the name of an Objective-C protocol.
2671  /// Look up implicit 'self' parameter of an objective-c method.
2673  /// \brief Look up any declaration with any name.
2675  };
2676 
2677  /// \brief Specifies whether (or how) name lookup is being performed for a
2678  /// redeclaration (vs. a reference).
2680  /// \brief The lookup is a reference to this name that is not for the
2681  /// purpose of redeclaring the name.
2683  /// \brief The lookup results will be used for redeclaration of a name,
2684  /// if an entity by that name already exists.
2686  };
2687 
2688  /// \brief The possible outcomes of name lookup for a literal operator.
2690  /// \brief The lookup resulted in an error.
2692  /// \brief The lookup found a single 'cooked' literal operator, which
2693  /// expects a normal literal to be built and passed to it.
2695  /// \brief The lookup found a single 'raw' literal operator, which expects
2696  /// a string literal containing the spelling of the literal token.
2698  /// \brief The lookup found an overload set of literal operator templates,
2699  /// which expect the characters of the spelling of the literal token to be
2700  /// passed as a non-type template argument pack.
2702  /// \brief The lookup found an overload set of literal operator templates,
2703  /// which expect the character type and characters of the spelling of the
2704  /// string literal token to be passed as template arguments.
2706  };
2707 
2708  SpecialMemberOverloadResult *LookupSpecialMember(CXXRecordDecl *D,
2710  bool ConstArg,
2711  bool VolatileArg,
2712  bool RValueThis,
2713  bool ConstThis,
2714  bool VolatileThis);
2715 
2716  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
2717  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
2719 
2720 private:
2721  bool CppLookupName(LookupResult &R, Scope *S);
2722 
2723  struct TypoExprState {
2724  std::unique_ptr<TypoCorrectionConsumer> Consumer;
2725  TypoDiagnosticGenerator DiagHandler;
2726  TypoRecoveryCallback RecoveryHandler;
2727  TypoExprState();
2728  TypoExprState(TypoExprState&& other) LLVM_NOEXCEPT;
2729  TypoExprState& operator=(TypoExprState&& other) LLVM_NOEXCEPT;
2730  };
2731 
2732  /// \brief The set of unhandled TypoExprs and their associated state.
2733  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
2734 
2735  /// \brief Creates a new TypoExpr AST node.
2736  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
2738  TypoRecoveryCallback TRC);
2739 
2740  // \brief The set of known/encountered (unique, canonicalized) NamespaceDecls.
2741  //
2742  // The boolean value will be true to indicate that the namespace was loaded
2743  // from an AST/PCH file, or false otherwise.
2744  llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
2745 
2746  /// \brief Whether we have already loaded known namespaces from an extenal
2747  /// source.
2748  bool LoadedExternalKnownNamespaces;
2749 
2750  /// \brief Helper for CorrectTypo and CorrectTypoDelayed used to create and
2751  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
2752  /// should be skipped entirely.
2753  std::unique_ptr<TypoCorrectionConsumer>
2754  makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
2755  Sema::LookupNameKind LookupKind, Scope *S,
2756  CXXScopeSpec *SS,
2757  std::unique_ptr<CorrectionCandidateCallback> CCC,
2758  DeclContext *MemberContext, bool EnteringContext,
2759  const ObjCObjectPointerType *OPT,
2760  bool ErrorRecovery);
2761 
2762 public:
2763  const TypoExprState &getTypoExprState(TypoExpr *TE) const;
2764 
2765  /// \brief Clears the state of the given TypoExpr.
2766  void clearDelayedTypo(TypoExpr *TE);
2767 
2768  /// \brief Look up a name, looking for a single declaration. Return
2769  /// null if the results were absent, ambiguous, or overloaded.
2770  ///
2771  /// It is preferable to use the elaborated form and explicitly handle
2772  /// ambiguity and overloaded.
2774  SourceLocation Loc,
2775  LookupNameKind NameKind,
2776  RedeclarationKind Redecl
2778  bool LookupName(LookupResult &R, Scope *S,
2779  bool AllowBuiltinCreation = false);
2780  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2781  bool InUnqualifiedLookup = false);
2782  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2783  CXXScopeSpec &SS);
2785  bool AllowBuiltinCreation = false,
2786  bool EnteringContext = false);
2788  RedeclarationKind Redecl
2789  = NotForRedeclaration);
2790  bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
2791 
2793  QualType T1, QualType T2,
2794  UnresolvedSetImpl &Functions);
2796  DeclAccessPair Operator,
2797  QualType T1, QualType T2);
2798 
2800  SourceLocation GnuLabelLoc = SourceLocation());
2801 
2805  unsigned Quals);
2806  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
2807  bool RValueThis, unsigned ThisQuals);
2809  unsigned Quals);
2810  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
2811  bool RValueThis, unsigned ThisQuals);
2813 
2814  bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id);
2816  ArrayRef<QualType> ArgTys,
2817  bool AllowRaw,
2818  bool AllowTemplate,
2819  bool AllowStringTemplate);
2820  bool isKnownName(StringRef name);
2821 
2822  void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
2823  ArrayRef<Expr *> Args, ADLResult &Functions);
2824 
2827  bool IncludeGlobalScope = true);
2829  VisibleDeclConsumer &Consumer,
2830  bool IncludeGlobalScope = true);
2831 
2833  CTK_NonError, // CorrectTypo used in a non error recovery situation.
2834  CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
2835  };
2836 
2838  Sema::LookupNameKind LookupKind,
2839  Scope *S, CXXScopeSpec *SS,
2840  std::unique_ptr<CorrectionCandidateCallback> CCC,
2841  CorrectTypoKind Mode,
2842  DeclContext *MemberContext = nullptr,
2843  bool EnteringContext = false,
2844  const ObjCObjectPointerType *OPT = nullptr,
2845  bool RecordFailure = true);
2846 
2848  Sema::LookupNameKind LookupKind, Scope *S,
2849  CXXScopeSpec *SS,
2850  std::unique_ptr<CorrectionCandidateCallback> CCC,
2853  DeclContext *MemberContext = nullptr,
2854  bool EnteringContext = false,
2855  const ObjCObjectPointerType *OPT = nullptr);
2856 
2857  /// \brief Process any TypoExprs in the given Expr and its children,
2858  /// generating diagnostics as appropriate and returning a new Expr if there
2859  /// were typos that were all successfully corrected and ExprError if one or
2860  /// more typos could not be corrected.
2861  ///
2862  /// \param E The Expr to check for TypoExprs.
2863  ///
2864  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
2865  /// initializer.
2866  ///
2867  /// \param Filter A function applied to a newly rebuilt Expr to determine if
2868  /// it is an acceptable/usable result from a single combination of typo
2869  /// corrections. As long as the filter returns ExprError, different
2870  /// combinations of corrections will be tried until all are exhausted.
2871  ExprResult
2872  CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl = nullptr,
2873  llvm::function_ref<ExprResult(Expr *)> Filter =
2874  [](Expr *E) -> ExprResult { return E; });
2875 
2876  ExprResult
2878  llvm::function_ref<ExprResult(Expr *)> Filter) {
2879  return CorrectDelayedTyposInExpr(E, nullptr, Filter);
2880  }
2881 
2882  ExprResult
2884  llvm::function_ref<ExprResult(Expr *)> Filter =
2885  [](Expr *E) -> ExprResult { return E; }) {
2886  return ER.isInvalid() ? ER : CorrectDelayedTyposInExpr(ER.get(), Filter);
2887  }
2888 
2889  ExprResult
2891  llvm::function_ref<ExprResult(Expr *)> Filter) {
2892  return CorrectDelayedTyposInExpr(ER, nullptr, Filter);
2893  }
2894 
2895  void diagnoseTypo(const TypoCorrection &Correction,
2896  const PartialDiagnostic &TypoDiag,
2897  bool ErrorRecovery = true);
2898 
2899  void diagnoseTypo(const TypoCorrection &Correction,
2900  const PartialDiagnostic &TypoDiag,
2901  const PartialDiagnostic &PrevNote,
2902  bool ErrorRecovery = true);
2903 
2904  void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
2905  ArrayRef<Expr *> Args,
2906  AssociatedNamespaceSet &AssociatedNamespaces,
2907  AssociatedClassSet &AssociatedClasses);
2908 
2910  bool ConsiderLinkage, bool AllowInlineNamespace);
2911 
2913  //@}
2914 
2916  SourceLocation IdLoc,
2917  bool TypoCorrection = false);
2919  Scope *S, bool ForRedeclaration,
2920  SourceLocation Loc);
2922  Scope *S);
2924 
2925  // More parsing and symbol table subroutines.
2926 
2927  void ProcessPragmaWeak(Scope *S, Decl *D);
2928  // Decl attributes - this routine is the top level dispatcher.
2929  void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
2930  void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL,
2931  bool IncludeCXX11Attributes = true);
2933  const AttributeList *AttrList);
2934 
2936 
2937  /// Determine if type T is a valid subject for a nonnull and similar
2938  /// attributes. By default, we look through references (the behavior used by
2939  /// nonnull), but if the second parameter is true, then we treat a reference
2940  /// type as valid.
2941  bool isValidPointerAttrType(QualType T, bool RefOkay = false);
2942 
2943  bool CheckRegparmAttr(const AttributeList &attr, unsigned &value);
2944  bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
2945  const FunctionDecl *FD = nullptr);
2946  bool CheckNoReturnAttr(const AttributeList &attr);
2948  unsigned ArgNum, StringRef &Str,
2949  SourceLocation *ArgLocation = nullptr);
2950  bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
2951  void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
2953  CXXRecordDecl *RD, SourceRange Range, bool BestCase,
2954  MSInheritanceAttr::Spelling SemanticSpelling);
2955 
2957 
2958  /// Adjust the calling convention of a method to be the ABI default if it
2959  /// wasn't specified explicitly. This handles method types formed from
2960  /// function type typedefs and typename template arguments.
2961  void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
2962  SourceLocation Loc);
2963 
2964  // Check if there is an explicit attribute, but only look through parens.
2965  // The intent is to look for an attribute on the current declarator, but not
2966  // one that came from a typedef.
2968 
2969  /// Get the outermost AttributedType node that sets a calling convention.
2970  /// Valid types should not have multiple attributes with different CCs.
2972 
2973  /// Check whether a nullability type specifier can be added to the given
2974  /// type.
2975  ///
2976  /// \param type The type to which the nullability specifier will be
2977  /// added. On success, this type will be updated appropriately.
2978  ///
2979  /// \param nullability The nullability specifier to add.
2980  ///
2981  /// \param nullabilityLoc The location of the nullability specifier.
2982  ///
2983  /// \param isContextSensitive Whether this nullability specifier was
2984  /// written as a context-sensitive keyword (in an Objective-C
2985  /// method) or an Objective-C property attribute, rather than as an
2986  /// underscored type specifier.
2987  ///
2988  /// \returns true if nullability cannot be applied, false otherwise.
2990  SourceLocation nullabilityLoc,
2991  bool isContextSensitive);
2992 
2993  /// \brief Stmt attributes - this routine is the top level dispatcher.
2995  SourceRange Range);
2996 
2998  ObjCMethodDecl *MethodDecl,
2999  bool IsProtocolMethodDecl);
3000 
3002  ObjCMethodDecl *Overridden,
3003  bool IsProtocolMethodDecl);
3004 
3005  /// WarnExactTypedMethods - This routine issues a warning if method
3006  /// implementation declaration matches exactly that of its declaration.
3008  ObjCMethodDecl *MethodDecl,
3009  bool IsProtocolMethodDecl);
3010 
3011  typedef llvm::SmallPtrSet<Selector, 8> SelectorSet;
3012  typedef llvm::DenseMap<Selector, ObjCMethodDecl*> ProtocolsMethodsMap;
3013 
3014  /// CheckImplementationIvars - This routine checks if the instance variables
3015  /// listed in the implelementation match those listed in the interface.
3017  ObjCIvarDecl **Fields, unsigned nIvars,
3018  SourceLocation Loc);
3019 
3020  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
3021  /// remains unimplemented in the class or category \@implementation.
3022  void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl,
3023  ObjCContainerDecl* IDecl,
3024  bool IncompleteImpl = false);
3025 
3026  /// DiagnoseUnimplementedProperties - This routine warns on those properties
3027  /// which must be implemented by this implementation.
3029  ObjCContainerDecl *CDecl,
3030  bool SynthesizeProperties);
3031 
3032  /// Diagnose any null-resettable synthesized setters.
3034 
3035  /// DefaultSynthesizeProperties - This routine default synthesizes all
3036  /// properties which must be synthesized in the class's \@implementation.
3037  void DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl,
3038  ObjCInterfaceDecl *IDecl);
3039  void DefaultSynthesizeProperties(Scope *S, Decl *D);
3040 
3041  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
3042  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
3043  /// declared in class 'IFace'.
3045  ObjCMethodDecl *Method, ObjCIvarDecl *IV);
3046 
3047  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
3048  /// backs the property is not used in the property's accessor.
3050  const ObjCImplementationDecl *ImplD);
3051 
3052  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
3053  /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
3054  /// It also returns ivar's property on success.
3056  const ObjCPropertyDecl *&PDecl) const;
3057 
3058  /// Called by ActOnProperty to handle \@property declarations in
3059  /// class extensions.
3061  SourceLocation AtLoc,
3062  SourceLocation LParenLoc,
3063  FieldDeclarator &FD,
3064  Selector GetterSel,
3065  Selector SetterSel,
3066  const bool isReadWrite,
3067  unsigned &Attributes,
3068  const unsigned AttributesAsWritten,
3069  QualType T,
3070  TypeSourceInfo *TSI,
3071  tok::ObjCKeywordKind MethodImplKind);
3072 
3073  /// Called by ActOnProperty and HandlePropertyInClassExtension to
3074  /// handle creating the ObjcPropertyDecl for a category or \@interface.
3076  ObjCContainerDecl *CDecl,
3077  SourceLocation AtLoc,
3078  SourceLocation LParenLoc,
3079  FieldDeclarator &FD,
3080  Selector GetterSel,
3081  Selector SetterSel,
3082  const bool isReadWrite,
3083  const unsigned Attributes,
3084  const unsigned AttributesAsWritten,
3085  QualType T,
3086  TypeSourceInfo *TSI,
3087  tok::ObjCKeywordKind MethodImplKind,
3088  DeclContext *lexicalDC = nullptr);
3089 
3090  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
3091  /// warning) when atomic property has one but not the other user-declared
3092  /// setter or getter.
3094  ObjCInterfaceDecl* IDecl);
3095 
3097 
3099  const ObjCImplementationDecl *ImplD,
3100  const ObjCInterfaceDecl *IFD);
3101 
3103 
3107  };
3108 
3109  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
3110  /// true, or false, accordingly.
3111  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
3112  const ObjCMethodDecl *PrevMethod,
3113  MethodMatchStrategy strategy = MMS_strict);
3114 
3115  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
3116  /// or protocol against those declared in their implementations.
3117  void MatchAllMethodDeclarations(const SelectorSet &InsMap,
3118  const SelectorSet &ClsMap,
3119  SelectorSet &InsMapSeen,
3120  SelectorSet &ClsMapSeen,
3121  ObjCImplDecl* IMPDecl,
3122  ObjCContainerDecl* IDecl,
3123  bool &IncompleteImpl,
3124  bool ImmediateClass,
3125  bool WarnCategoryMethodImpl=false);
3126 
3127  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
3128  /// category matches with those implemented in its primary class and
3129  /// warns each time an exact match is found.
3131 
3132  /// \brief Add the given method to the list of globally-known methods.
3134 
3135 private:
3136  /// AddMethodToGlobalPool - Add an instance or factory method to the global
3137  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
3138  void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
3139 
3140  /// LookupMethodInGlobalPool - Returns the instance or factory method and
3141  /// optionally warns if there are multiple signatures.
3142  ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
3143  bool receiverIdOrClass,
3144  bool instance);
3145 
3146 public:
3147  /// \brief - Returns instance or factory methods in global method pool for
3148  /// given selector. If no such method or only one method found, function returns
3149  /// false; otherwise, it returns true
3152  bool instance);
3153 
3155  SourceRange R,
3156  bool receiverIdOrClass);
3157 
3159  Selector Sel, SourceRange R,
3160  bool receiverIdOrClass);
3161 
3162 private:
3163  /// \brief - Returns a selector which best matches given argument list or
3164  /// nullptr if none could be found
3165  ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
3166  bool IsInstance);
3167 
3168 
3169  /// \brief Record the typo correction failure and return an empty correction.
3170  TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
3171  bool RecordFailure = true) {
3172  if (RecordFailure)
3173  TypoCorrectionFailures[Typo].insert(TypoLoc);
3174  return TypoCorrection();
3175  }
3176 
3177 public:
3178  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
3179  /// unit are added to a global pool. This allows us to efficiently associate
3180  /// a selector with a method declaraation for purposes of typechecking
3181  /// messages sent to "id" (where the class of the object is unknown).
3182  void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3183  AddMethodToGlobalPool(Method, impl, /*instance*/true);
3184  }
3185 
3186  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
3187  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3188  AddMethodToGlobalPool(Method, impl, /*instance*/false);
3189  }
3190 
3191  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
3192  /// pool.
3193  void AddAnyMethodToGlobalPool(Decl *D);
3194 
3195  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
3196  /// there are multiple signatures.
3198  bool receiverIdOrClass=false) {
3199  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3200  /*instance*/true);
3201  }
3202 
3203  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
3204  /// there are multiple signatures.
3206  bool receiverIdOrClass=false) {
3207  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3208  /*instance*/false);
3209  }
3210 
3212  QualType ObjectType=QualType());
3213  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
3214  /// implementation.
3216 
3217  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
3218  /// initialization.
3221 
3222  //===--------------------------------------------------------------------===//
3223  // Statement Parsing Callbacks: SemaStmt.cpp.
3224 public:
3225  class FullExprArg {
3226  public:
3227  FullExprArg(Sema &actions) : E(nullptr) { }
3228 
3230  return E;
3231  }
3232 
3233  Expr *get() const { return E; }
3234 
3236  return E;
3237  }
3238 
3239  private:
3240  // FIXME: No need to make the entire Sema class a friend when it's just
3241  // Sema::MakeFullExpr that needs access to the constructor below.
3242  friend class Sema;
3243 
3244  explicit FullExprArg(Expr *expr) : E(expr) {}
3245 
3246  Expr *E;
3247  };
3248 
3250  return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
3251  }
3253  return FullExprArg(ActOnFinishFullExpr(Arg, CC).get());
3254  }
3256  ExprResult FE =
3257  ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
3258  /*DiscardedValue*/ true);
3259  return FullExprArg(FE.get());
3260  }
3261 
3264 
3266  bool HasLeadingEmptyMacro = false);
3267 
3268  void ActOnStartOfCompoundStmt();
3271  ArrayRef<Stmt *> Elts, bool isStmtExpr);
3272 
3273  /// \brief A RAII object to enter scope of a compound statement.
3275  public:
3278  }
3279 
3281  S.ActOnFinishOfCompoundStmt();
3282  }
3283 
3284  private:
3285  Sema &S;
3286  };
3287 
3288  /// An RAII helper that pops function a function scope on exit.
3291  bool Active;
3292  FunctionScopeRAII(Sema &S) : S(S), Active(true) {}
3294  if (Active)
3295  S.PopFunctionScopeInfo();
3296  }
3297  void disable() { Active = false; }
3298  };
3299 
3301  SourceLocation StartLoc,
3302  SourceLocation EndLoc);
3305  StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
3306  SourceLocation DotDotDotLoc, Expr *RHSVal,
3308  void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
3309 
3312  Stmt *SubStmt, Scope *CurScope);
3314  SourceLocation ColonLoc, Stmt *SubStmt);
3315 
3317  ArrayRef<const Attr*> Attrs,
3318  Stmt *SubStmt);
3319 
3321  FullExprArg CondVal, Decl *CondVar,
3322  Stmt *ThenVal,
3323  SourceLocation ElseLoc, Stmt *ElseVal);
3325  Expr *Cond,
3326  Decl *CondVar);
3328  Stmt *Switch, Stmt *Body);
3330  FullExprArg Cond,
3331  Decl *CondVar, Stmt *Body);
3333  SourceLocation WhileLoc,
3334  SourceLocation CondLParen, Expr *Cond,
3335  SourceLocation CondRParen);
3336 
3338  SourceLocation LParenLoc,
3339  Stmt *First, FullExprArg Second,
3340  Decl *SecondVar,
3341  FullExprArg Third,
3342  SourceLocation RParenLoc,
3343  Stmt *Body);
3345  Expr *collection);
3347  Stmt *First, Expr *collection,
3348  SourceLocation RParenLoc);
3349  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
3350 
3352  /// Initial building of a for-range statement.
3354  /// Instantiation or recovery rebuild of a for-range statement. Don't
3355  /// attempt any typo-correction.
3357  /// Determining whether a for-range statement could be built. Avoid any
3358  /// unnecessary or irreversible actions.
3360  };
3361 
3363  SourceLocation CoawaitLoc,
3364  Stmt *LoopVar,
3365  SourceLocation ColonLoc, Expr *Collection,
3366  SourceLocation RParenLoc,
3369  SourceLocation CoawaitLoc,
3371  Stmt *RangeDecl, Stmt *BeginEndDecl,
3372  Expr *Cond, Expr *Inc,
3373  Stmt *LoopVarDecl,
3374  SourceLocation RParenLoc,
3376  StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
3377 
3379  SourceLocation LabelLoc,
3380  LabelDecl *TheDecl);
3382  SourceLocation StarLoc,
3383  Expr *DestExp);
3384  StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
3385  StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
3386 
3387  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3388  CapturedRegionKind Kind, unsigned NumParams);
3389  typedef std::pair<StringRef, QualType> CapturedParamNameType;
3390  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3394  void ActOnCapturedRegionError();
3396  SourceLocation Loc,
3397  unsigned NumParams);
3398  VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E,
3399  bool AllowFunctionParameters);
3400  bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD,
3401  bool AllowFunctionParameters);
3402 
3403  StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
3404  Scope *CurScope);
3405  StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3406  StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3407 
3408  StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
3409  bool IsVolatile, unsigned NumOutputs,
3410  unsigned NumInputs, IdentifierInfo **Names,
3411  MultiExprArg Constraints, MultiExprArg Exprs,
3412  Expr *AsmString, MultiExprArg Clobbers,
3413  SourceLocation RParenLoc);
3414 
3416  SourceLocation TemplateKWLoc,
3417  UnqualifiedId &Id,
3418  llvm::InlineAsmIdentifierInfo &Info,
3419  bool IsUnevaluatedContext);
3420  bool LookupInlineAsmField(StringRef Base, StringRef Member,
3421  unsigned &Offset, SourceLocation AsmLoc);
3422  ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member,
3423  llvm::InlineAsmIdentifierInfo &Info,
3424  SourceLocation AsmLoc);
3426  ArrayRef<Token> AsmToks,
3427  StringRef AsmString,
3428  unsigned NumOutputs, unsigned NumInputs,
3429  ArrayRef<StringRef> Constraints,
3430  ArrayRef<StringRef> Clobbers,
3431  ArrayRef<Expr*> Exprs,
3432  SourceLocation EndLoc);
3433  LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
3434  SourceLocation Location,
3435  bool AlwaysCreate);
3436 
3437  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
3438  SourceLocation StartLoc,
3439  SourceLocation IdLoc, IdentifierInfo *Id,
3440  bool Invalid = false);
3441 
3443 
3445  Decl *Parm, Stmt *Body);
3446 
3448 
3450  MultiStmtArg Catch, Stmt *Finally);
3451 
3454  Scope *CurScope);
3456  Expr *operand);
3458  Expr *SynchExpr,
3459  Stmt *SynchBody);
3460 
3462 
3464  SourceLocation StartLoc,
3465  SourceLocation IdLoc,
3466  IdentifierInfo *Id);
3467 
3469 
3471  Decl *ExDecl, Stmt *HandlerBlock);
3472  StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
3473  ArrayRef<Stmt *> Handlers);
3474 
3475  StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
3476  SourceLocation TryLoc, Stmt *TryBlock,
3477  Stmt *Handler);
3479  Expr *FilterExpr,
3480  Stmt *Block);
3485 
3487 
3488  bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const;
3489 
3490  /// \brief If it's a file scoped decl that must warn if not used, keep track
3491  /// of it.
3493 
3494  /// DiagnoseUnusedExprResult - If the statement passed in is an expression
3495  /// whose result is unused, warn.
3496  void DiagnoseUnusedExprResult(const Stmt *S);
3498  void DiagnoseUnusedDecl(const NamedDecl *ND);
3499 
3500  /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
3501  /// statement as a \p Body, and it is located on the same line.
3502  ///
3503  /// This helps prevent bugs due to typos, such as:
3504  /// if (condition);
3505  /// do_stuff();
3507  const Stmt *Body,
3508  unsigned DiagID);
3509 
3510  /// Warn if a for/while loop statement \p S, which is followed by
3511  /// \p PossibleBody, has a suspicious null statement as a body.
3512  void DiagnoseEmptyLoopBody(const Stmt *S,
3513  const Stmt *PossibleBody);
3514 
3515  /// Warn if a value is moved to itself.
3516  void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
3517  SourceLocation OpLoc);
3518 
3519  /// \brief Warn if we're implicitly casting from a _Nullable pointer type to a
3520  /// _Nonnull one.
3522  SourceLocation Loc);
3523 
3525  return DelayedDiagnostics.push(pool);
3526  }
3528 
3532  }
3535  }
3536 
3538 
3540 
3542  NamedDecl *D, StringRef Message,
3543  SourceLocation Loc,
3544  const ObjCInterfaceDecl *UnknownObjCClass,
3545  const ObjCPropertyDecl *ObjCProperty,
3546  bool ObjCPropertyAccess);
3547 
3549  UnavailableAttr::ImplicitReason reason);
3550 
3551  //===--------------------------------------------------------------------===//
3552  // Expression Parsing Callbacks: SemaExpr.cpp.
3553 
3554  bool CanUseDecl(NamedDecl *D);
3556  const ObjCInterfaceDecl *UnknownObjCClass=nullptr,
3557  bool ObjCPropertyAccess=false);
3559  std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
3561  ObjCMethodDecl *Getter,
3562  SourceLocation Loc);
3564  ArrayRef<Expr *> Args);
3565 
3567  Decl *LambdaContextDecl = nullptr,
3568  bool IsDecltype = false);
3572  bool IsDecltype = false);
3574 
3576 
3579 
3581 
3582  // Functions for marking a declaration referenced. These functions also
3583  // contain the relevant logic for marking if a reference to a function or
3584  // variable is an odr-use (in the C++11 sense). There are separate variants
3585  // for expressions referring to a decl; these exist because odr-use marking
3586  // needs to be delayed for some constant variables when we build one of the
3587  // named expressions.
3588  void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool OdrUse);
3590  bool OdrUse = true);
3594 
3596  void CleanupVarDeclMarking();
3597 
3600  };
3601 
3602  /// \brief Try to capture the given variable.
3603  ///
3604  /// \param Var The variable to capture.
3605  ///
3606  /// \param Loc The location at which the capture occurs.
3607  ///
3608  /// \param Kind The kind of capture, which may be implicit (for either a
3609  /// block or a lambda), or explicit by-value or by-reference (for a lambda).
3610  ///
3611  /// \param EllipsisLoc The location of the ellipsis, if one is provided in
3612  /// an explicit lambda capture.
3613  ///
3614  /// \param BuildAndDiagnose Whether we are actually supposed to add the
3615  /// captures or diagnose errors. If false, this routine merely check whether
3616  /// the capture can occur without performing the capture itself or complaining
3617  /// if the variable cannot be captured.
3618  ///
3619  /// \param CaptureType Will be set to the type of the field used to capture
3620  /// this variable in the innermost block or lambda. Only valid when the
3621  /// variable can be captured.
3622  ///
3623  /// \param DeclRefType Will be set to the type of a reference to the capture
3624  /// from within the current scope. Only valid when the variable can be
3625  /// captured.
3626  ///
3627  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
3628  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
3629  /// This is useful when enclosing lambdas must speculatively capture
3630  /// variables that may or may not be used in certain specializations of
3631  /// a nested generic lambda.
3632  ///
3633  /// \returns true if an error occurred (i.e., the variable cannot be
3634  /// captured) and false if the capture succeeded.
3636  SourceLocation EllipsisLoc, bool BuildAndDiagnose,
3637  QualType &CaptureType,
3638  QualType &DeclRefType,
3639  const unsigned *const FunctionScopeIndexToStopAt);
3640 
3641  /// \brief Try to capture the given variable.
3642  bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc,
3644  SourceLocation EllipsisLoc = SourceLocation());
3645 
3646  /// \brief Checks if the variable must be captured.
3648 
3649  /// \brief Given a variable, determine the type that a reference to that
3650  /// variable will have in the given scope.
3652 
3655  bool SkipLocalVariables = false);
3656 
3657  /// \brief Try to recover by turning the given expression into a
3658  /// call. Returns true if recovery was attempted or an error was
3659  /// emitted; this may also leave the ExprResult invalid.
3661  bool ForceComplain = false,
3662  bool (*IsPlausibleResult)(QualType) = nullptr);
3663 
3664  /// \brief Figure out if an expression could be turned into a call.
3665  bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
3666  UnresolvedSetImpl &NonTemplateOverloads);
3667 
3668  /// \brief Conditionally issue a diagnostic based on the current
3669  /// evaluation context.
3670  ///
3671  /// \param Statement If Statement is non-null, delay reporting the
3672  /// diagnostic until the function body is parsed, and then do a basic
3673  /// reachability analysis to determine if the statement is reachable.
3674  /// If it is unreachable, the diagnostic will not be emitted.
3675  bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
3676  const PartialDiagnostic &PD);
3677 
3678  // Primary Expressions.
3679  SourceRange getExprRange(Expr *E) const;
3680 
3682  Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
3683  UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
3684  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr,
3685  bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
3686 
3687  void DecomposeUnqualifiedId(const UnqualifiedId &Id,
3689  DeclarationNameInfo &NameInfo,
3690  const TemplateArgumentListInfo *&TemplateArgs);
3691 
3692  bool
3694  std::unique_ptr<CorrectionCandidateCallback> CCC,
3695  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
3696  ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
3697 
3699  IdentifierInfo *II,
3700  bool AllowBuiltinCreation=false);
3701 
3703  SourceLocation TemplateKWLoc,
3704  const DeclarationNameInfo &NameInfo,
3705  bool isAddressOfOperand,
3706  const TemplateArgumentListInfo *TemplateArgs);
3707 
3709  ExprValueKind VK,
3710  SourceLocation Loc,
3711  const CXXScopeSpec *SS = nullptr);
3712  ExprResult
3714  const DeclarationNameInfo &NameInfo,
3715  const CXXScopeSpec *SS = nullptr,
3716  NamedDecl *FoundD = nullptr,
3717  const TemplateArgumentListInfo *TemplateArgs = nullptr);
3718  ExprResult
3720  const CXXScopeSpec &SS,
3721  SourceLocation nameLoc,
3722  IndirectFieldDecl *indirectField,
3723  DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
3724  Expr *baseObjectExpr = nullptr,
3725  SourceLocation opLoc = SourceLocation());
3726 
3728  SourceLocation TemplateKWLoc,
3729  LookupResult &R,
3730  const TemplateArgumentListInfo *TemplateArgs,
3731  const Scope *S);
3733  SourceLocation TemplateKWLoc,
3734  LookupResult &R,
3735  const TemplateArgumentListInfo *TemplateArgs,
3736  bool IsDefiniteInstance,
3737  const Scope *S);
3739  const LookupResult &R,
3740  bool HasTrailingLParen);
3741 
3742  ExprResult
3744  const DeclarationNameInfo &NameInfo,
3745  bool IsAddressOfOperand, const Scope *S,
3746  TypeSourceInfo **RecoveryTSI = nullptr);
3747 
3749  SourceLocation TemplateKWLoc,
3750  const DeclarationNameInfo &NameInfo,
3751  const TemplateArgumentListInfo *TemplateArgs);
3752 
3754  LookupResult &R,
3755  bool NeedsADL,
3756  bool AcceptInvalidDecl = false);
3758  const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
3759  NamedDecl *FoundD = nullptr,
3760  const TemplateArgumentListInfo *TemplateArgs = nullptr,
3761  bool AcceptInvalidDecl = false);
3762 
3764  DeclarationNameInfo &SuffixInfo,
3765  ArrayRef<Expr *> Args,
3766  SourceLocation LitEndLoc,
3767  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
3768 
3772  ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val);
3773 
3774  bool CheckLoopHintExpr(Expr *E, SourceLocation Loc);
3775 
3776  ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
3778  Scope *UDLScope = nullptr);
3781  SourceLocation R,
3782  MultiExprArg Val);
3783 
3784  /// ActOnStringLiteral - The specified tokens were lexed as pasted string
3785  /// fragments (e.g. "foo" "bar" L"baz").
3787  Scope *UDLScope = nullptr);
3788 
3790  SourceLocation DefaultLoc,
3791  SourceLocation RParenLoc,
3792  Expr *ControllingExpr,
3793  ArrayRef<ParsedType> ArgTypes,
3794  ArrayRef<Expr *> ArgExprs);
3796  SourceLocation DefaultLoc,
3797  SourceLocation RParenLoc,
3798  Expr *ControllingExpr,
3800  ArrayRef<Expr *> Exprs);
3801 
3802  // Binary/Unary Operators. 'Tok' is the token for the operator.
3804  Expr *InputExpr);
3806  UnaryOperatorKind Opc, Expr *Input);
3808  tok::TokenKind Op, Expr *Input);
3809 
3811 
3813  SourceLocation OpLoc,
3814  UnaryExprOrTypeTrait ExprKind,
3815  SourceRange R);
3817  UnaryExprOrTypeTrait ExprKind);
3818  ExprResult
3820  UnaryExprOrTypeTrait ExprKind,
3821  bool IsType, void *TyOrEx,
3822  SourceRange ArgRange);
3823 
3825  bool CheckVecStepExpr(Expr *E);
3826 
3829  SourceRange ExprRange,
3830  UnaryExprOrTypeTrait ExprKind);
3832  SourceLocation OpLoc,
3834  SourceLocation NameLoc,
3835  SourceLocation RParenLoc);
3838 
3840  Expr *Idx, SourceLocation RLoc);
3842  Expr *Idx, SourceLocation RLoc);
3844  Expr *LowerBound, SourceLocation ColonLoc,
3845  Expr *Length, SourceLocation RBLoc);
3846 
3847  // This struct is for use by ActOnMemberAccess to allow
3848  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
3849  // changing the access operator from a '.' to a '->' (to see if that is the
3850  // change needed to fix an error about an unknown member, e.g. when the class
3851  // defines a custom operator->).
3856  };
3857 
3859  Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
3860  CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
3861  NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
3862  const TemplateArgumentListInfo *TemplateArgs,
3863  const Scope *S,
3864  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
3865 
3866  ExprResult
3868  bool IsArrow, const CXXScopeSpec &SS,
3869  SourceLocation TemplateKWLoc,
3870  NamedDecl *FirstQualifierInScope, LookupResult &R,
3871  const TemplateArgumentListInfo *TemplateArgs,
3872  const Scope *S,
3873  bool SuppressQualifierCheck = false,
3874  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
3875 
3877 
3878  bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
3879  const CXXScopeSpec &SS,
3880  const LookupResult &R);
3881 
3883  bool IsArrow, SourceLocation OpLoc,
3884  const CXXScopeSpec &SS,
3885  SourceLocation TemplateKWLoc,
3886  NamedDecl *FirstQualifierInScope,
3887  const DeclarationNameInfo &NameInfo,
3888  const TemplateArgumentListInfo *TemplateArgs);
3889 
3891  SourceLocation OpLoc,
3892  tok::TokenKind OpKind,
3893  CXXScopeSpec &SS,
3894  SourceLocation TemplateKWLoc,
3895  UnqualifiedId &Member,
3896  Decl *ObjCImpDecl);
3897 
3898  void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
3899  bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
3900  FunctionDecl *FDecl,
3901  const FunctionProtoType *Proto,
3902  ArrayRef<Expr *> Args,
3903  SourceLocation RParenLoc,
3904  bool ExecConfig = false);
3906  ParmVarDecl *Param,
3907  const Expr *ArgExpr);
3908 
3909  /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
3910  /// This provides the location of the left/right parens and a list of comma
3911  /// locations.
3912  ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
3913  MultiExprArg ArgExprs, SourceLocation RParenLoc,
3914  Expr *ExecConfig = nullptr,
3915  bool IsExecConfig = false);
3917  SourceLocation LParenLoc,
3918  ArrayRef<Expr *> Arg,
3919  SourceLocation RParenLoc,
3920  Expr *Config = nullptr,
3921  bool IsExecConfig = false);
3922 
3924  MultiExprArg ExecConfig,
3925  SourceLocation GGGLoc);
3926 
3928  Declarator &D, ParsedType &Ty,
3929  SourceLocation RParenLoc, Expr *CastExpr);
3931  TypeSourceInfo *Ty,
3932  SourceLocation RParenLoc,
3933  Expr *Op);
3935 
3936  /// \brief Build an altivec or OpenCL literal.
3938  SourceLocation RParenLoc, Expr *E,
3939  TypeSourceInfo *TInfo);
3940 
3942 
3944  ParsedType Ty,
3945  SourceLocation RParenLoc,
3946  Expr *InitExpr);
3947 
3949  TypeSourceInfo *TInfo,
3950  SourceLocation RParenLoc,
3951  Expr *LiteralExpr);
3952 
3954  MultiExprArg InitArgList,
3955  SourceLocation RBraceLoc);
3956 
3958  SourceLocation Loc,
3959  bool GNUSyntax,
3960  ExprResult Init);
3961 
3962 private:
3963  static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
3964 
3965 public:
3967  tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
3969  BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
3971  Expr *LHSExpr, Expr *RHSExpr);
3972 
3973  /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
3974  /// in the case of a the GNU conditional expr extension.
3977  Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
3978 
3979  /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
3981  LabelDecl *TheDecl);
3982 
3983  void ActOnStartStmtExpr();
3984  ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
3985  SourceLocation RPLoc); // "({..})"
3986  void ActOnStmtExprError();
3987 
3988  // __builtin_offsetof(type, identifier(.identifier|[expr])*)
3991  bool isBrackets; // true if [expr], false if .ident
3992  union {
3995  } U;
3996  };
3997 
3998  /// __builtin_offsetof(type, a.b[123][456].c)
4000  TypeSourceInfo *TInfo,
4001  ArrayRef<OffsetOfComponent> Components,
4002  SourceLocation RParenLoc);
4004  SourceLocation BuiltinLoc,
4006  ParsedType ParsedArgTy,
4007  ArrayRef<OffsetOfComponent> Components,
4008  SourceLocation RParenLoc);
4009 
4010  // __builtin_choose_expr(constExpr, expr1, expr2)
4012  Expr *CondExpr, Expr *LHSExpr,
4013  Expr *RHSExpr, SourceLocation RPLoc);
4014 
4015  // __builtin_va_arg(expr, type)
4016  ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty,
4017  SourceLocation RPLoc);
4019  TypeSourceInfo *TInfo, SourceLocation RPLoc);
4020 
4021  // __null
4023 
4024  bool CheckCaseExpression(Expr *E);
4025 
4026  /// \brief Describes the result of an "if-exists" condition check.
4028  /// \brief The symbol exists.
4030 
4031  /// \brief The symbol does not exist.
4033 
4034  /// \brief The name is a dependent name, so the results will differ
4035  /// from one instantiation to the next.
4037 
4038  /// \brief An error occurred.
4040  };
4041 
4044  const DeclarationNameInfo &TargetNameInfo);
4045 
4048  bool IsIfExists, CXXScopeSpec &SS,
4049  UnqualifiedId &Name);
4050 
4052  bool IsIfExists,
4053  NestedNameSpecifierLoc QualifierLoc,
4054  DeclarationNameInfo NameInfo,
4055  Stmt *Nested);
4057  bool IsIfExists,
4059  Stmt *Nested);
4060 
4061  //===------------------------- "Block" Extension ------------------------===//
4062 
4063  /// ActOnBlockStart - This callback is invoked when a block literal is
4064  /// started.
4065  void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
4066 
4067  /// ActOnBlockArguments - This callback allows processing of block arguments.
4068  /// If there are no arguments, this is still invoked.
4069  void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
4070  Scope *CurScope);
4071 
4072  /// ActOnBlockError - If there is an error parsing a block, this callback
4073  /// is invoked to pop the information about the block from the action impl.
4074  void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
4075 
4076  /// ActOnBlockStmtExpr - This is called when the body of a block statement
4077  /// literal was successfully completed. ^(int x){...}
4079  Scope *CurScope);
4080 
4081  //===---------------------------- Clang Extensions ----------------------===//
4082 
4083  /// __builtin_convertvector(...)
4085  SourceLocation BuiltinLoc,
4086  SourceLocation RParenLoc);
4087 
4088  //===---------------------------- OpenCL Features -----------------------===//
4089 
4090  /// __builtin_astype(...)
4091  ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
4092  SourceLocation BuiltinLoc,
4093  SourceLocation RParenLoc);
4094 
4095  //===---------------------------- C++ Features --------------------------===//
4096 
4097  // Act on C++ namespaces
4099  SourceLocation NamespaceLoc,
4100  SourceLocation IdentLoc,
4101  IdentifierInfo *Ident,
4102  SourceLocation LBrace,
4103  AttributeList *AttrList,
4105  void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
4106 
4107  NamespaceDecl *getStdNamespace() const;
4109 
4110  CXXRecordDecl *getStdBadAlloc() const;
4111 
4112  /// \brief Tests whether Ty is an instance of std::initializer_list and, if
4113  /// it is and Element is not NULL, assigns the element type to Element.
4114  bool isStdInitializerList(QualType Ty, QualType *Element);
4115 
4116  /// \brief Looks for the std::initializer_list template and instantiates it
4117  /// with Element, or emits an error if it's not found.
4118  ///
4119  /// \returns The instantiated template, or null on error.
4121 
4122  /// \brief Determine whether Ctor is an initializer-list constructor, as
4123  /// defined in [dcl.init.list]p2.
4124  bool isInitListConstructor(const CXXConstructorDecl *Ctor);
4125 
4126  Decl *ActOnUsingDirective(Scope *CurScope,
4127  SourceLocation UsingLoc,
4128  SourceLocation NamespcLoc,
4129  CXXScopeSpec &SS,
4130  SourceLocation IdentLoc,
4131  IdentifierInfo *NamespcName,
4132  AttributeList *AttrList);
4133 
4135 
4136  Decl *ActOnNamespaceAliasDef(Scope *CurScope,
4137  SourceLocation NamespaceLoc,
4138  SourceLocation AliasLoc,
4139  IdentifierInfo *Alias,
4140  CXXScopeSpec &SS,
4141  SourceLocation IdentLoc,
4142  IdentifierInfo *Ident);
4143 
4144  void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
4145  bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target,
4146  const LookupResult &PreviousDecls,
4147  UsingShadowDecl *&PrevShadow);
4149  NamedDecl *Target,
4150  UsingShadowDecl *PrevDecl);
4151 
4153  bool HasTypenameKeyword,
4154  const CXXScopeSpec &SS,
4155  SourceLocation NameLoc,
4156  const LookupResult &Previous);
4158  const CXXScopeSpec &SS,
4159  const DeclarationNameInfo &NameInfo,
4160  SourceLocation NameLoc);
4161 
4163  SourceLocation UsingLoc,
4164  CXXScopeSpec &SS,
4165  DeclarationNameInfo NameInfo,
4166  AttributeList *AttrList,
4167  bool IsInstantiation,
4168  bool HasTypenameKeyword,
4169  SourceLocation TypenameLoc);
4170 
4172 
4173  Decl *ActOnUsingDeclaration(Scope *CurScope,
4174  AccessSpecifier AS,
4175  bool HasUsingKeyword,
4176  SourceLocation UsingLoc,
4177  CXXScopeSpec &SS,
4179  AttributeList *AttrList,
4180  bool HasTypenameKeyword,
4181  SourceLocation TypenameLoc);
4182  Decl *ActOnAliasDeclaration(Scope *CurScope,
4183  AccessSpecifier AS,
4184  MultiTemplateParamsArg TemplateParams,
4185  SourceLocation UsingLoc,
4187  AttributeList *AttrList,
4188  TypeResult Type,
4189  Decl *DeclFromDeclSpec);
4190 
4191  /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4192  /// including handling of its default argument expressions.
4193  ///
4194  /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4195  ExprResult
4196  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4197  CXXConstructorDecl *Constructor, MultiExprArg Exprs,
4198  bool HadMultipleCandidates, bool IsListInitialization,
4199  bool IsStdInitListInitialization,
4200  bool RequiresZeroInit, unsigned ConstructKind,
4201  SourceRange ParenRange);
4202 
4203  // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4204  // the constructor can be elidable?
4205  ExprResult
4206  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4207  CXXConstructorDecl *Constructor, bool Elidable,
4208  MultiExprArg Exprs, bool HadMultipleCandidates,
4209  bool IsListInitialization,
4210  bool IsStdInitListInitialization, bool RequiresZeroInit,
4211  unsigned ConstructKind, SourceRange ParenRange);
4212 
4214 
4215  /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
4216  /// the default expr if needed.
4218  FunctionDecl *FD,
4219  ParmVarDecl *Param);
4220 
4221  /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4222  /// constructed variable.
4223  void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
4224 
4225  /// \brief Helper class that collects exception specifications for
4226  /// implicitly-declared special member functions.
4228  // Pointer to allow copying
4229  Sema *Self;
4230  // We order exception specifications thus:
4231  // noexcept is the most restrictive, but is only used in C++11.
4232  // throw() comes next.
4233  // Then a throw(collected exceptions)
4234  // Finally no specification, which is expressed as noexcept(false).
4235  // throw(...) is used instead if any called function uses it.
4236  ExceptionSpecificationType ComputedEST;
4237  llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
4238  SmallVector<QualType, 4> Exceptions;
4239 
4240  void ClearExceptions() {
4241  ExceptionsSeen.clear();
4242  Exceptions.clear();
4243  }
4244 
4245  public:
4247  : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4248  if (!Self.getLangOpts().CPlusPlus11)
4249  ComputedEST = EST_DynamicNone;
4250  }
4251 
4252  /// \brief Get the computed exception specification type.
4254  assert(ComputedEST != EST_ComputedNoexcept &&
4255  "noexcept(expr) should not be a possible result");
4256  return ComputedEST;
4257  }
4258 
4259  /// \brief The number of exceptions in the exception specification.
4260  unsigned size() const { return Exceptions.size(); }
4261 
4262  /// \brief The set of exceptions in the exception specification.
4263  const QualType *data() const { return Exceptions.data(); }
4264 
4265  /// \brief Integrate another called method into the collected data.
4266  void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
4267 
4268  /// \brief Integrate an invoked expression into the collected data.
4269  void CalledExpr(Expr *E);
4270 
4271  /// \brief Overwrite an EPI's exception specification with this
4272  /// computed exception specification.
4275  ESI.Type = getExceptionSpecType();
4276  if (ESI.Type == EST_Dynamic) {
4277  ESI.Exceptions = Exceptions;
4278  } else if (ESI.Type == EST_None) {
4279  /// C++11 [except.spec]p14:
4280  /// The exception-specification is noexcept(false) if the set of
4281  /// potential exceptions of the special member function contains "any"
4282  ESI.Type = EST_ComputedNoexcept;
4283  ESI.NoexceptExpr = Self->ActOnCXXBoolLiteral(SourceLocation(),
4284  tok::kw_false).get();
4285  }
4286  return ESI;
4287  }
4288  };
4289 
4290  /// \brief Determine what sort of exception specification a defaulted
4291  /// copy constructor of a class will have.
4292  ImplicitExceptionSpecification
4294  CXXMethodDecl *MD);
4295 
4296  /// \brief Determine what sort of exception specification a defaulted
4297  /// default constructor of a class will have, and whether the parameter
4298  /// will be const.
4299  ImplicitExceptionSpecification
4301 
4302  /// \brief Determine what sort of exception specification a defautled
4303  /// copy assignment operator of a class will have, and whether the
4304  /// parameter will be const.
4305  ImplicitExceptionSpecification
4307 
4308  /// \brief Determine what sort of exception specification a defaulted move
4309  /// constructor of a class will have.
4310  ImplicitExceptionSpecification
4312 
4313  /// \brief Determine what sort of exception specification a defaulted move
4314  /// assignment operator of a class will have.
4315  ImplicitExceptionSpecification
4317 
4318  /// \brief Determine what sort of exception specification a defaulted
4319  /// destructor of a class will have.
4320  ImplicitExceptionSpecification
4322 
4323  /// \brief Determine what sort of exception specification an inheriting
4324  /// constructor of a class will have.
4325  ImplicitExceptionSpecification
4327 
4328  /// \brief Evaluate the implicit exception specification for a defaulted
4329  /// special member function.
4331 
4332  /// \brief Check the given exception-specification and update the
4333  /// exception specification information with the results.
4334  void checkExceptionSpecification(bool IsTopLevel,
4336  ArrayRef<ParsedType> DynamicExceptions,
4337  ArrayRef<SourceRange> DynamicExceptionRanges,
4338  Expr *NoexceptExpr,
4339  SmallVectorImpl<QualType> &Exceptions,
4341 
4342  /// \brief Determine if we're in a case where we need to (incorrectly) eagerly
4343  /// parse an exception specification to work around a libstdc++ bug.
4345 
4346  /// \brief Add an exception-specification to the given member function
4347  /// (or member function template). The exception-specification was parsed
4348  /// after the method itself was declared.
4351  SourceRange SpecificationRange,
4352  ArrayRef<ParsedType> DynamicExceptions,
4353  ArrayRef<SourceRange> DynamicExceptionRanges,
4354  Expr *NoexceptExpr);
4355 
4356  /// \brief Determine if a special member function should have a deleted
4357  /// definition when it is defaulted.
4359  bool Diagnose = false);
4360 
4361  /// \brief Declare the implicit default constructor for the given class.
4362  ///
4363  /// \param ClassDecl The class declaration into which the implicit
4364  /// default constructor will be added.
4365  ///
4366  /// \returns The implicitly-declared default constructor.
4368  CXXRecordDecl *ClassDecl);
4369 
4370  /// DefineImplicitDefaultConstructor - Checks for feasibility of
4371  /// defining this constructor as the default constructor.
4372  void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
4373  CXXConstructorDecl *Constructor);
4374 
4375  /// \brief Declare the implicit destructor for the given class.
4376  ///
4377  /// \param ClassDecl The class declaration into which the implicit
4378  /// destructor will be added.
4379  ///
4380  /// \returns The implicitly-declared destructor.
4382 
4383  /// DefineImplicitDestructor - Checks for feasibility of
4384  /// defining this destructor as the default destructor.
4385  void DefineImplicitDestructor(SourceLocation CurrentLocation,
4386  CXXDestructorDecl *Destructor);
4387 
4388  /// \brief Build an exception spec for destructors that don't have one.
4389  ///
4390  /// C++11 says that user-defined destructors with no exception spec get one
4391  /// that looks as if the destructor was implicitly declared.
4393  CXXDestructorDecl *Destructor);
4394 
4395  /// \brief Declare all inheriting constructors for the given class.
4396  ///
4397  /// \param ClassDecl The class declaration into which the inheriting
4398  /// constructors will be added.
4400 
4401  /// \brief Define the specified inheriting constructor.
4403  CXXConstructorDecl *Constructor);
4404 
4405  /// \brief Declare the implicit copy constructor for the given class.
4406  ///
4407  /// \param ClassDecl The class declaration into which the implicit
4408  /// copy constructor will be added.
4409  ///
4410  /// \returns The implicitly-declared copy constructor.
4412 
4413  /// DefineImplicitCopyConstructor - Checks for feasibility of
4414  /// defining this constructor as the copy constructor.
4415  void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
4416  CXXConstructorDecl *Constructor);
4417 
4418  /// \brief Declare the implicit move constructor for the given class.
4419  ///
4420  /// \param ClassDecl The Class declaration into which the implicit
4421  /// move constructor will be added.
4422  ///
4423  /// \returns The implicitly-declared move constructor, or NULL if it wasn't
4424  /// declared.
4426 
4427  /// DefineImplicitMoveConstructor - Checks for feasibility of
4428  /// defining this constructor as the move constructor.
4429  void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
4430  CXXConstructorDecl *Constructor);
4431 
4432  /// \brief Declare the implicit copy assignment operator for the given class.
4433  ///
4434  /// \param ClassDecl The class declaration into which the implicit
4435  /// copy assignment operator will be added.
4436  ///
4437  /// \returns The implicitly-declared copy assignment operator.
4439 
4440  /// \brief Defines an implicitly-declared copy assignment operator.
4441  void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
4442  CXXMethodDecl *MethodDecl);
4443 
4444  /// \brief Declare the implicit move assignment operator for the given class.
4445  ///
4446  /// \param ClassDecl The Class declaration into which the implicit
4447  /// move assignment operator will be added.
4448  ///
4449  /// \returns The implicitly-declared move assignment operator, or NULL if it
4450  /// wasn't declared.
4452 
4453  /// \brief Defines an implicitly-declared move assignment operator.
4454  void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
4455  CXXMethodDecl *MethodDecl);
4456 
4457  /// \brief Force the declaration of any implicitly-declared members of this
4458  /// class.
4460 
4461  /// \brief Determine whether the given function is an implicitly-deleted
4462  /// special member function.
4464 
4465  /// \brief Check whether 'this' shows up in the type of a static member
4466  /// function after the (naturally empty) cv-qualifier-seq would be.
4467  ///
4468  /// \returns true if an error occurred.
4470 
4471  /// \brief Whether this' shows up in the exception specification of a static
4472  /// member function.
4474 
4475  /// \brief Check whether 'this' shows up in the attributes of the given
4476  /// static member function.
4477  ///
4478  /// \returns true if an error occurred.
4480 
4481  /// MaybeBindToTemporary - If the passed in expression has a record type with
4482  /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
4483  /// it simply returns the passed in expression.
4485 
4486  bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
4487  MultiExprArg ArgsPtr,
4488  SourceLocation Loc,
4489  SmallVectorImpl<Expr*> &ConvertedArgs,
4490  bool AllowExplicit = false,
4491  bool IsListInitialization = false);
4492 
4494  SourceLocation NameLoc,
4495  IdentifierInfo &Name);
4496 
4498  IdentifierInfo &II, SourceLocation NameLoc,
4499  Scope *S, CXXScopeSpec &SS,
4500  ParsedType ObjectType,
4501  bool EnteringContext);
4502 
4503  ParsedType getDestructorType(const DeclSpec& DS, ParsedType ObjectType);
4504 
4505  // Checks that reinterpret casts don't have undefined behavior.
4506  void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
4507  bool IsDereference, SourceRange Range);
4508 
4509  /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
4512  SourceLocation LAngleBracketLoc,
4513  Declarator &D,
4514  SourceLocation RAngleBracketLoc,
4515  SourceLocation LParenLoc,
4516  Expr *E,
4517  SourceLocation RParenLoc);
4518 
4521  TypeSourceInfo *Ty,
4522  Expr *E,
4523  SourceRange AngleBrackets,
4524  SourceRange Parens);
4525 
4526  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4527  SourceLocation TypeidLoc,
4528  TypeSourceInfo *Operand,
4529  SourceLocation RParenLoc);
4530  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4531  SourceLocation TypeidLoc,
4532  Expr *Operand,
4533  SourceLocation RParenLoc);
4534 
4535  /// ActOnCXXTypeid - Parse typeid( something ).
4537  SourceLocation LParenLoc, bool isType,
4538  void *TyOrExpr,
4539  SourceLocation RParenLoc);
4540 
4541  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4542  SourceLocation TypeidLoc,
4543  TypeSourceInfo *Operand,
4544  SourceLocation RParenLoc);
4545  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4546  SourceLocation TypeidLoc,
4547  Expr *Operand,
4548  SourceLocation RParenLoc);
4549 
4550  /// ActOnCXXUuidof - Parse __uuidof( something ).
4552  SourceLocation LParenLoc, bool isType,
4553  void *TyOrExpr,
4554  SourceLocation RParenLoc);
4555 
4556  /// \brief Handle a C++1z fold-expression: ( expr op ... op expr ).
4558  tok::TokenKind Operator,
4559  SourceLocation EllipsisLoc, Expr *RHS,
4560  SourceLocation RParenLoc);
4562  BinaryOperatorKind Operator,
4563  SourceLocation EllipsisLoc, Expr *RHS,
4564  SourceLocation RParenLoc);
4566  BinaryOperatorKind Operator);
4567 
4568  //// ActOnCXXThis - Parse 'this' pointer.
4570 
4571  /// \brief Try to retrieve the type of the 'this' pointer.
4572  ///
4573  /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
4575 
4576  /// \brief When non-NULL, the C++ 'this' expression is allowed despite the
4577  /// current context not being a non-static member function. In such cases,
4578  /// this provides the type used for 'this'.
4580 
4581  /// \brief RAII object used to temporarily allow the C++ 'this' expression
4582  /// to be used, with the given qualifiers on the current class type.
4584  Sema &S;
4585  QualType OldCXXThisTypeOverride;
4586  bool Enabled;
4587 
4588  public:
4589  /// \brief Introduce a new scope where 'this' may be allowed (when enabled),
4590  /// using the given declaration (which is either a class template or a
4591  /// class) along with the given qualifiers.
4592  /// along with the qualifiers placed on '*this'.
4593  CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals,
4594  bool Enabled = true);
4595 
4596  ~CXXThisScopeRAII();
4597  };
4598 
4599  /// \brief Make sure the value of 'this' is actually available in the current
4600  /// context, if it is a potentially evaluated context.
4601  ///
4602  /// \param Loc The location at which the capture of 'this' occurs.
4603  ///
4604  /// \param Explicit Whether 'this' is explicitly captured in a lambda
4605  /// capture list.
4606  ///
4607  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
4608  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
4609  /// This is useful when enclosing lambdas must speculatively capture
4610  /// 'this' that may or may not be used in certain specializations of
4611  /// a nested generic lambda (depending on whether the name resolves to
4612  /// a non-static member function or a static function).
4613  /// \return returns 'true' if failed, 'false' if success.
4614  bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
4615  bool BuildAndDiagnose = true,
4616  const unsigned *const FunctionScopeIndexToStopAt = nullptr);
4617 
4618  /// \brief Determine whether the given type is the type of *this that is used
4619  /// outside of the body of a member function for a type that is currently
4620  /// being defined.
4622 
4623  /// ActOnCXXBoolLiteral - Parse {true,false} literals.
4625 
4626 
4627  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
4629 
4630  /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
4632 
4633  //// ActOnCXXThrow - Parse throw expressions.
4636  bool IsThrownVarInScope);
4637  bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
4638 
4639  /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
4640  /// Can be interpreted either as function-style casting ("int(x)")
4641  /// or class type construction ("ClassType(x,y,z)")
4642  /// or creation of a value-initialized type ("int()").
4644  SourceLocation LParenLoc,
4645  MultiExprArg Exprs,
4646  SourceLocation RParenLoc);
4647 
4649  SourceLocation LParenLoc,
4650  MultiExprArg Exprs,
4651  SourceLocation RParenLoc);
4652 
4653  /// ActOnCXXNew - Parsed a C++ 'new' expression.
4654  ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
4655  SourceLocation PlacementLParen,
4656  MultiExprArg PlacementArgs,
4657  SourceLocation PlacementRParen,
4658  SourceRange TypeIdParens, Declarator &D,
4659  Expr *Initializer);
4660  ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal,
4661  SourceLocation PlacementLParen,
4662  MultiExprArg PlacementArgs,
4663  SourceLocation PlacementRParen,
4664  SourceRange TypeIdParens,
4665  QualType AllocType,
4666  TypeSourceInfo *AllocTypeInfo,
4667  Expr *ArraySize,
4668  SourceRange DirectInitRange,
4669  Expr *Initializer,
4670  bool TypeMayContainAuto = true);
4671 
4672  bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
4673  SourceRange R);
4674  bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
4675  bool UseGlobal, QualType AllocType, bool IsArray,
4676  MultiExprArg PlaceArgs,
4677  FunctionDecl *&OperatorNew,
4678  FunctionDecl *&OperatorDelete);
4679  bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
4681  DeclContext *Ctx,
4682  bool AllowMissing, FunctionDecl *&Operator,
4683  bool Diagnose = true);
4684  void DeclareGlobalNewDelete();
4686  QualType Param1,
4687  QualType Param2 = QualType(),
4688  bool addRestrictAttr = false);
4689 
4691  DeclarationName Name, FunctionDecl* &Operator,
4692  bool Diagnose = true);
4694  bool CanProvideSize,
4695  DeclarationName Name);
4696 
4697  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
4699  bool UseGlobal, bool ArrayForm,
4700  Expr *Operand);
4701 
4704  SourceLocation StmtLoc,
4705  bool ConvertToBoolean);
4706 
4708  Expr *Operand, SourceLocation RParen);
4710  SourceLocation RParen);
4711 
4712  /// \brief Parsed one of the type trait support pseudo-functions.
4714  ArrayRef<ParsedType> Args,
4715  SourceLocation RParenLoc);
4718  SourceLocation RParenLoc);
4719 
4720  /// ActOnArrayTypeTrait - Parsed one of the bianry type trait support
4721  /// pseudo-functions.
4723  SourceLocation KWLoc,
4724  ParsedType LhsTy,
4725  Expr *DimExpr,
4726  SourceLocation RParen);
4727 
4729  SourceLocation KWLoc,
4730  TypeSourceInfo *TSInfo,
4731  Expr *DimExpr,
4732  SourceLocation RParen);
4733 
4734  /// ActOnExpressionTrait - Parsed one of the unary type trait support
4735  /// pseudo-functions.
4737  SourceLocation KWLoc,
4738  Expr *Queried,
4739  SourceLocation RParen);
4740 
4742  SourceLocation KWLoc,
4743  Expr *Queried,
4744  SourceLocation RParen);
4745 
4747  Expr *Base,
4748  SourceLocation OpLoc,
4749  tok::TokenKind OpKind,
4750  ParsedType &ObjectType,
4751  bool &MayBePseudoDestructor);
4752 
4754  SourceLocation OpLoc,
4755  tok::TokenKind OpKind,
4756  const CXXScopeSpec &SS,
4757  TypeSourceInfo *ScopeType,
4758  SourceLocation CCLoc,
4759  SourceLocation TildeLoc,
4760  PseudoDestructorTypeStorage DestroyedType);
4761 
4763  SourceLocation OpLoc,
4764  tok::TokenKind OpKind,
4765  CXXScopeSpec &SS,
4766  UnqualifiedId &FirstTypeName,
4767  SourceLocation CCLoc,
4768  SourceLocation TildeLoc,
4769  UnqualifiedId &SecondTypeName);
4770 
4772  SourceLocation OpLoc,
4773  tok::TokenKind OpKind,
4774  SourceLocation TildeLoc,
4775  const DeclSpec& DS);
4776 
4777  /// MaybeCreateExprWithCleanups - If the current full-expression
4778  /// requires any cleanups, surround it with a ExprWithCleanups node.
4779  /// Otherwise, just returns the passed-in expression.
4783 
4785  return ActOnFinishFullExpr(Expr, Expr ? Expr->getExprLoc()
4786  : SourceLocation());
4787  }
4789  bool DiscardedValue = false,
4790  bool IsConstexpr = false,
4791  bool IsLambdaInitCaptureInitializer = false);
4793 
4794  // Marks SS invalid if it represents an incomplete type.
4796 
4799  bool EnteringContext = false);
4800  bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
4802 
4803  /// \brief The parser has parsed a global nested-name-specifier '::'.
4804  ///
4805  /// \param CCLoc The location of the '::'.
4806  ///
4807  /// \param SS The nested-name-specifier, which will be updated in-place
4808  /// to reflect the parsed nested-name-specifier.
4809  ///
4810  /// \returns true if an error occurred, false otherwise.
4812 
4813  /// \brief The parser has parsed a '__super' nested-name-specifier.
4814  ///
4815  /// \param SuperLoc The location of the '__super' keyword.
4816  ///
4817  /// \param ColonColonLoc The location of the '::'.
4818  ///
4819  /// \param SS The nested-name-specifier, which will be updated in-place
4820  /// to reflect the parsed nested-name-specifier.
4821  ///
4822  /// \returns true if an error occurred, false otherwise.
4824  SourceLocation ColonColonLoc, CXXScopeSpec &SS);
4825 
4827  bool *CanCorrect = nullptr);
4829 
4831  SourceLocation IdLoc,
4832  IdentifierInfo &II,
4833  ParsedType ObjectType);
4834 
4836  IdentifierInfo &Identifier,
4838  SourceLocation CCLoc,
4839  QualType ObjectType,
4840  bool EnteringContext,
4841  CXXScopeSpec &SS,
4842  NamedDecl *ScopeLookupResult,
4843  bool ErrorRecoveryLookup,
4844  bool *IsCorrectedToColon = nullptr);
4845 
4846  /// \brief The parser has parsed a nested-name-specifier 'identifier::'.
4847  ///
4848  /// \param S The scope in which this nested-name-specifier occurs.
4849  ///
4850  /// \param Identifier The identifier preceding the '::'.
4851  ///
4852  /// \param IdentifierLoc The location of the identifier.
4853  ///
4854  /// \param CCLoc The location of the '::'.
4855  ///
4856  /// \param ObjectType The type of the object, if we're parsing
4857  /// nested-name-specifier in a member access expression.
4858  ///
4859  /// \param EnteringContext Whether we're entering the context nominated by
4860  /// this nested-name-specifier.
4861  ///
4862  /// \param SS The nested-name-specifier, which is both an input
4863  /// parameter (the nested-name-specifier before this type) and an
4864  /// output parameter (containing the full nested-name-specifier,
4865  /// including this new type).
4866  ///
4867  /// \param ErrorRecoveryLookup If true, then this method is called to improve
4868  /// error recovery. In this case do not emit error message.
4869  ///
4870  /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
4871  /// are allowed. The bool value pointed by this parameter is set to 'true'
4872  /// if the identifier is treated as if it was followed by ':', not '::'.
4873  ///
4874  /// \returns true if an error occurred, false otherwise.
4876  IdentifierInfo &Identifier,
4878  SourceLocation CCLoc,
4879  ParsedType ObjectType,
4880  bool EnteringContext,
4881  CXXScopeSpec &SS,
4882  bool ErrorRecoveryLookup = false,
4883  bool *IsCorrectedToColon = nullptr);
4884 
4886 
4888  const DeclSpec &DS,
4889  SourceLocation ColonColonLoc);
4890 
4892  IdentifierInfo &Identifier,
4895  ParsedType ObjectType,
4896  bool EnteringContext);
4897 
4898  /// \brief The parser has parsed a nested-name-specifier
4899  /// 'template[opt] template-name < template-args >::'.
4900  ///
4901  /// \param S The scope in which this nested-name-specifier occurs.
4902  ///
4903  /// \param SS The nested-name-specifier, which is both an input
4904  /// parameter (the nested-name-specifier before this type) and an
4905  /// output parameter (containing the full nested-name-specifier,
4906  /// including this new type).
4907  ///
4908  /// \param TemplateKWLoc the location of the 'template' keyword, if any.
4909  /// \param TemplateName the template name.
4910  /// \param TemplateNameLoc The location of the template name.
4911  /// \param LAngleLoc The location of the opening angle bracket ('<').
4912  /// \param TemplateArgs The template arguments.
4913  /// \param RAngleLoc The location of the closing angle bracket ('>').
4914  /// \param CCLoc The location of the '::'.
4915  ///
4916  /// \param EnteringContext Whether we're entering the context of the
4917  /// nested-name-specifier.
4918  ///
4919  ///
4920  /// \returns true if an error occurred, false otherwise.
4922  CXXScopeSpec &SS,
4923  SourceLocation TemplateKWLoc,
4925  SourceLocation TemplateNameLoc,
4926  SourceLocation LAngleLoc,
4927  ASTTemplateArgsPtr TemplateArgs,
4928  SourceLocation RAngleLoc,
4929  SourceLocation CCLoc,
4930  bool EnteringContext);
4931 
4932  /// \brief Given a C++ nested-name-specifier, produce an annotation value
4933  /// that the parser can use later to reconstruct the given
4934  /// nested-name-specifier.
4935  ///
4936  /// \param SS A nested-name-specifier.
4937  ///
4938  /// \returns A pointer containing all of the information in the
4939  /// nested-name-specifier \p SS.
4941 
4942  /// \brief Given an annotation pointer for a nested-name-specifier, restore
4943  /// the nested-name-specifier structure.
4944  ///
4945  /// \param Annotation The annotation pointer, produced by
4946  /// \c SaveNestedNameSpecifierAnnotation().
4947  ///
4948  /// \param AnnotationRange The source range corresponding to the annotation.
4949  ///
4950  /// \param SS The nested-name-specifier that will be updated with the contents
4951  /// of the annotation pointer.
4952  void RestoreNestedNameSpecifierAnnotation(void *Annotation,
4953  SourceRange AnnotationRange,
4954  CXXScopeSpec &SS);
4955 
4956  bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
4957 
4958  /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
4959  /// scope or nested-name-specifier) is parsed, part of a declarator-id.
4960  /// After this method is called, according to [C++ 3.4.3p3], names should be
4961  /// looked up in the declarator-id's scope, until the declarator is parsed and
4962  /// ActOnCXXExitDeclaratorScope is called.
4963  /// The 'SS' should be a non-empty valid CXXScopeSpec.
4965 
4966  /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
4967  /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
4968  /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
4969  /// Used to indicate that names should revert to being looked up in the
4970  /// defining scope.
4971  void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
4972 
4973  /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
4974  /// initializer for the declaration 'Dcl'.
4975  /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
4976  /// static data member of class X, names should be looked up in the scope of
4977  /// class X.
4978  void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl);
4979 
4980  /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
4981  /// initializer for the declaration 'Dcl'.
4982  void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
4983 
4984  /// \brief Create a new lambda closure type.
4986  TypeSourceInfo *Info,
4987  bool KnownDependent,
4988  LambdaCaptureDefault CaptureDefault);
4989 
4990  /// \brief Start the definition of a lambda expression.
4992  SourceRange IntroducerRange,
4993  TypeSourceInfo *MethodType,
4994  SourceLocation EndLoc,
4995  ArrayRef<ParmVarDecl *> Params);
4996 
4997  /// \brief Endow the lambda scope info with the relevant properties.
4999  CXXMethodDecl *CallOperator,
5000  SourceRange IntroducerRange,
5001  LambdaCaptureDefault CaptureDefault,
5002  SourceLocation CaptureDefaultLoc,
5003  bool ExplicitParams,
5004  bool ExplicitResultType,
5005  bool Mutable);
5006 
5007  /// \brief Perform initialization analysis of the init-capture and perform
5008  /// any implicit conversions such as an lvalue-to-rvalue conversion if
5009  /// not being used to initialize a reference.
5011  SourceLocation Loc, bool ByRef, IdentifierInfo *Id,
5012  LambdaCaptureInitKind InitKind, Expr *&Init) {
5014  Loc, ByRef, Id, InitKind != LambdaCaptureInitKind::CopyInit, Init));
5015  }
5017  IdentifierInfo *Id,
5018  bool DirectInit, Expr *&Init);
5019 
5020  /// \brief Create a dummy variable within the declcontext of the lambda's
5021  /// call operator, for name lookup purposes for a lambda init capture.
5022  ///
5023  /// CodeGen handles emission of lambda captures, ignoring these dummy
5024  /// variables appropriately.
5026  QualType InitCaptureType,
5027  IdentifierInfo *Id,
5028  unsigned InitStyle, Expr *Init);
5029 
5030  /// \brief Build the implicit field for an init-capture.
5032 
5033  /// \brief Note that we have finished the explicit captures for the
5034  /// given lambda.
5036 
5037  /// \brief Introduce the lambda parameters into scope.
5038  void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope);
5039 
5040  /// \brief Deduce a block or lambda's return type based on the return
5041  /// statements present in the body.
5043 
5044  /// ActOnStartOfLambdaDefinition - This is called just before we start
5045  /// parsing the body of a lambda; it analyzes the explicit captures and
5046  /// arguments, and sets up various data-structures for the body of the
5047  /// lambda.
5049  Declarator &ParamInfo, Scope *CurScope);
5050 
5051  /// ActOnLambdaError - If there is an error parsing a lambda, this callback
5052  /// is invoked to pop the information about the lambda.
5053  void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
5054  bool IsInstantiation = false);
5055 
5056  /// ActOnLambdaExpr - This is called when the body of a lambda expression
5057  /// was successfully completed.
5059  Scope *CurScope);
5060 
5061  /// \brief Complete a lambda-expression having processed and attached the
5062  /// lambda body.
5064  sema::LambdaScopeInfo *LSI);
5065 
5066  /// \brief Define the "body" of the conversion from a lambda object to a
5067  /// function pointer.
5068  ///
5069  /// This routine doesn't actually define a sensible body; rather, it fills
5070  /// in the initialization expression needed to copy the lambda object into
5071  /// the block, and IR generation actually generates the real body of the
5072  /// block pointer conversion.
5074  SourceLocation CurrentLoc, CXXConversionDecl *Conv);
5075 
5076  /// \brief Define the "body" of the conversion from a lambda object to a
5077  /// block pointer.
5078  ///
5079  /// This routine doesn't actually define a sensible body; rather, it fills
5080  /// in the initialization expression needed to copy the lambda object into
5081  /// the block, and IR generation actually generates the real body of the
5082  /// block pointer conversion.
5084  CXXConversionDecl *Conv);
5085 
5087  SourceLocation ConvLocation,
5088  CXXConversionDecl *Conv,
5089  Expr *Src);
5090 
5091  // ParseObjCStringLiteral - Parse Objective-C string literals.
5093  ArrayRef<Expr *> Strings);
5094 
5096 
5097  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
5098  /// numeric literal expression. Type of the expression will be "NSNumber *"
5099  /// or "id" if NSNumber is unavailable.
5102  bool Value);
5104 
5105  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
5106  /// '@' prefixed parenthesized expression. The type of the expression will
5107  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
5108  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
5109  /// "const char *" or C structure with attribute 'objc_boxable'.
5111 
5113  Expr *IndexExpr,
5114  ObjCMethodDecl *getterMethod,
5115  ObjCMethodDecl *setterMethod);
5116 
5119 
5121  TypeSourceInfo *EncodedTypeInfo,
5122  SourceLocation RParenLoc);
5124  CXXConversionDecl *Method,
5125  bool HadMultipleCandidates);
5126 
5128  SourceLocation EncodeLoc,
5129  SourceLocation LParenLoc,
5130  ParsedType Ty,
5131  SourceLocation RParenLoc);
5132 
5133  /// ParseObjCSelectorExpression - Build selector expression for \@selector
5135  SourceLocation AtLoc,
5136  SourceLocation SelLoc,
5137  SourceLocation LParenLoc,
5138  SourceLocation RParenLoc,
5139  bool WarnMultipleSelectors);
5140 
5141  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
5143  SourceLocation AtLoc,
5144  SourceLocation ProtoLoc,
5145  SourceLocation LParenLoc,
5146  SourceLocation ProtoIdLoc,
5147  SourceLocation RParenLoc);
5148 
5149  //===--------------------------------------------------------------------===//
5150  // C++ Declarations
5151  //
5153  SourceLocation ExternLoc,
5154  Expr *LangStr,
5155  SourceLocation LBraceLoc);
5157  Decl *LinkageSpec,
5158  SourceLocation RBraceLoc);
5159 
5160 
5161  //===--------------------------------------------------------------------===//
5162  // C++ Classes
5163  //
5164  bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
5165  const CXXScopeSpec *SS = nullptr);
5166  bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS);
5167 
5169  SourceLocation ASLoc,
5171  AttributeList *Attrs = nullptr);
5172 
5174  Declarator &D,
5175  MultiTemplateParamsArg TemplateParameterLists,
5176  Expr *BitfieldWidth, const VirtSpecifiers &VS,
5177  InClassInitStyle InitStyle);
5178 
5181  SourceLocation EqualLoc,
5182  Expr *Init);
5183 
5184  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5185  Scope *S,
5186  CXXScopeSpec &SS,
5187  IdentifierInfo *MemberOrBase,
5188  ParsedType TemplateTypeTy,
5189  const DeclSpec &DS,
5190  SourceLocation IdLoc,
5191  SourceLocation LParenLoc,
5192  ArrayRef<Expr *> Args,
5193  SourceLocation RParenLoc,
5194  SourceLocation EllipsisLoc);
5195 
5196  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5197  Scope *S,
5198  CXXScopeSpec &SS,
5199  IdentifierInfo *MemberOrBase,
5200  ParsedType TemplateTypeTy,
5201  const DeclSpec &DS,
5202  SourceLocation IdLoc,
5203  Expr *InitList,
5204  SourceLocation EllipsisLoc);
5205 
5206  MemInitResult BuildMemInitializer(Decl *ConstructorD,
5207  Scope *S,
5208  CXXScopeSpec &SS,
5209  IdentifierInfo *MemberOrBase,
5210  ParsedType TemplateTypeTy,
5211  const DeclSpec &DS,
5212  SourceLocation IdLoc,
5213  Expr *Init,
5214  SourceLocation EllipsisLoc);
5215 
5217  Expr *Init,
5218  SourceLocation IdLoc);
5219 
5221  TypeSourceInfo *BaseTInfo,
5222  Expr *Init,
5223  CXXRecordDecl *ClassDecl,
5224  SourceLocation EllipsisLoc);
5225 
5227  Expr *Init,
5228  CXXRecordDecl *ClassDecl);
5229 
5230  bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
5231  CXXCtorInitializer *Initializer);
5232 
5233  bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
5234  ArrayRef<CXXCtorInitializer *> Initializers = None);
5235 
5236  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
5237 
5238 
5239  /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
5240  /// mark all the non-trivial destructors of its members and bases as
5241  /// referenced.
5243  CXXRecordDecl *Record);
5244 
5245  /// \brief The list of classes whose vtables have been used within
5246  /// this translation unit, and the source locations at which the
5247  /// first use occurred.
5248  typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
5249 
5250  /// \brief The list of vtables that are required but have not yet been
5251  /// materialized.
5253 
5254  /// \brief The set of classes whose vtables have been used within
5255  /// this translation unit, and a bit that will be true if the vtable is
5256  /// required to be emitted (otherwise, it should be emitted only if needed
5257  /// by code generation).
5258  llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
5259 
5260  /// \brief Load any externally-stored vtable uses.
5261  void LoadExternalVTableUses();
5262 
5263  /// \brief Note that the vtable for the given class was used at the
5264  /// given location.
5265  void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
5266  bool DefinitionRequired = false);
5267 
5268  /// \brief Mark the exception specifications of all virtual member functions
5269  /// in the given class as needed.
5271  const CXXRecordDecl *RD);
5272 
5273  /// MarkVirtualMembersReferenced - Will mark all members of the given
5274  /// CXXRecordDecl referenced.
5276  const CXXRecordDecl *RD);
5277 
5278  /// \brief Define all of the vtables that have been used in this
5279  /// translation unit and reference any virtual members used by those
5280  /// vtables.
5281  ///
5282  /// \returns true if any work was done, false otherwise.
5283  bool DefineUsedVTables();
5284 
5286 
5287  void ActOnMemInitializers(Decl *ConstructorDecl,
5290  bool AnyErrors);
5291 
5294  CXXRecordDecl *Class, Attr *ClassAttr,
5295  ClassTemplateSpecializationDecl *BaseTemplateSpec,
5296  SourceLocation BaseLoc);
5297  void CheckCompletedCXXClass(CXXRecordDecl *Record);
5299  Decl *TagDecl,
5300  SourceLocation LBrac,
5301  SourceLocation RBrac,
5302  AttributeList *AttrList);
5305 
5307  unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template);
5310  void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
5315  CachedTokens &Toks);
5318 
5320  Expr *AssertExpr,
5321  Expr *AssertMessageExpr,
5322  SourceLocation RParenLoc);
5324  Expr *AssertExpr,
5325  StringLiteral *AssertMessageExpr,
5326  SourceLocation RParenLoc,
5327  bool Failed);
5328 
5330  SourceLocation FriendLoc,
5331  TypeSourceInfo *TSInfo);
5332  Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
5333  MultiTemplateParamsArg TemplateParams);
5335  MultiTemplateParamsArg TemplateParams);
5336 
5338  StorageClass& SC);
5339  void CheckConstructor(CXXConstructorDecl *Constructor);
5341  StorageClass& SC);
5342  bool CheckDestructor(CXXDestructorDecl *Destructor);
5344  StorageClass& SC);
5346 
5349  const FunctionProtoType *T);
5351 
5352  //===--------------------------------------------------------------------===//
5353  // C++ Derived Classes
5354  //
5355 
5356  /// ActOnBaseSpecifier - Parsed a base specifier
5358  SourceRange SpecifierRange,
5359  bool Virtual, AccessSpecifier Access,
5360  TypeSourceInfo *TInfo,
5361  SourceLocation EllipsisLoc);
5362 
5363  BaseResult ActOnBaseSpecifier(Decl *classdecl,
5364  SourceRange SpecifierRange,
5365  ParsedAttributes &Attrs,
5366  bool Virtual, AccessSpecifier Access,
5367  ParsedType basetype,
5368  SourceLocation BaseLoc,
5369  SourceLocation EllipsisLoc);
5370 
5371  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
5373  void ActOnBaseSpecifiers(Decl *ClassDecl,
5375 
5376  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base);
5377  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
5378  CXXBasePaths &Paths);
5379 
5380  // FIXME: I don't like this name.
5381  void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
5382 
5384  SourceLocation Loc, SourceRange Range,
5385  CXXCastPath *BasePath = nullptr,
5386  bool IgnoreAccess = false);
5388  unsigned InaccessibleBaseID,
5389  unsigned AmbigiousBaseConvID,
5390  SourceLocation Loc, SourceRange Range,
5391  DeclarationName Name,
5392  CXXCastPath *BasePath,
5393  bool IgnoreAccess = false);
5394 
5395  std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
5396 
5398  const CXXMethodDecl *Old);
5399 
5400  /// CheckOverridingFunctionReturnType - Checks whether the return types are
5401  /// covariant, according to C++ [class.virtual]p5.
5403  const CXXMethodDecl *Old);
5404 
5405  /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
5406  /// spec is a subset of base spec.
5408  const CXXMethodDecl *Old);
5409 
5410  bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
5411 
5412  /// CheckOverrideControl - Check C++11 override control semantics.
5414 
5415  /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
5416  /// not used in the declaration of an overriding method.
5418 
5419  /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
5420  /// overrides a virtual member function marked 'final', according to
5421  /// C++11 [class.virtual]p4.
5423  const CXXMethodDecl *Old);
5424 
5425 
5426  //===--------------------------------------------------------------------===//
5427  // C++ Access Control
5428  //
5429 
5435  };
5436 
5437  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
5438  NamedDecl *PrevMemberDecl,
5439  AccessSpecifier LexicalAS);
5440 
5442  DeclAccessPair FoundDecl);
5444  DeclAccessPair FoundDecl);
5446  SourceRange PlacementRange,
5447  CXXRecordDecl *NamingClass,
5448  DeclAccessPair FoundDecl,
5449  bool Diagnose = true);
5451  CXXConstructorDecl *D,
5452  const InitializedEntity &Entity,
5453  AccessSpecifier Access,
5454  bool IsCopyBindingRefToTemp = false);
5456  CXXConstructorDecl *D,
5457  const InitializedEntity &Entity,
5458  AccessSpecifier Access,
5459  const PartialDiagnostic &PDiag);
5461  CXXDestructorDecl *Dtor,
5462  const PartialDiagnostic &PDiag,
5463  QualType objectType = QualType());
5466  CXXRecordDecl *NamingClass,
5467  DeclAccessPair Found);
5469  Expr *ObjectExpr,
5470  Expr *ArgExpr,
5471  DeclAccessPair FoundDecl);
5473  DeclAccessPair FoundDecl);
5475  QualType Base, QualType Derived,
5476  const CXXBasePath &Path,
5477  unsigned DiagID,
5478  bool ForceCheck = false,
5479  bool ForceUnprivileged = false);
5480  void CheckLookupAccess(const LookupResult &R);
5483  AccessSpecifier access,
5484  QualType objectType);
5485 
5487  const MultiLevelTemplateArgumentList &TemplateArgs);
5488  void PerformDependentDiagnostics(const DeclContext *Pattern,
5489  const MultiLevelTemplateArgumentList &TemplateArgs);
5490 
5492 
5493  /// \brief When true, access checking violations are treated as SFINAE
5494  /// failures rather than hard errors.
5496 
5506  };
5507 
5508  bool isAbstractType(SourceLocation Loc, QualType T);
5510  TypeDiagnoser &Diagnoser);
5511  template <typename... Ts>
5512  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
5513  const Ts &...Args) {
5514  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
5515  return RequireNonAbstractType(Loc, T, Diagnoser);
5516  }
5517 
5518  void DiagnoseAbstractType(const CXXRecordDecl *RD);
5519 
5520  //===--------------------------------------------------------------------===//
5521  // C++ Overloaded Operators [C++ 13.5]
5522  //
5523 
5525 
5527 
5528  //===--------------------------------------------------------------------===//
5529  // C++ Templates [C++ 14]
5530  //
5532  bool AllowFunctionTemplates = true);
5534  bool AllowFunctionTemplates = true);
5535 
5537  QualType ObjectType, bool EnteringContext,
5538  bool &MemberOfUnknownSpecialization);
5539 
5541  CXXScopeSpec &SS,
5542  bool hasTemplateKeyword,
5543  UnqualifiedId &Name,
5544  ParsedType ObjectType,
5545  bool EnteringContext,
5546  TemplateTy &Template,
5547  bool &MemberOfUnknownSpecialization);
5548 
5550  SourceLocation IILoc,
5551  Scope *S,
5552  const CXXScopeSpec *SS,
5553  TemplateTy &SuggestedTemplate,
5554  TemplateNameKind &SuggestedKind);
5555 
5558 
5559  Decl *ActOnTypeParameter(Scope *S, bool Typename,
5560  SourceLocation EllipsisLoc,
5561  SourceLocation KeyLoc,
5562  IdentifierInfo *ParamName,
5563  SourceLocation ParamNameLoc,
5564  unsigned Depth, unsigned Position,
5565  SourceLocation EqualLoc,
5566  ParsedType DefaultArg);
5567 
5570  unsigned Depth,
5571  unsigned Position,
5572  SourceLocation EqualLoc,
5573  Expr *DefaultArg);
5575  SourceLocation TmpLoc,
5576  TemplateParameterList *Params,
5577  SourceLocation EllipsisLoc,
5578  IdentifierInfo *ParamName,
5579  SourceLocation ParamNameLoc,
5580  unsigned Depth,
5581  unsigned Position,
5582  SourceLocation EqualLoc,
5583  ParsedTemplateArgument DefaultArg);
5584 
5587  SourceLocation ExportLoc,
5588  SourceLocation TemplateLoc,
5589  SourceLocation LAngleLoc,
5590  ArrayRef<Decl *> Params,
5591  SourceLocation RAngleLoc);
5592 
5593  /// \brief The context in which we are checking a template parameter list.
5603  };
5604 
5606  TemplateParameterList *OldParams,
5609  SourceLocation DeclStartLoc, SourceLocation DeclLoc,
5610  const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
5612  bool IsFriend, bool &IsExplicitSpecialization, bool &Invalid);
5613 
5614  DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
5615  SourceLocation KWLoc, CXXScopeSpec &SS,
5616  IdentifierInfo *Name, SourceLocation NameLoc,
5618  TemplateParameterList *TemplateParams,
5619  AccessSpecifier AS,
5620  SourceLocation ModulePrivateLoc,
5621  SourceLocation FriendLoc,
5622  unsigned NumOuterTemplateParamLists,
5623  TemplateParameterList **OuterTemplateParamLists,
5624  SkipBodyInfo *SkipBody = nullptr);
5625 
5628 
5630 
5632  SourceLocation TemplateLoc,
5633  TemplateArgumentListInfo &TemplateArgs);
5634 
5635  TypeResult
5636  ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5637  TemplateTy Template, SourceLocation TemplateLoc,
5638  SourceLocation LAngleLoc,
5639  ASTTemplateArgsPtr TemplateArgs,
5640  SourceLocation RAngleLoc,
5641  bool IsCtorOrDtorName = false);
5642 
5643  /// \brief Parsed an elaborated-type-specifier that refers to a template-id,
5644  /// such as \c class T::template apply<U>.
5646  TypeSpecifierType TagSpec,
5647  SourceLocation TagLoc,
5648  CXXScopeSpec &SS,
5649  SourceLocation TemplateKWLoc,
5650  TemplateTy TemplateD,
5651  SourceLocation TemplateLoc,
5652  SourceLocation LAngleLoc,
5653  ASTTemplateArgsPtr TemplateArgsIn,
5654  SourceLocation RAngleLoc);
5655 
5657  Scope *S, Declarator &D, TypeSourceInfo *DI,
5658  SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
5659  StorageClass SC, bool IsPartialSpecialization);
5660 
5662  SourceLocation TemplateLoc,
5663  SourceLocation TemplateNameLoc,
5664  const TemplateArgumentListInfo &TemplateArgs);
5665 
5667  const DeclarationNameInfo &NameInfo,
5668  VarTemplateDecl *Template,
5669  SourceLocation TemplateLoc,
5670  const TemplateArgumentListInfo *TemplateArgs);
5671 
5673  SourceLocation TemplateKWLoc,
5674  LookupResult &R,
5675  bool RequiresADL,
5676  const TemplateArgumentListInfo *TemplateArgs);
5677 
5679  SourceLocation TemplateKWLoc,
5680  const DeclarationNameInfo &NameInfo,
5681  const TemplateArgumentListInfo *TemplateArgs);
5682 
5684  CXXScopeSpec &SS,
5685  SourceLocation TemplateKWLoc,
5686  UnqualifiedId &Name,
5687  ParsedType ObjectType,
5688  bool EnteringContext,
5689  TemplateTy &Template);
5690 
5691  DeclResult
5692  ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
5693  SourceLocation KWLoc,
5694  SourceLocation ModulePrivateLoc,
5695  TemplateIdAnnotation &TemplateId,
5697  MultiTemplateParamsArg TemplateParameterLists,
5698  SkipBodyInfo *SkipBody = nullptr);
5699 
5701  MultiTemplateParamsArg TemplateParameterLists,
5702  Declarator &D);
5703 
5704  bool
5707  NamedDecl *PrevDecl,
5709  SourceLocation PrevPtOfInstantiation,
5710  bool &SuppressNew);
5711 
5713  const TemplateArgumentListInfo &ExplicitTemplateArgs,
5715 
5717  TemplateArgumentListInfo *ExplicitTemplateArgs,
5720 
5721  DeclResult
5723  SourceLocation ExternLoc,
5724  SourceLocation TemplateLoc,
5725  unsigned TagSpec,
5726  SourceLocation KWLoc,
5727  const CXXScopeSpec &SS,
5728  TemplateTy Template,
5729  SourceLocation TemplateNameLoc,
5730  SourceLocation LAngleLoc,
5731  ASTTemplateArgsPtr TemplateArgs,
5732  SourceLocation RAngleLoc,
5733  AttributeList *Attr);
5734 
5735  DeclResult
5737  SourceLocation ExternLoc,
5738  SourceLocation TemplateLoc,
5739  unsigned TagSpec,
5740  SourceLocation KWLoc,
5741  CXXScopeSpec &SS,
5742  IdentifierInfo *Name,
5743  SourceLocation NameLoc,
5744  AttributeList *Attr);
5745 
5747  SourceLocation ExternLoc,
5748  SourceLocation TemplateLoc,
5749  Declarator &D);
5750 
5753  SourceLocation TemplateLoc,
5754  SourceLocation RAngleLoc,
5755  Decl *Param,
5757  &Converted,
5758  bool &HasDefaultArg);
5759 
5760  /// \brief Specifies the context in which a particular template
5761  /// argument is being checked.
5763  /// \brief The template argument was specified in the code or was
5764  /// instantiated with some deduced template arguments.
5766 
5767  /// \brief The template argument was deduced via template argument
5768  /// deduction.
5770 
5771  /// \brief The template argument was deduced from an array bound
5772  /// via template argument deduction.
5774  };
5775 
5776  bool CheckTemplateArgument(NamedDecl *Param,
5777  TemplateArgumentLoc &Arg,
5778  NamedDecl *Template,
5779  SourceLocation TemplateLoc,
5780  SourceLocation RAngleLoc,
5781  unsigned ArgumentPackIndex,
5784 
5785  /// \brief Check that the given template arguments can be be provided to
5786  /// the given template, converting the arguments along the way.
5787  ///
5788  /// \param Template The template to which the template arguments are being
5789  /// provided.
5790  ///
5791  /// \param TemplateLoc The location of the template name in the source.
5792  ///
5793  /// \param TemplateArgs The list of template arguments. If the template is
5794  /// a template template parameter, this function may extend the set of
5795  /// template arguments to also include substituted, defaulted template
5796  /// arguments.
5797  ///
5798  /// \param PartialTemplateArgs True if the list of template arguments is
5799  /// intentionally partial, e.g., because we're checking just the initial
5800  /// set of template arguments.
5801  ///
5802  /// \param Converted Will receive the converted, canonicalized template
5803  /// arguments.
5804  ///
5805  /// \returns true if an error occurred, false otherwise.
5806  bool CheckTemplateArgumentList(TemplateDecl *Template,
5807  SourceLocation TemplateLoc,
5808  TemplateArgumentListInfo &TemplateArgs,
5809  bool PartialTemplateArgs,
5811 
5813  TemplateArgumentLoc &Arg,
5815 
5817  TypeSourceInfo *Arg);
5819  QualType InstantiatedParamType, Expr *Arg,
5820  TemplateArgument &Converted,
5823  TemplateArgumentLoc &Arg,
5824  unsigned ArgumentPackIndex);
5825 
5826  ExprResult
5828  QualType ParamType,
5829  SourceLocation Loc);
5830  ExprResult
5832  SourceLocation Loc);
5833 
5834  /// \brief Enumeration describing how template parameter lists are compared
5835  /// for equality.
5837  /// \brief We are matching the template parameter lists of two templates
5838  /// that might be redeclarations.
5839  ///
5840  /// \code
5841  /// template<typename T> struct X;
5842  /// template<typename T> struct X;
5843  /// \endcode
5845 
5846  /// \brief We are matching the template parameter lists of two template
5847  /// template parameters as part of matching the template parameter lists
5848  /// of two templates that might be redeclarations.
5849  ///
5850  /// \code
5851  /// template<template<int I> class TT> struct X;
5852  /// template<template<int Value> class Other> struct X;
5853  /// \endcode
5855 
5856  /// \brief We are matching the template parameter lists of a template
5857  /// template argument against the template parameter lists of a template
5858  /// template parameter.
5859  ///
5860  /// \code
5861  /// template<template<int Value> class Metafun> struct X;
5862  /// template<int Value> struct integer_c;
5863  /// X<integer_c> xic;
5864  /// \endcode
5866  };
5867 
5869  TemplateParameterList *Old,
5870  bool Complain,
5872  SourceLocation TemplateArgLoc
5873  = SourceLocation());
5874 
5875  bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
5876 
5877  /// \brief Called when the parser has parsed a C++ typename
5878  /// specifier, e.g., "typename T::type".
5879  ///
5880  /// \param S The scope in which this typename type occurs.
5881  /// \param TypenameLoc the location of the 'typename' keyword
5882  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
5883  /// \param II the identifier we're retrieving (e.g., 'type' in the example).
5884  /// \param IdLoc the location of the identifier.
5885  TypeResult
5886  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
5887  const CXXScopeSpec &SS, const IdentifierInfo &II,
5888  SourceLocation IdLoc);
5889 
5890  /// \brief Called when the parser has parsed a C++ typename
5891  /// specifier that ends in a template-id, e.g.,
5892  /// "typename MetaFun::template apply<T1, T2>".
5893  ///
5894  /// \param S The scope in which this typename type occurs.
5895  /// \param TypenameLoc the location of the 'typename' keyword
5896  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
5897  /// \param TemplateLoc the location of the 'template' keyword, if any.
5898  /// \param TemplateName The template name.
5899  /// \param TemplateNameLoc The location of the template name.
5900  /// \param LAngleLoc The location of the opening angle bracket ('<').
5901  /// \param TemplateArgs The template arguments.
5902  /// \param RAngleLoc The location of the closing angle bracket ('>').
5903  TypeResult
5904  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
5905  const CXXScopeSpec &SS,
5906  SourceLocation TemplateLoc,
5908  SourceLocation TemplateNameLoc,
5909  SourceLocation LAngleLoc,
5910  ASTTemplateArgsPtr TemplateArgs,
5911  SourceLocation RAngleLoc);
5912 
5914  SourceLocation KeywordLoc,
5915  NestedNameSpecifierLoc QualifierLoc,
5916  const IdentifierInfo &II,
5917  SourceLocation IILoc);
5918 
5920  SourceLocation Loc,
5921  DeclarationName Name);
5923 
5926  TemplateParameterList *Params);
5927 
5928  std::string
5930  const TemplateArgumentList &Args);
5931 
5932  std::string
5934  const TemplateArgument *Args,
5935  unsigned NumArgs);
5936 
5937  //===--------------------------------------------------------------------===//
5938  // C++ Variadic Templates (C++0x [temp.variadic])
5939  //===--------------------------------------------------------------------===//
5940 
5941  /// Determine whether an unexpanded parameter pack might be permitted in this
5942  /// location. Useful for error recovery.
5944 
5945  /// \brief The context in which an unexpanded parameter pack is
5946  /// being diagnosed.
5947  ///
5948  /// Note that the values of this enumeration line up with the first
5949  /// argument to the \c err_unexpanded_parameter_pack diagnostic.
5951  /// \brief An arbitrary expression.
5953 
5954  /// \brief The base type of a class type.
5956 
5957  /// \brief The type of an arbitrary declaration.
5959 
5960  /// \brief The type of a data member.
5962 
5963  /// \brief The size of a bit-field.
5965 
5966  /// \brief The expression in a static assertion.
5968 
5969  /// \brief The fixed underlying type of an enumeration.
5971 
5972  /// \brief The enumerator value.
5974 
5975  /// \brief A using declaration.
5977 
5978  /// \brief A friend declaration.
5980 
5981  /// \brief A declaration qualifier.
5983 
5984  /// \brief An initializer.
5986 
5987  /// \brief A default argument.
5989 
5990  /// \brief The type of a non-type template parameter.
5992 
5993  /// \brief The type of an exception.
5995 
5996  /// \brief Partial specialization.
5998 
5999  /// \brief Microsoft __if_exists.
6001 
6002  /// \brief Microsoft __if_not_exists.
6004 
6005  /// \brief Lambda expression.
6007 
6008  /// \brief Block expression,
6010  };
6011 
6012  /// \brief Diagnose unexpanded parameter packs.
6013  ///
6014  /// \param Loc The location at which we should emit the diagnostic.
6015  ///
6016  /// \param UPPC The context in which we are diagnosing unexpanded
6017  /// parameter packs.
6018  ///
6019  /// \param Unexpanded the set of unexpanded parameter packs.
6020  ///
6021  /// \returns true if an error occurred, false otherwise.
6025 
6026  /// \brief If the given type contains an unexpanded parameter pack,
6027  /// diagnose the error.
6028  ///
6029  /// \param Loc The source location where a diagnostc should be emitted.
6030  ///
6031  /// \param T The type that is being checked for unexpanded parameter
6032  /// packs.
6033  ///
6034  /// \returns true if an error occurred, false otherwise.
6037 
6038  /// \brief If the given expression contains an unexpanded parameter
6039  /// pack, diagnose the error.
6040  ///
6041  /// \param E The expression that is being checked for unexpanded
6042  /// parameter packs.
6043  ///
6044  /// \returns true if an error occurred, false otherwise.
6047 
6048  /// \brief If the given nested-name-specifier contains an unexpanded
6049  /// parameter pack, diagnose the error.
6050  ///
6051  /// \param SS The nested-name-specifier that is being checked for
6052  /// unexpanded parameter packs.
6053  ///
6054  /// \returns true if an error occurred, false otherwise.
6057 
6058  /// \brief If the given name contains an unexpanded parameter pack,
6059  /// diagnose the error.
6060  ///
6061  /// \param NameInfo The name (with source location information) that
6062  /// is being checked for unexpanded parameter packs.
6063  ///
6064  /// \returns true if an error occurred, false otherwise.
6067 
6068  /// \brief If the given template name contains an unexpanded parameter pack,
6069  /// diagnose the error.
6070  ///
6071  /// \param Loc The location of the template name.
6072  ///
6073  /// \param Template The template name that is being checked for unexpanded
6074  /// parameter packs.
6075  ///
6076  /// \returns true if an error occurred, false otherwise.
6078  TemplateName Template,
6080 
6081  /// \brief If the given template argument contains an unexpanded parameter
6082  /// pack, diagnose the error.
6083  ///
6084  /// \param Arg The template argument that is being checked for unexpanded
6085  /// parameter packs.
6086  ///
6087  /// \returns true if an error occurred, false otherwise.
6090 
6091  /// \brief Collect the set of unexpanded parameter packs within the given
6092  /// template argument.
6093  ///
6094  /// \param Arg The template argument that will be traversed to find
6095  /// unexpanded parameter packs.
6098 
6099  /// \brief Collect the set of unexpanded parameter packs within the given
6100  /// template argument.
6101  ///
6102  /// \param Arg The template argument that will be traversed to find
6103  /// unexpanded parameter packs.
6106 
6107  /// \brief Collect the set of unexpanded parameter packs within the given
6108  /// type.
6109  ///
6110  /// \param T The type that will be traversed to find
6111  /// unexpanded parameter packs.
6114 
6115  /// \brief Collect the set of unexpanded parameter packs within the given
6116  /// type.
6117  ///
6118  /// \param TL The type that will be traversed to find
6119  /// unexpanded parameter packs.
6122 
6123  /// \brief Collect the set of unexpanded parameter packs within the given
6124  /// nested-name-specifier.
6125  ///
6126  /// \param SS The nested-name-specifier that will be traversed to find
6127  /// unexpanded parameter packs.
6130 
6131  /// \brief Collect the set of unexpanded parameter packs within the given
6132  /// name.
6133  ///
6134  /// \param NameInfo The name that will be traversed to find
6135  /// unexpanded parameter packs.
6138 
6139  /// \brief Invoked when parsing a template argument followed by an
6140  /// ellipsis, which creates a pack expansion.
6141  ///
6142  /// \param Arg The template argument preceding the ellipsis, which
6143  /// may already be invalid.
6144  ///
6145  /// \param EllipsisLoc The location of the ellipsis.
6147  SourceLocation EllipsisLoc);
6148 
6149  /// \brief Invoked when parsing a type followed by an ellipsis, which
6150  /// creates a pack expansion.
6151  ///
6152  /// \param Type The type preceding the ellipsis, which will become
6153  /// the pattern of the pack expansion.
6154  ///
6155  /// \param EllipsisLoc The location of the ellipsis.
6157 
6158  /// \brief Construct a pack expansion type from the pattern of the pack
6159  /// expansion.
6161  SourceLocation EllipsisLoc,
6162  Optional<unsigned> NumExpansions);
6163 
6164  /// \brief Construct a pack expansion type from the pattern of the pack
6165  /// expansion.
6167  SourceRange PatternRange,
6168  SourceLocation EllipsisLoc,
6169  Optional<unsigned> NumExpansions);
6170 
6171  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6172  /// creates a pack expansion.
6173  ///
6174  /// \param Pattern The expression preceding the ellipsis, which will become
6175  /// the pattern of the pack expansion.
6176  ///
6177  /// \param EllipsisLoc The location of the ellipsis.
6178  ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
6179 
6180  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6181  /// creates a pack expansion.
6182  ///
6183  /// \param Pattern The expression preceding the ellipsis, which will become
6184  /// the pattern of the pack expansion.
6185  ///
6186  /// \param EllipsisLoc The location of the ellipsis.
6187  ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
6188  Optional<unsigned> NumExpansions);
6189 
6190  /// \brief Determine whether we could expand a pack expansion with the
6191  /// given set of parameter packs into separate arguments by repeatedly
6192  /// transforming the pattern.
6193  ///
6194  /// \param EllipsisLoc The location of the ellipsis that identifies the
6195  /// pack expansion.
6196  ///
6197  /// \param PatternRange The source range that covers the entire pattern of
6198  /// the pack expansion.
6199  ///
6200  /// \param Unexpanded The set of unexpanded parameter packs within the
6201  /// pattern.
6202  ///
6203  /// \param ShouldExpand Will be set to \c true if the transformer should
6204  /// expand the corresponding pack expansions into separate arguments. When
6205  /// set, \c NumExpansions must also be set.
6206  ///
6207  /// \param RetainExpansion Whether the caller should add an unexpanded
6208  /// pack expansion after all of the expanded arguments. This is used
6209  /// when extending explicitly-specified template argument packs per
6210  /// C++0x [temp.arg.explicit]p9.
6211  ///
6212  /// \param NumExpansions The number of separate arguments that will be in
6213  /// the expanded form of the corresponding pack expansion. This is both an
6214  /// input and an output parameter, which can be set by the caller if the
6215  /// number of expansions is known a priori (e.g., due to a prior substitution)
6216  /// and will be set by the callee when the number of expansions is known.
6217  /// The callee must set this value when \c ShouldExpand is \c true; it may
6218  /// set this value in other cases.
6219  ///
6220  /// \returns true if an error occurred (e.g., because the parameter packs
6221  /// are to be instantiated with arguments of different lengths), false
6222  /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
6223  /// must be set.
6225  SourceRange PatternRange,
6227  const MultiLevelTemplateArgumentList &TemplateArgs,
6228  bool &ShouldExpand,
6229  bool &RetainExpansion,
6230  Optional<unsigned> &NumExpansions);
6231 
6232  /// \brief Determine the number of arguments in the given pack expansion
6233  /// type.
6234  ///
6235  /// This routine assumes that the number of arguments in the expansion is
6236  /// consistent across all of the unexpanded parameter packs in its pattern.
6237  ///
6238  /// Returns an empty Optional if the type can't be expanded.
6240  const MultiLevelTemplateArgumentList &TemplateArgs);
6241 
6242  /// \brief Determine whether the given declarator contains any unexpanded
6243  /// parameter packs.
6244  ///
6245  /// This routine is used by the parser to disambiguate function declarators
6246  /// with an ellipsis prior to the ')', e.g.,
6247  ///
6248  /// \code
6249  /// void f(T...);
6250  /// \endcode
6251  ///
6252  /// To determine whether we have an (unnamed) function parameter pack or
6253  /// a variadic function.
6254  ///
6255  /// \returns true if the declarator contains any unexpanded parameter packs,
6256  /// false otherwise.
6258 
6259  /// \brief Returns the pattern of the pack expansion for a template argument.
6260  ///
6261  /// \param OrigLoc The template argument to expand.
6262  ///
6263  /// \param Ellipsis Will be set to the location of the ellipsis.
6264  ///
6265  /// \param NumExpansions Will be set to the number of expansions that will
6266  /// be generated from this pack expansion, if known a priori.
6268  TemplateArgumentLoc OrigLoc,
6269  SourceLocation &Ellipsis,
6270  Optional<unsigned> &NumExpansions) const;
6271 
6272  //===--------------------------------------------------------------------===//
6273  // C++ Template Argument Deduction (C++ [temp.deduct])
6274  //===--------------------------------------------------------------------===//
6275 
6277 
6278  /// \brief Describes the result of template argument deduction.
6279  ///
6280  /// The TemplateDeductionResult enumeration describes the result of
6281  /// template argument deduction, as returned from
6282  /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
6283  /// structure provides additional information about the results of
6284  /// template argument deduction, e.g., the deduced template argument
6285  /// list (if successful) or the specific template parameters or
6286  /// deduced arguments that were involved in the failure.
6288  /// \brief Template argument deduction was successful.
6290  /// \brief The declaration was invalid; do nothing.
6292  /// \brief Template argument deduction exceeded the maximum template
6293  /// instantiation depth (which has already been diagnosed).
6295  /// \brief Template argument deduction did not deduce a value
6296  /// for every template parameter.
6298  /// \brief Template argument deduction produced inconsistent
6299  /// deduced values for the given template parameter.
6301  /// \brief Template argument deduction failed due to inconsistent
6302  /// cv-qualifiers on a template parameter type that would
6303  /// otherwise be deduced, e.g., we tried to deduce T in "const T"
6304  /// but were given a non-const "X".
6306  /// \brief Substitution of the deduced template argument values
6307  /// resulted in an error.
6309  /// \brief After substituting deduced template arguments, a dependent
6310  /// parameter type did not match the corresponding argument.
6312  /// \brief A non-depnedent component of the parameter did not match the
6313  /// corresponding component of the argument.
6315  /// \brief When performing template argument deduction for a function
6316  /// template, there were too many call arguments.
6318  /// \brief When performing template argument deduction for a function
6319  /// template, there were too few call arguments.
6321  /// \brief The explicitly-specified template arguments were not valid
6322  /// template arguments for the given template.
6324  /// \brief The arguments included an overloaded function name that could
6325  /// not be resolved to a suitable function.
6327  /// \brief Deduction failed; that's all we know.
6329  };
6330 
6333  const TemplateArgumentList &TemplateArgs,
6335 
6338  const TemplateArgumentList &TemplateArgs,
6340 
6342  FunctionTemplateDecl *FunctionTemplate,
6343  TemplateArgumentListInfo &ExplicitTemplateArgs,
6347 
6348  /// brief A function argument from which we performed template argument
6349  // deduction for a call.
6351  OriginalCallArg(QualType OriginalParamType,
6352  unsigned ArgIdx,
6353  QualType OriginalArgType)
6354  : OriginalParamType(OriginalParamType), ArgIdx(ArgIdx),
6355  OriginalArgType(OriginalArgType) { }
6356 
6358  unsigned ArgIdx;
6360  };
6361 
6365  unsigned NumExplicitlySpecified,
6366  FunctionDecl *&Specialization,
6368  SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
6369  bool PartialOverloading = false);
6370 
6373  TemplateArgumentListInfo *ExplicitTemplateArgs,
6374  ArrayRef<Expr *> Args,
6375  FunctionDecl *&Specialization,
6377  bool PartialOverloading = false);
6378 
6381  TemplateArgumentListInfo *ExplicitTemplateArgs,
6382  QualType ArgFunctionType,
6383  FunctionDecl *&Specialization,
6385  bool InOverloadResolution = false);
6386 
6389  QualType ToType,
6390  CXXConversionDecl *&Specialization,
6392 
6395  TemplateArgumentListInfo *ExplicitTemplateArgs,
6396  FunctionDecl *&Specialization,
6398  bool InOverloadResolution = false);
6399 
6400  /// \brief Substitute Replacement for \p auto in \p TypeWithAuto
6401  QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
6402  /// \brief Substitute Replacement for auto in TypeWithAuto
6404  QualType Replacement);
6405 
6406  /// \brief Result type of DeduceAutoType.
6411  };
6412 
6414  QualType &Result);
6416  QualType &Result);
6417  void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
6419  bool Diagnose = true);
6420 
6423  SourceRange Range, bool DirectInit,
6424  Expr *Init);
6425 
6427 
6429  SourceLocation ReturnLoc,
6430  Expr *&RetExpr, AutoType *AT);
6431 
6433  FunctionTemplateDecl *FT2,
6434  SourceLocation Loc,
6436  unsigned NumCallArguments1,
6437  unsigned NumCallArguments2);
6440  TemplateSpecCandidateSet &FailedCandidates,
6441  SourceLocation Loc,
6442  const PartialDiagnostic &NoneDiag,
6443  const PartialDiagnostic &AmbigDiag,
6444  const PartialDiagnostic &CandidateDiag,
6445  bool Complain = true, QualType TargetType = QualType());
6446 
6451  SourceLocation Loc);
6452 
6456 
6457  void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
6458  bool OnlyDeduced,
6459  unsigned Depth,
6460  llvm::SmallBitVector &Used);
6462  const FunctionTemplateDecl *FunctionTemplate,
6463  llvm::SmallBitVector &Deduced) {
6464  return MarkDeducedTemplateParameters(Context, FunctionTemplate, Deduced);
6465  }
6466  static void MarkDeducedTemplateParameters(ASTContext &Ctx,
6467  const FunctionTemplateDecl *FunctionTemplate,
6468  llvm::SmallBitVector &Deduced);
6469 
6470  //===--------------------------------------------------------------------===//
6471  // C++ Template Instantiation
6472  //
6473 
6476  const TemplateArgumentList *Innermost = nullptr,
6477  bool RelativeToPrimary = false,
6478  const FunctionDecl *Pattern = nullptr);
6479 
6480  /// \brief A template instantiation that is currently in progress.
6482  /// \brief The kind of template instantiation we are performing
6484  /// We are instantiating a template declaration. The entity is
6485  /// the declaration we're instantiating (e.g., a CXXRecordDecl).
6487 
6488  /// We are instantiating a default argument for a template
6489  /// parameter. The Entity is the template, and
6490  /// TemplateArgs/NumTemplateArguments provides the template
6491  /// arguments as specified.
6492  /// FIXME: Use a TemplateArgumentList
6494 
6495  /// We are instantiating a default argument for a function.
6496  /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
6497  /// provides the template arguments as specified.
6499 
6500  /// We are substituting explicit template arguments provided for
6501  /// a function template. The entity is a FunctionTemplateDecl.
6503 
6504  /// We are substituting template argument determined as part of
6505  /// template argument deduction for either a class template
6506  /// partial specialization or a function template. The
6507  /// Entity is either a ClassTemplatePartialSpecializationDecl or
6508  /// a FunctionTemplateDecl.
6510 
6511  /// We are substituting prior template arguments into a new
6512  /// template parameter. The template parameter itself is either a
6513  /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
6515 
6516  /// We are checking the validity of a default template argument that
6517  /// has been used when naming a template-id.
6519 
6520  /// We are instantiating the exception specification for a function
6521  /// template which was deferred until it was needed.
6522  ExceptionSpecInstantiation
6523  } Kind;
6524 
6525  /// \brief The point of instantiation within the source code.
6527 
6528  /// \brief The template (or partial specialization) in which we are
6529  /// performing the instantiation, for substitutions of prior template
6530  /// arguments.
6532 
6533  /// \brief The entity that is being instantiated.
6535 
6536  /// \brief The list of template arguments we are substituting, if they
6537  /// are not part of the entity.
6539 
6540  /// \brief The number of template arguments in TemplateArgs.
6542 
6543  /// \brief The template deduction info object associated with the
6544  /// substitution or checking of explicit or deduced template arguments.
6546 
6547  /// \brief The source range that covers the construct that cause
6548  /// the instantiation, e.g., the template-id that causes a class
6549  /// template instantiation.
6551 
6553  : Kind(TemplateInstantiation), Template(nullptr), Entity(nullptr),
6554  TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
6555 
6556  /// \brief Determines whether this template is an actual instantiation
6557  /// that should be counted toward the maximum instantiation depth.
6558  bool isInstantiationRecord() const;
6559 
6561  const ActiveTemplateInstantiation &Y) {
6562  if (X.Kind != Y.Kind)
6563  return false;
6564 
6565  if (X.Entity != Y.Entity)
6566  return false;
6567 
6568  switch (X.Kind) {
6569  case TemplateInstantiation:
6570  case ExceptionSpecInstantiation:
6571  return true;
6572 
6573  case PriorTemplateArgumentSubstitution:
6574  case DefaultTemplateArgumentChecking:
6575  return X.Template == Y.Template && X.TemplateArgs == Y.TemplateArgs;
6576 
6577  case DefaultTemplateArgumentInstantiation:
6578  case ExplicitTemplateArgumentSubstitution:
6579  case DeducedTemplateArgumentSubstitution:
6580  case DefaultFunctionArgumentInstantiation:
6581  return X.TemplateArgs == Y.TemplateArgs;
6582 
6583  }
6584 
6585  llvm_unreachable("Invalid InstantiationKind!");
6586  }
6587 
6589  const ActiveTemplateInstantiation &Y) {
6590  return !(X == Y);
6591  }
6592  };
6593 
6594  /// \brief List of active template instantiations.
6595  ///
6596  /// This vector is treated as a stack. As one template instantiation
6597  /// requires another template instantiation, additional
6598  /// instantiations are pushed onto the stack up to a
6599  /// user-configurable limit LangOptions::InstantiationDepth.
6602 
6603  /// \brief Extra modules inspected when performing a lookup during a template
6604  /// instantiation. Computed lazily.
6606 
6607  /// \brief Cache of additional modules that should be used for name lookup
6608  /// within the current template instantiation. Computed lazily; use
6609  /// getLookupModules() to get a complete set.
6611 
6612  /// \brief Get the set of additional modules that should be checked during
6613  /// name lookup. A module and its imports become visible when instanting a
6614  /// template defined within it.
6616 
6617  /// \brief Whether we are in a SFINAE context that is not associated with
6618  /// template instantiation.
6619  ///
6620  /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
6621  /// of a template instantiation or template argument deduction.
6623 
6624  /// \brief The number of ActiveTemplateInstantiation entries in
6625  /// \c ActiveTemplateInstantiations that are not actual instantiations and,
6626  /// therefore, should not be counted as part of the instantiation depth.
6628 
6629  /// \brief The last template from which a template instantiation
6630  /// error or warning was produced.
6631  ///
6632  /// This value is used to suppress printing of redundant template
6633  /// instantiation backtraces when there are multiple errors in the
6634  /// same instantiation. FIXME: Does this belong in Sema? It's tough
6635  /// to implement it anywhere else.
6637 
6638  /// \brief The current index into pack expansion arguments that will be
6639  /// used for substitution of parameter packs.
6640  ///
6641  /// The pack expansion index will be -1 to indicate that parameter packs
6642  /// should be instantiated as themselves. Otherwise, the index specifies
6643  /// which argument within the parameter pack will be used for substitution.
6645 
6646  /// \brief RAII object used to change the argument pack substitution index
6647  /// within a \c Sema object.
6648  ///
6649  /// See \c ArgumentPackSubstitutionIndex for more information.
6651  Sema &Self;
6652  int OldSubstitutionIndex;
6653 
6654  public:
6655  ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
6656  : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
6657  Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
6658  }
6659 
6661  Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
6662  }
6663  };
6664 
6666 
6667  /// \brief For each declaration that involved template argument deduction, the
6668  /// set of diagnostics that were suppressed during that template argument
6669  /// deduction.
6670  ///
6671  /// FIXME: Serialize this structure to the AST file.
6672  typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
6675 
6676  /// \brief A stack object to be created when performing template
6677  /// instantiation.
6678  ///
6679  /// Construction of an object of type \c InstantiatingTemplate
6680  /// pushes the current instantiation onto the stack of active
6681  /// instantiations. If the size of this stack exceeds the maximum
6682  /// number of recursive template instantiations, construction
6683  /// produces an error and evaluates true.
6684  ///
6685  /// Destruction of this object will pop the named instantiation off
6686  /// the stack.
6688  /// \brief Note that we are instantiating a class template,
6689  /// function template, variable template, alias template,
6690  /// or a member thereof.
6691  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6692  Decl *Entity,
6693  SourceRange InstantiationRange = SourceRange());
6694 
6696  /// \brief Note that we are instantiating an exception specification
6697  /// of a function template.
6698  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6700  SourceRange InstantiationRange = SourceRange());
6701 
6702  /// \brief Note that we are instantiating a default argument in a
6703  /// template-id.
6704  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6705  TemplateDecl *Template,
6706  ArrayRef<TemplateArgument> TemplateArgs,
6707  SourceRange InstantiationRange = SourceRange());
6708 
6709  /// \brief Note that we are instantiating a default argument in a
6710  /// template-id.
6711  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6712  FunctionTemplateDecl *FunctionTemplate,
6713  ArrayRef<TemplateArgument> TemplateArgs,
6715  sema::TemplateDeductionInfo &DeductionInfo,
6716  SourceRange InstantiationRange = SourceRange());
6717 
6718  /// \brief Note that we are instantiating as part of template
6719  /// argument deduction for a class template partial
6720  /// specialization.
6721  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6723  ArrayRef<TemplateArgument> TemplateArgs,
6724  sema::TemplateDeductionInfo &DeductionInfo,
6725  SourceRange InstantiationRange = SourceRange());
6726 
6727  /// \brief Note that we are instantiating as part of template
6728  /// argument deduction for a variable template partial
6729  /// specialization.
6730  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6732  ArrayRef<TemplateArgument> TemplateArgs,
6733  sema::TemplateDeductionInfo &DeductionInfo,
6734  SourceRange InstantiationRange = SourceRange());
6735 
6736  /// \brief Note that we are instantiating a default argument for a function
6737  /// parameter.
6738  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6739  ParmVarDecl *Param,
6740  ArrayRef<TemplateArgument> TemplateArgs,
6741  SourceRange InstantiationRange = SourceRange());
6742 
6743  /// \brief Note that we are substituting prior template arguments into a
6744  /// non-type parameter.
6745  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6746  NamedDecl *Template,
6747  NonTypeTemplateParmDecl *Param,
6748  ArrayRef<TemplateArgument> TemplateArgs,
6749  SourceRange InstantiationRange);
6750 
6751  /// \brief Note that we are substituting prior template arguments into a
6752  /// template template parameter.
6753  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6754  NamedDecl *Template,
6755  TemplateTemplateParmDecl *Param,
6756  ArrayRef<TemplateArgument> TemplateArgs,
6757  SourceRange InstantiationRange);
6758 
6759  /// \brief Note that we are checking the default template argument
6760  /// against the template parameter for a given template-id.
6761  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6762  TemplateDecl *Template,
6763  NamedDecl *Param,
6764  ArrayRef<TemplateArgument> TemplateArgs,
6765  SourceRange InstantiationRange);
6766 
6767 
6768  /// \brief Note that we have finished instantiating this template.
6769  void Clear();
6770 
6771  ~InstantiatingTemplate() { Clear(); }
6772 
6773  /// \brief Determines whether we have exceeded the maximum
6774  /// recursive template instantiations.
6775  bool isInvalid() const { return Invalid; }
6776 
6777  private:
6778  Sema &SemaRef;
6779  bool Invalid;
6780  bool SavedInNonInstantiationSFINAEContext;
6781  bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
6782  SourceRange InstantiationRange);
6783 
6786  SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
6787  Decl *Entity, NamedDecl *Template = nullptr,
6788  ArrayRef<TemplateArgument> TemplateArgs = None,
6789  sema::TemplateDeductionInfo *DeductionInfo = nullptr);
6790 
6792 
6794  operator=(const InstantiatingTemplate&) = delete;
6795  };
6796 
6797  void PrintInstantiationStack();
6798 
6799  /// \brief Determines whether we are currently in a context where
6800  /// template argument substitution failures are not considered
6801  /// errors.
6802  ///
6803  /// \returns An empty \c Optional if we're not in a SFINAE context.
6804  /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
6805  /// template-deduction context object, which can be used to capture
6806  /// diagnostics that will be suppressed.
6808 
6809  /// \brief Determines whether we are currently in a context that
6810  /// is not evaluated as per C++ [expr] p5.
6811  bool isUnevaluatedContext() const {
6812  assert(!ExprEvalContexts.empty() &&
6813  "Must be in an expression evaluation context");
6814  return ExprEvalContexts.back().isUnevaluated();
6815  }
6816 
6817  /// \brief RAII class used to determine whether SFINAE has
6818  /// trapped any errors that occur during template argument
6819  /// deduction.
6820  class SFINAETrap {
6821  Sema &SemaRef;
6822  unsigned PrevSFINAEErrors;
6823  bool PrevInNonInstantiationSFINAEContext;
6824  bool PrevAccessCheckingSFINAE;
6825 
6826  public:
6827  explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
6828  : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
6829  PrevInNonInstantiationSFINAEContext(
6831  PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE)
6832  {
6833  if (!SemaRef.isSFINAEContext())
6834  SemaRef.InNonInstantiationSFINAEContext = true;
6836  }
6837 
6839  SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
6841  = PrevInNonInstantiationSFINAEContext;
6842  SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
6843  }
6844 
6845  /// \brief Determine whether any SFINAE errors have been trapped.
6846  bool hasErrorOccurred() const {
6847  return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
6848  }
6849  };
6850 
6851  /// \brief RAII class used to indicate that we are performing provisional
6852  /// semantic analysis to determine the validity of a construct, so
6853  /// typo-correction and diagnostics in the immediate context (not within
6854  /// implicitly-instantiated templates) should be suppressed.
6856  Sema &SemaRef;
6857  // FIXME: Using a SFINAETrap for this is a hack.
6858  SFINAETrap Trap;
6859  bool PrevDisableTypoCorrection;
6860  public:
6861  explicit TentativeAnalysisScope(Sema &SemaRef)
6862  : SemaRef(SemaRef), Trap(SemaRef, true),
6863  PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
6864  SemaRef.DisableTypoCorrection = true;
6865  }
6867  SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
6868  }
6869  };
6870 
6871  /// \brief The current instantiation scope used to store local
6872  /// variables.
6874 
6875  /// \brief Tracks whether we are in a context where typo correction is
6876  /// disabled.
6878 
6879  /// \brief The number of typos corrected by CorrectTypo.
6880  unsigned TyposCorrected;
6881 
6882  typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
6883  typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
6884 
6885  /// \brief A cache containing identifiers for which typo correction failed and
6886  /// their locations, so that repeated attempts to correct an identifier in a
6887  /// given location are ignored if typo correction already failed for it.
6889 
6890  /// \brief Worker object for performing CFG-based warnings.
6893 
6894  /// \brief An entity for which implicit template instantiation is required.
6895  ///
6896  /// The source location associated with the declaration is the first place in
6897  /// the source code where the declaration was "used". It is not necessarily
6898  /// the point of instantiation (which will be either before or after the
6899  /// namespace-scope declaration that triggered this implicit instantiation),
6900  /// However, it is the location that diagnostics should generally refer to,
6901  /// because users will need to know what code triggered the instantiation.
6902  typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
6903 
6904  /// \brief The queue of implicit template instantiations that are required
6905  /// but have not yet been performed.
6906  std::deque<PendingImplicitInstantiation> PendingInstantiations;
6907 
6909  public:
6911  : S(S), Enabled(Enabled) {
6912  if (!Enabled) return;
6913 
6914  SavedPendingInstantiations.swap(S.PendingInstantiations);
6915  SavedVTableUses.swap(S.VTableUses);
6916  }
6917 
6919  if (!Enabled) return;
6920 
6921  // Restore the set of pending vtables.
6922  assert(S.VTableUses.empty() &&
6923  "VTableUses should be empty before it is discarded.");
6924  S.VTableUses.swap(SavedVTableUses);
6925 
6926  // Restore the set of pending implicit instantiations.
6927  assert(S.PendingInstantiations.empty() &&
6928  "PendingInstantiations should be empty before it is discarded.");
6929  S.PendingInstantiations.swap(SavedPendingInstantiations);
6930  }
6931 
6932  private:
6933  Sema &S;
6934  SmallVector<VTableUse, 16> SavedVTableUses;
6935  std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
6936  bool Enabled;
6937  };
6938 
6939  /// \brief The queue of implicit template instantiations that are required
6940  /// and must be performed within the current local scope.
6941  ///
6942  /// This queue is only used for member functions of local classes in
6943  /// templates, which must be instantiated in the same scope as their
6944  /// enclosing function, so that they can reference function-local
6945  /// types, static variables, enumerators, etc.
6946  std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
6947 
6949  public:
6951  SavedPendingLocalImplicitInstantiations.swap(
6953  }
6954 
6956  assert(S.PendingLocalImplicitInstantiations.empty() &&
6957  "there shouldn't be any pending local implicit instantiations");
6958  SavedPendingLocalImplicitInstantiations.swap(
6959  S.PendingLocalImplicitInstantiations);
6960  }
6961 
6962  private:
6963  Sema &S;
6964  std::deque<PendingImplicitInstantiation>
6965  SavedPendingLocalImplicitInstantiations;
6966  };
6967 
6968  void PerformPendingInstantiations(bool LocalOnly = false);
6969 
6971  const MultiLevelTemplateArgumentList &TemplateArgs,
6972  SourceLocation Loc, DeclarationName Entity);
6973 
6975  const MultiLevelTemplateArgumentList &TemplateArgs,
6976  SourceLocation Loc, DeclarationName Entity);
6977 
6979  const MultiLevelTemplateArgumentList &TemplateArgs,
6980  SourceLocation Loc, DeclarationName Entity);
6981 
6983  const MultiLevelTemplateArgumentList &TemplateArgs,
6984  SourceLocation Loc,
6985  DeclarationName Entity,
6986  CXXRecordDecl *ThisContext,
6987  unsigned ThisTypeQuals);
6988  void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
6989  const MultiLevelTemplateArgumentList &Args);
6991  const MultiLevelTemplateArgumentList &TemplateArgs,
6992  int indexAdjustment,
6993  Optional<unsigned> NumExpansions,
6994  bool ExpectParameterPack);
6995  bool SubstParmTypes(SourceLocation Loc,
6996  ParmVarDecl **Params, unsigned NumParams,
6997  const MultiLevelTemplateArgumentList &TemplateArgs,
6998  SmallVectorImpl<QualType> &ParamTypes,
6999  SmallVectorImpl<ParmVarDecl *> *OutParams = nullptr);
7001  const MultiLevelTemplateArgumentList &TemplateArgs);
7002 
7003  /// \brief Substitute the given template arguments into a list of
7004  /// expressions, expanding pack expansions if required.
7005  ///
7006  /// \param Exprs The list of expressions to substitute into.
7007  ///
7008  /// \param IsCall Whether this is some form of call, in which case
7009  /// default arguments will be dropped.
7010  ///
7011  /// \param TemplateArgs The set of template arguments to substitute.
7012  ///
7013  /// \param Outputs Will receive all of the substituted arguments.
7014  ///
7015  /// \returns true if an error occurred, false otherwise.
7016  bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
7017  const MultiLevelTemplateArgumentList &TemplateArgs,
7018  SmallVectorImpl<Expr *> &Outputs);
7019 
7021  const MultiLevelTemplateArgumentList &TemplateArgs);
7022 
7023  Decl *SubstDecl(Decl *D, DeclContext *Owner,
7024  const MultiLevelTemplateArgumentList &TemplateArgs);
7025 
7027  const MultiLevelTemplateArgumentList &TemplateArgs,
7028  bool CXXDirectInit);
7029 
7030  bool
7031  SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
7032  CXXRecordDecl *Pattern,
7033  const MultiLevelTemplateArgumentList &TemplateArgs);
7034 
7035  bool
7036  InstantiateClass(SourceLocation PointOfInstantiation,
7037  CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
7038  const MultiLevelTemplateArgumentList &TemplateArgs,
7040  bool Complain = true);
7041 
7042  bool InstantiateEnum(SourceLocation PointOfInstantiation,
7043  EnumDecl *Instantiation, EnumDecl *Pattern,
7044  const MultiLevelTemplateArgumentList &TemplateArgs,
7046 
7048  SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
7049  FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
7050 
7052  const Attr *TmplAttr;
7055 
7057  Decl *D)
7058  : TmplAttr(A), Scope(S), NewDecl(D)
7059  { }
7060  };
7062 
7063  void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
7064  const Decl *Pattern, Decl *Inst,
7065  LateInstantiatedAttrVec *LateAttrs = nullptr,
7066  LocalInstantiationScope *OuterMostScope = nullptr);
7067 
7068  bool
7070  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7072  bool Complain = true);
7073 
7074  void InstantiateClassMembers(SourceLocation PointOfInstantiation,
7075  CXXRecordDecl *Instantiation,
7076  const MultiLevelTemplateArgumentList &TemplateArgs,
7078 
7080  SourceLocation PointOfInstantiation,
7081  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7083 
7086  const MultiLevelTemplateArgumentList &TemplateArgs);
7087 
7090  const MultiLevelTemplateArgumentList &TemplateArgs);
7091  TemplateName
7093  SourceLocation Loc,
7094  const MultiLevelTemplateArgumentList &TemplateArgs);
7095  bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
7097  const MultiLevelTemplateArgumentList &TemplateArgs);
7098 
7099  void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
7100  FunctionDecl *Function);
7101  void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
7102  FunctionDecl *Function,
7103  bool Recursive = false,
7104  bool DefinitionRequired = false);
7106  VarTemplateDecl *VarTemplate, VarDecl *FromVar,
7107  const TemplateArgumentList &TemplateArgList,
7108  const TemplateArgumentListInfo &TemplateArgsInfo,
7110  SourceLocation PointOfInstantiation, void *InsertPos,
7111  LateInstantiatedAttrVec *LateAttrs = nullptr,
7112  LocalInstantiationScope *StartingScope = nullptr);
7114  VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
7115  const MultiLevelTemplateArgumentList &TemplateArgs);
7116  void
7117  BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar,
7118  const MultiLevelTemplateArgumentList &TemplateArgs,
7119  LateInstantiatedAttrVec *LateAttrs,
7120  DeclContext *Owner,
7121  LocalInstantiationScope *StartingScope,
7122  bool InstantiatingVarTemplate = false);
7124  VarDecl *Var, VarDecl *OldVar,
7125  const MultiLevelTemplateArgumentList &TemplateArgs);
7126  void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
7127  VarDecl *Var, bool Recursive = false,
7128  bool DefinitionRequired = false);
7130  SourceLocation PointOfInstantiation,
7131  VarDecl *Var,
7132  bool Recursive = false,
7133  bool DefinitionRequired = false);
7134 
7136  const CXXConstructorDecl *Tmpl,
7137  const MultiLevelTemplateArgumentList &TemplateArgs);
7138 
7140  const MultiLevelTemplateArgumentList &TemplateArgs);
7142  const MultiLevelTemplateArgumentList &TemplateArgs);
7143 
7144  // Objective-C declarations.
7146  OCK_None = -1,
7153  };
7155 
7157  ObjCTypeParamVariance variance,
7158  SourceLocation varianceLoc,
7159  unsigned index,
7160  IdentifierInfo *paramName,
7161  SourceLocation paramLoc,
7162  SourceLocation colonLoc,
7163  ParsedType typeBound);
7164 
7166  ArrayRef<Decl *> typeParams,
7167  SourceLocation rAngleLoc);
7168  void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
7169 
7171  SourceLocation AtInterfaceLoc,
7172  IdentifierInfo *ClassName,
7173  SourceLocation ClassLoc,
7174  ObjCTypeParamList *typeParamList,
7175  IdentifierInfo *SuperName,
7176  SourceLocation SuperLoc,
7177  ArrayRef<ParsedType> SuperTypeArgs,
7178  SourceRange SuperTypeArgsRange,
7179  Decl * const *ProtoRefs,
7180  unsigned NumProtoRefs,
7181  const SourceLocation *ProtoLocs,
7182  SourceLocation EndProtoLoc,
7183  AttributeList *AttrList);
7184 
7186  SourceLocation AtInterfaceLoc,
7187  ObjCInterfaceDecl *IDecl,
7188  IdentifierInfo *ClassName,
7189  SourceLocation ClassLoc,
7190  IdentifierInfo *SuperName,
7191  SourceLocation SuperLoc,
7192  ArrayRef<ParsedType> SuperTypeArgs,
7193  SourceRange SuperTypeArgsRange);
7194 
7196  IdentifierInfo *SuperName,
7197  SourceLocation SuperLoc);
7198 
7200  SourceLocation AtCompatibilityAliasLoc,
7201  IdentifierInfo *AliasName, SourceLocation AliasLocation,
7202  IdentifierInfo *ClassName, SourceLocation ClassLocation);
7203 
7205  IdentifierInfo *PName,
7206  SourceLocation &PLoc, SourceLocation PrevLoc,
7207  const ObjCList<ObjCProtocolDecl> &PList);
7208 
7210  SourceLocation AtProtoInterfaceLoc,
7211  IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
7212  Decl * const *ProtoRefNames, unsigned NumProtoRefs,
7213  const SourceLocation *ProtoLocs,
7214  SourceLocation EndProtoLoc,
7215  AttributeList *AttrList);
7216 
7218  IdentifierInfo *ClassName,
7219  SourceLocation ClassLoc,
7220  ObjCTypeParamList *typeParamList,
7221  IdentifierInfo *CategoryName,
7222  SourceLocation CategoryLoc,
7223  Decl * const *ProtoRefs,
7224  unsigned NumProtoRefs,
7225  const SourceLocation *ProtoLocs,
7226  SourceLocation EndProtoLoc);
7227 
7229  SourceLocation AtClassImplLoc,
7230  IdentifierInfo *ClassName, SourceLocation ClassLoc,
7231  IdentifierInfo *SuperClassname,
7232  SourceLocation SuperClassLoc);
7233 
7235  IdentifierInfo *ClassName,
7236  SourceLocation ClassLoc,
7237  IdentifierInfo *CatName,
7238  SourceLocation CatLoc);
7239 
7241  ArrayRef<Decl *> Decls);
7242 
7244  IdentifierInfo **IdentList,
7245  SourceLocation *IdentLocs,
7246  ArrayRef<ObjCTypeParamList *> TypeParamLists,
7247  unsigned NumElts);
7248 
7250  ArrayRef<IdentifierLocPair> IdentList,
7251  AttributeList *attrList);
7252 
7253  void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
7254  ArrayRef<IdentifierLocPair> ProtocolId,
7255  SmallVectorImpl<Decl *> &Protocols);
7256 
7257  /// Given a list of identifiers (and their locations), resolve the
7258  /// names to either Objective-C protocol qualifiers or type
7259  /// arguments, as appropriate.
7261  Scope *S,
7262  ParsedType baseType,
7263  SourceLocation lAngleLoc,
7264  ArrayRef<IdentifierInfo *> identifiers,
7265  ArrayRef<SourceLocation> identifierLocs,
7266  SourceLocation rAngleLoc,
7267  SourceLocation &typeArgsLAngleLoc,
7268  SmallVectorImpl<ParsedType> &typeArgs,
7269  SourceLocation &typeArgsRAngleLoc,
7270  SourceLocation &protocolLAngleLoc,
7271  SmallVectorImpl<Decl *> &protocols,
7272  SourceLocation &protocolRAngleLoc,
7273  bool warnOnIncompleteProtocols);
7274 
7275  /// Build a an Objective-C protocol-qualified 'id' type where no
7276  /// base type was specified.
7278  SourceLocation lAngleLoc,
7279  ArrayRef<Decl *> protocols,
7280  ArrayRef<SourceLocation> protocolLocs,
7281  SourceLocation rAngleLoc);
7282 
7283  /// Build a specialized and/or protocol-qualified Objective-C type.
7285  Scope *S,
7286  SourceLocation Loc,
7287  ParsedType BaseType,
7288  SourceLocation TypeArgsLAngleLoc,
7289  ArrayRef<ParsedType> TypeArgs,
7290  SourceLocation TypeArgsRAngleLoc,
7291  SourceLocation ProtocolLAngleLoc,
7292  ArrayRef<Decl *> Protocols,
7293  ArrayRef<SourceLocation> ProtocolLocs,
7294  SourceLocation ProtocolRAngleLoc);
7295 
7296  /// Build an Objective-C object pointer type.
7298  SourceLocation Loc,
7299  SourceLocation TypeArgsLAngleLoc,
7300  ArrayRef<TypeSourceInfo *> TypeArgs,
7301  SourceLocation TypeArgsRAngleLoc,
7302  SourceLocation ProtocolLAngleLoc,
7303  ArrayRef<ObjCProtocolDecl *> Protocols,
7304  ArrayRef<SourceLocation> ProtocolLocs,
7305  SourceLocation ProtocolRAngleLoc,
7306  bool FailOnError = false);
7307 
7308  /// Check the application of the Objective-C '__kindof' qualifier to
7309  /// the given type.
7311 
7312  /// Ensure attributes are consistent with type.
7313  /// \param [in, out] Attributes The attributes to check; they will
7314  /// be modified to be consistent with \p PropertyTy.
7315  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
7316  SourceLocation Loc,
7317  unsigned &Attributes,
7318  bool propertyInPrimaryClass);
7319 
7320  /// Process the specified property declaration and create decls for the
7321  /// setters and getters as needed.
7322  /// \param property The property declaration being processed
7323  void ProcessPropertyDecl(ObjCPropertyDecl *property);
7324 
7325 
7327  ObjCPropertyDecl *SuperProperty,
7328  const IdentifierInfo *Name,
7329  bool OverridingProtocolProperty);
7330 
7333 
7334  Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
7335  ArrayRef<Decl *> allMethods = None,
7336  ArrayRef<DeclGroupPtrTy> allTUVars = None);
7337 
7339  SourceLocation LParenLoc,
7340  FieldDeclarator &FD, ObjCDeclSpec &ODS,
7341  Selector GetterSel, Selector SetterSel,
7342  tok::ObjCKeywordKind MethodImplKind,
7343  DeclContext *lexicalDC = nullptr);
7344 
7346  SourceLocation AtLoc,
7347  SourceLocation PropertyLoc,
7348  bool ImplKind,
7349  IdentifierInfo *PropertyId,
7350  IdentifierInfo *PropertyIvar,
7351  SourceLocation PropertyIvarLoc);
7352 
7360  };
7361 
7362  struct ObjCArgInfo {
7365  // The Type is null if no type was specified, and the DeclSpec is invalid
7366  // in this case.
7369 
7370  /// ArgAttrs - Attribute list for this argument.
7372  };
7373 
7375  Scope *S,
7376  SourceLocation BeginLoc, // location of the + or -.
7377  SourceLocation EndLoc, // location of the ; or {.
7378  tok::TokenKind MethodType,
7379  ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
7380  ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
7381  // optional arguments. The number of types/arguments is obtained
7382  // from the Sel.getNumArgs().
7383  ObjCArgInfo *ArgInfo,
7384  DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, // c-style args
7385  AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind,
7386  bool isVariadic, bool MethodDefinition);
7387 
7389  const ObjCObjectPointerType *OPT,
7390  bool IsInstance);
7392  bool IsInstance);
7393 
7394  bool CheckARCMethodDecl(ObjCMethodDecl *method);
7396 
7397  ExprResult
7399  Expr *BaseExpr,
7400  SourceLocation OpLoc,
7401  DeclarationName MemberName,
7402  SourceLocation MemberLoc,
7403  SourceLocation SuperLoc, QualType SuperType,
7404  bool Super);
7405 
7406  ExprResult
7408  IdentifierInfo &propertyName,
7409  SourceLocation receiverNameLoc,
7410  SourceLocation propertyNameLoc);
7411 
7413 
7414  /// \brief Describes the kind of message expression indicated by a message
7415  /// send that starts with an identifier.
7417  /// \brief The message is sent to 'super'.
7419  /// \brief The message is an instance message.
7421  /// \brief The message is a class message, and the identifier is a type
7422  /// name.
7424  };
7425 
7427  IdentifierInfo *Name,
7428  SourceLocation NameLoc,
7429  bool IsSuper,
7430  bool HasTrailingDot,
7431  ParsedType &ReceiverType);
7432 
7434  Selector Sel,
7435  SourceLocation LBracLoc,
7436  ArrayRef<SourceLocation> SelectorLocs,
7437  SourceLocation RBracLoc,
7438  MultiExprArg Args);
7439 
7440  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
7441  QualType ReceiverType,
7442  SourceLocation SuperLoc,
7443  Selector Sel,
7444  ObjCMethodDecl *Method,
7445  SourceLocation LBracLoc,
7446  ArrayRef<SourceLocation> SelectorLocs,
7447  SourceLocation RBracLoc,
7448  MultiExprArg Args,
7449  bool isImplicit = false);
7450 
7452  bool isSuperReceiver,
7453  SourceLocation Loc,
7454  Selector Sel,
7455  ObjCMethodDecl *Method,
7456  MultiExprArg Args);
7457 
7459  ParsedType Receiver,
7460  Selector Sel,
7461  SourceLocation LBracLoc,
7462  ArrayRef<SourceLocation> SelectorLocs,
7463  SourceLocation RBracLoc,
7464  MultiExprArg Args);
7465 
7467  QualType ReceiverType,
7468  SourceLocation SuperLoc,
7469  Selector Sel,
7470  ObjCMethodDecl *Method,
7471  SourceLocation LBracLoc,
7472  ArrayRef<SourceLocation> SelectorLocs,
7473  SourceLocation RBracLoc,
7474  MultiExprArg Args,
7475  bool isImplicit = false);
7476 
7478  QualType ReceiverType,
7479  SourceLocation Loc,
7480  Selector Sel,
7481  ObjCMethodDecl *Method,
7482  MultiExprArg Args);
7483 
7485  Expr *Receiver,
7486  Selector Sel,
7487  SourceLocation LBracLoc,
7488  ArrayRef<SourceLocation> SelectorLocs,
7489  SourceLocation RBracLoc,
7490  MultiExprArg Args);
7491 
7493  ObjCBridgeCastKind Kind,
7494  SourceLocation BridgeKeywordLoc,
7495  TypeSourceInfo *TSInfo,
7496  Expr *SubExpr);
7497 
7499  SourceLocation LParenLoc,
7500  ObjCBridgeCastKind Kind,
7501  SourceLocation BridgeKeywordLoc,
7502  ParsedType Type,
7503  SourceLocation RParenLoc,
7504  Expr *SubExpr);
7505 
7506  void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr);
7507 
7509 
7511  CastKind &Kind);
7512 
7514  QualType DestType, QualType SrcType,
7515  ObjCInterfaceDecl *&RelatedClass,
7516  ObjCMethodDecl *&ClassMethod,
7517  ObjCMethodDecl *&InstanceMethod,
7518  TypedefNameDecl *&TDNDecl,
7519  bool CfToNs, bool Diagnose = true);
7520 
7522  QualType DestType, QualType SrcType,
7523  Expr *&SrcExpr, bool Diagnose = true);
7524 
7525  bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr,
7526  bool Diagnose = true);
7527 
7528  bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
7529 
7530  /// \brief Check whether the given new method is a valid override of the
7531  /// given overridden method, and set any properties that should be inherited.
7532  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
7533  const ObjCMethodDecl *Overridden);
7534 
7535  /// \brief Describes the compatibility of a result type with its method.
7540  };
7541 
7542  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
7543  ObjCInterfaceDecl *CurrentClass,
7545 
7547  POAK_Native, // #pragma options align=native
7548  POAK_Natural, // #pragma options align=natural
7549  POAK_Packed, // #pragma options align=packed
7550  POAK_Power, // #pragma options align=power
7551  POAK_Mac68k, // #pragma options align=mac68k
7552  POAK_Reset // #pragma options align=reset
7553  };
7554 
7555  /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
7557  SourceLocation PragmaLoc);
7558 
7560  PPK_Default, // #pragma pack([n])
7561  PPK_Show, // #pragma pack(show), only supported by MSVC.
7562  PPK_Push, // #pragma pack(push, [identifier], [n])
7563  PPK_Pop // #pragma pack(pop, [identifier], [n])
7564  };
7565 
7567  PMSST_OFF, // #pragms ms_struct off
7568  PMSST_ON // #pragms ms_struct on
7569  };
7570 
7573  PCK_Linker, // #pragma comment(linker, ...)
7574  PCK_Lib, // #pragma comment(lib, ...)
7575  PCK_Compiler, // #pragma comment(compiler, ...)
7576  PCK_ExeStr, // #pragma comment(exestr, ...)
7577  PCK_User // #pragma comment(user, ...)
7578  };
7579 
7580  /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
7581  void ActOnPragmaPack(PragmaPackKind Kind,
7582  IdentifierInfo *Name,
7583  Expr *Alignment,
7584  SourceLocation PragmaLoc,
7585  SourceLocation LParenLoc,
7586  SourceLocation RParenLoc);
7587 
7588  /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
7590 
7591  /// ActOnPragmaMSComment - Called on well formed
7592  /// \#pragma comment(kind, "arg").
7593  void ActOnPragmaMSComment(PragmaMSCommentKind Kind, StringRef Arg);
7594 
7595  /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
7596  /// pointers_to_members(representation method[, general purpose
7597  /// representation]).
7600  SourceLocation PragmaLoc);
7601 
7602  /// \brief Called on well formed \#pragma vtordisp().
7604  MSVtorDispAttr::Mode Value);
7605 
7611  };
7612 
7613  bool UnifySection(StringRef SectionName,
7614  int SectionFlags,
7615  DeclaratorDecl *TheDecl);
7616  bool UnifySection(StringRef SectionName,
7617  int SectionFlags,
7618  SourceLocation PragmaSectionLocation);
7619 
7620  /// \brief Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
7621  void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
7623  llvm::StringRef StackSlotLabel,
7624  StringLiteral *SegmentName,
7625  llvm::StringRef PragmaName);
7626 
7627  /// \brief Called on well formed \#pragma section().
7628  void ActOnPragmaMSSection(SourceLocation PragmaLocation,
7629  int SectionFlags, StringLiteral *SegmentName);
7630 
7631  /// \brief Called on well-formed \#pragma init_seg().
7632  void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
7633  StringLiteral *SegmentName);
7634 
7635  /// \brief Called on #pragma clang __debug dump II
7637 
7638  /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
7639  void ActOnPragmaDetectMismatch(StringRef Name, StringRef Value);
7640 
7641  /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
7642  void ActOnPragmaUnused(const Token &Identifier,
7643  Scope *curScope,
7644  SourceLocation PragmaLoc);
7645 
7646  /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
7647  void ActOnPragmaVisibility(const IdentifierInfo* VisType,
7648  SourceLocation PragmaLoc);
7649 
7651  SourceLocation Loc);
7652  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);
7653 
7654  /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
7655  void ActOnPragmaWeakID(IdentifierInfo* WeakName,
7656  SourceLocation PragmaLoc,
7657  SourceLocation WeakNameLoc);
7658 
7659  /// ActOnPragmaRedefineExtname - Called on well formed
7660  /// \#pragma redefine_extname oldname newname.
7662  IdentifierInfo* AliasName,
7663  SourceLocation PragmaLoc,
7664  SourceLocation WeakNameLoc,
7665  SourceLocation AliasNameLoc);
7666 
7667  /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
7668  void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
7669  IdentifierInfo* AliasName,
7670  SourceLocation PragmaLoc,
7671  SourceLocation WeakNameLoc,
7672  SourceLocation AliasNameLoc);
7673 
7674  /// ActOnPragmaFPContract - Called on well formed
7675  /// \#pragma {STDC,OPENCL} FP_CONTRACT
7677 
7678  /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
7679  /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
7681 
7682  /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
7684 
7685  /// FreePackedContext - Deallocate and null out PackContext.
7686  void FreePackedContext();
7687 
7688  /// PushNamespaceVisibilityAttr - Note that we've entered a
7689  /// namespace with a visibility attribute.
7690  void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
7691  SourceLocation Loc);
7692 
7693  /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
7694  /// add an appropriate visibility attribute.
7696 
7697  /// PopPragmaVisibility - Pop the top element of the visibility stack; used
7698  /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
7699  void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
7700 
7701  /// FreeVisContext - Deallocate and null out VisContext.
7702  void FreeVisContext();
7703 
7704  /// AddCFAuditedAttribute - Check whether we're currently within
7705  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
7706  /// the appropriate attribute.
7707  void AddCFAuditedAttribute(Decl *D);
7708 
7709  /// \brief Called on well formed \#pragma clang optimize.
7710  void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
7711 
7712  /// \brief Get the location for the currently active "\#pragma clang optimize
7713  /// off". If this location is invalid, then the state of the pragma is "on".
7716  }
7717 
7718  /// \brief Only called on function definitions; if there is a pragma in scope
7719  /// with the effect of a range-based optnone, consider marking the function
7720  /// with attribute optnone.
7722 
7723  /// \brief Adds the 'optnone' attribute to the function declaration if there
7724  /// are no conflicts; Loc represents the location causing the 'optnone'
7725  /// attribute to be added (usually because of a pragma).
7727 
7728  /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
7729  void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
7730  unsigned SpellingListIndex, bool IsPackExpansion);
7731  void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T,
7732  unsigned SpellingListIndex, bool IsPackExpansion);
7733 
7734  /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
7735  /// declaration.
7736  void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE,
7737  unsigned SpellingListIndex);
7738 
7739  /// AddAlignValueAttr - Adds an align_value attribute to a particular
7740  /// declaration.
7741  void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E,
7742  unsigned SpellingListIndex);
7743 
7744  /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
7745  /// declaration.
7746  void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads,
7747  Expr *MinBlocks, unsigned SpellingListIndex);
7748 
7749  //===--------------------------------------------------------------------===//
7750  // C++ Coroutines TS
7751  //
7755 
7759 
7760  void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body);
7761 
7762  //===--------------------------------------------------------------------===//
7763  // OpenMP directives and clauses.
7764  //
7765 private:
7766  void *VarDataSharingAttributesStack;
7767  /// \brief Initialization of data-sharing attributes stack.
7768  void InitDataSharingAttributesStack();
7769  void DestroyDataSharingAttributesStack();
7770  ExprResult
7771  VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
7772  bool StrictlyPositive = true);
7773 
7774 public:
7775  /// \brief Return true if the provided declaration \a VD should be captured by
7776  /// reference in the provided scope \a RSI. This will take into account the
7777  /// semantics of the directive and associated clauses.
7778  bool IsOpenMPCapturedByRef(VarDecl *VD,
7779  const sema::CapturedRegionScopeInfo *RSI);
7780 
7781  /// \brief Check if the specified variable is used in one of the private
7782  /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
7783  /// constructs.
7784  bool IsOpenMPCapturedVar(VarDecl *VD);
7785 
7786  /// \brief Check if the specified variable is used in 'private' clause.
7787  /// \param Level Relative level of nested OpenMP construct for that the check
7788  /// is performed.
7789  bool isOpenMPPrivateVar(VarDecl *VD, unsigned Level);
7790 
7791  /// \brief Check if the specified variable is captured by 'target' directive.
7792  /// \param Level Relative level of nested OpenMP construct for that the check
7793  /// is performed.
7794  bool isOpenMPTargetCapturedVar(VarDecl *VD, unsigned Level);
7795 
7797  Expr *Op);
7798  /// \brief Called on start of new data sharing attribute block.
7800  const DeclarationNameInfo &DirName, Scope *CurScope,
7801  SourceLocation Loc);
7802  /// \brief Start analysis of clauses.
7804  /// \brief End analysis of clauses.
7805  void EndOpenMPClause();
7806  /// \brief Called on end of data sharing attribute block.
7807  void EndOpenMPDSABlock(Stmt *CurDirective);
7808 
7809  /// \brief Check if the current region is an OpenMP loop region and if it is,
7810  /// mark loop control variable, used in \p Init for loop initialization, as
7811  /// private by default.
7812  /// \param Init First part of the for loop.
7814 
7815  // OpenMP directives and clauses.
7816  /// \brief Called on correct id-expression from the '#pragma omp
7817  /// threadprivate'.
7819  CXXScopeSpec &ScopeSpec,
7820  const DeclarationNameInfo &Id);
7821  /// \brief Called on well-formed '#pragma omp threadprivate'.
7823  SourceLocation Loc,
7824  ArrayRef<Expr *> VarList);
7825  /// \brief Builds a new OpenMPThreadPrivateDecl and checks its correctness.
7827  SourceLocation Loc,
7828  ArrayRef<Expr *> VarList);
7829 
7830  /// \brief Initialization of captured region for OpenMP region.
7831  void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
7832  /// \brief End of OpenMP region.
7833  ///
7834  /// \param S Statement associated with the current OpenMP region.
7835  /// \param Clauses List of clauses for the current OpenMP region.
7836  ///
7837  /// \returns Statement for finished OpenMP region.
7840  OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
7841  OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
7842  Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
7843  /// \brief Called on well-formed '\#pragma omp parallel' after parsing
7844  /// of the associated statement.
7846  Stmt *AStmt,
7847  SourceLocation StartLoc,
7848  SourceLocation EndLoc);
7849  /// \brief Called on well-formed '\#pragma omp simd' after parsing
7850  /// of the associated statement.
7852  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7853  SourceLocation EndLoc,
7854  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7855  /// \brief Called on well-formed '\#pragma omp for' after parsing
7856  /// of the associated statement.
7858  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7859  SourceLocation EndLoc,
7860  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7861  /// \brief Called on well-formed '\#pragma omp for simd' after parsing
7862  /// of the associated statement.
7864  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7865  SourceLocation EndLoc,
7866  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7867  /// \brief Called on well-formed '\#pragma omp sections' after parsing
7868  /// of the associated statement.
7870  Stmt *AStmt, SourceLocation StartLoc,
7871  SourceLocation EndLoc);
7872  /// \brief Called on well-formed '\#pragma omp section' after parsing of the
7873  /// associated statement.
7875  SourceLocation EndLoc);
7876  /// \brief Called on well-formed '\#pragma omp single' after parsing of the
7877  /// associated statement.
7879  Stmt *AStmt, SourceLocation StartLoc,
7880  SourceLocation EndLoc);
7881  /// \brief Called on well-formed '\#pragma omp master' after parsing of the
7882  /// associated statement.
7884  SourceLocation EndLoc);
7885  /// \brief Called on well-formed '\#pragma omp critical' after parsing of the
7886  /// associated statement.
7888  ArrayRef<OMPClause *> Clauses,
7889  Stmt *AStmt, SourceLocation StartLoc,
7890  SourceLocation EndLoc);
7891  /// \brief Called on well-formed '\#pragma omp parallel for' after parsing
7892  /// of the associated statement.
7894  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7895  SourceLocation EndLoc,
7896  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7897  /// \brief Called on well-formed '\#pragma omp parallel for simd' after
7898  /// parsing of the associated statement.
7900  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7901  SourceLocation EndLoc,
7902  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7903  /// \brief Called on well-formed '\#pragma omp parallel sections' after
7904  /// parsing of the associated statement.
7906  Stmt *AStmt,
7907  SourceLocation StartLoc,
7908  SourceLocation EndLoc);
7909  /// \brief Called on well-formed '\#pragma omp task' after parsing of the
7910  /// associated statement.
7912  Stmt *AStmt, SourceLocation StartLoc,
7913  SourceLocation EndLoc);
7914  /// \brief Called on well-formed '\#pragma omp taskyield'.
7916  SourceLocation EndLoc);
7917  /// \brief Called on well-formed '\#pragma omp barrier'.
7919  SourceLocation EndLoc);
7920  /// \brief Called on well-formed '\#pragma omp taskwait'.
7922  SourceLocation EndLoc);
7923  /// \brief Called on well-formed '\#pragma omp taskgroup'.
7925  SourceLocation EndLoc);
7926  /// \brief Called on well-formed '\#pragma omp flush'.
7928  SourceLocation StartLoc,
7929  SourceLocation EndLoc);
7930  /// \brief Called on well-formed '\#pragma omp ordered' after parsing of the
7931  /// associated statement.
7933  Stmt *AStmt, SourceLocation StartLoc,
7934  SourceLocation EndLoc);
7935  /// \brief Called on well-formed '\#pragma omp atomic' after parsing of the
7936  /// associated statement.
7938  Stmt *AStmt, SourceLocation StartLoc,
7939  SourceLocation EndLoc);
7940  /// \brief Called on well-formed '\#pragma omp target' after parsing of the
7941  /// associated statement.
7943  Stmt *AStmt, SourceLocation StartLoc,
7944  SourceLocation EndLoc);
7945  /// \brief Called on well-formed '\#pragma omp target data' after parsing of
7946  /// the associated statement.
7948  Stmt *AStmt, SourceLocation StartLoc,
7949  SourceLocation EndLoc);
7950  /// \brief Called on well-formed '\#pragma omp teams' after parsing of the
7951  /// associated statement.
7953  Stmt *AStmt, SourceLocation StartLoc,
7954  SourceLocation EndLoc);
7955  /// \brief Called on well-formed '\#pragma omp cancellation point'.
7956  StmtResult
7958  SourceLocation EndLoc,
7959  OpenMPDirectiveKind CancelRegion);
7960  /// \brief Called on well-formed '\#pragma omp cancel'.
7962  SourceLocation StartLoc,
7963  SourceLocation EndLoc,
7964  OpenMPDirectiveKind CancelRegion);
7965  /// \brief Called on well-formed '\#pragma omp taskloop' after parsing of the
7966  /// associated statement.
7968  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7969  SourceLocation EndLoc,
7970  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7971  /// \brief Called on well-formed '\#pragma omp taskloop simd' after parsing of
7972  /// the associated statement.
7974  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7975  SourceLocation EndLoc,
7976  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7977  /// \brief Called on well-formed '\#pragma omp distribute' after parsing
7978  /// of the associated statement.
7980  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
7981  SourceLocation EndLoc,
7982  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
7983 
7985  Expr *Expr,
7986  SourceLocation StartLoc,
7987  SourceLocation LParenLoc,
7988  SourceLocation EndLoc);
7989  /// \brief Called on well-formed 'if' clause.
7991  Expr *Condition, SourceLocation StartLoc,
7992  SourceLocation LParenLoc,
7993  SourceLocation NameModifierLoc,
7995  SourceLocation EndLoc);
7996  /// \brief Called on well-formed 'final' clause.
7997  OMPClause *ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc,
7998  SourceLocation LParenLoc,
7999  SourceLocation EndLoc);
8000  /// \brief Called on well-formed 'num_threads' clause.
8002  SourceLocation StartLoc,
8003  SourceLocation LParenLoc,
8004  SourceLocation EndLoc);
8005  /// \brief Called on well-formed 'safelen' clause.
8007  SourceLocation StartLoc,
8008  SourceLocation LParenLoc,
8009  SourceLocation EndLoc);
8010  /// \brief Called on well-formed 'simdlen' clause.
8012  SourceLocation LParenLoc,
8013  SourceLocation EndLoc);
8014  /// \brief Called on well-formed 'collapse' clause.
8016  SourceLocation StartLoc,
8017  SourceLocation LParenLoc,
8018  SourceLocation EndLoc);
8019  /// \brief Called on well-formed 'ordered' clause.
8020  OMPClause *
8022  SourceLocation LParenLoc = SourceLocation(),
8023  Expr *NumForLoops = nullptr);
8024  /// \brief Called on well-formed 'grainsize' clause.
8026  SourceLocation LParenLoc,
8027  SourceLocation EndLoc);
8028  /// \brief Called on well-formed 'num_tasks' clause.
8030  SourceLocation LParenLoc,
8031  SourceLocation EndLoc);
8032  /// \brief Called on well-formed 'hint' clause.
8034  SourceLocation LParenLoc,
8035  SourceLocation EndLoc);
8036 
8038  unsigned Argument,
8039  SourceLocation ArgumentLoc,
8040  SourceLocation StartLoc,
8041  SourceLocation LParenLoc,
8042  SourceLocation EndLoc);
8043  /// \brief Called on well-formed 'default' clause.
8045  SourceLocation KindLoc,
8046  SourceLocation StartLoc,
8047  SourceLocation LParenLoc,
8048  SourceLocation EndLoc);
8049  /// \brief Called on well-formed 'proc_bind' clause.
8051  SourceLocation KindLoc,
8052  SourceLocation StartLoc,
8053  SourceLocation LParenLoc,
8054  SourceLocation EndLoc);
8055 
8057  OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
8058  SourceLocation StartLoc, SourceLocation LParenLoc,
8059  ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
8060  SourceLocation EndLoc);
8061  /// \brief Called on well-formed 'schedule' clause.
8064  OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
8065  SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
8066  SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
8067 
8069  SourceLocation EndLoc);
8070  /// \brief Called on well-formed 'nowait' clause.
8072  SourceLocation EndLoc);
8073  /// \brief Called on well-formed 'untied' clause.
8075  SourceLocation EndLoc);
8076  /// \brief Called on well-formed 'mergeable' clause.
8078  SourceLocation EndLoc);
8079  /// \brief Called on well-formed 'read' clause.
8081  SourceLocation EndLoc);
8082  /// \brief Called on well-formed 'write' clause.
8084  SourceLocation EndLoc);
8085  /// \brief Called on well-formed 'update' clause.
8087  SourceLocation EndLoc);
8088  /// \brief Called on well-formed 'capture' clause.
8090  SourceLocation EndLoc);
8091  /// \brief Called on well-formed 'seq_cst' clause.
8093  SourceLocation EndLoc);
8094  /// \brief Called on well-formed 'threads' clause.
8096  SourceLocation EndLoc);
8097  /// \brief Called on well-formed 'simd' clause.
8099  SourceLocation EndLoc);
8100  /// \brief Called on well-formed 'nogroup' clause.
8102  SourceLocation EndLoc);
8103 
8105  OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
8106  SourceLocation StartLoc, SourceLocation LParenLoc,
8108  CXXScopeSpec &ReductionIdScopeSpec,
8109  const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind,
8110  OpenMPLinearClauseKind LinKind, OpenMPMapClauseKind MapTypeModifier,
8111  OpenMPMapClauseKind MapType, SourceLocation DepLinMapLoc);
8112  /// \brief Called on well-formed 'private' clause.
8114  SourceLocation StartLoc,
8115  SourceLocation LParenLoc,
8116  SourceLocation EndLoc);
8117  /// \brief Called on well-formed 'firstprivate' clause.
8119  SourceLocation StartLoc,
8120  SourceLocation LParenLoc,
8121  SourceLocation EndLoc);
8122  /// \brief Called on well-formed 'lastprivate' clause.
8124  SourceLocation StartLoc,
8125  SourceLocation LParenLoc,
8126  SourceLocation EndLoc);
8127  /// \brief Called on well-formed 'shared' clause.
8129  SourceLocation StartLoc,
8130  SourceLocation LParenLoc,
8131  SourceLocation EndLoc);
8132  /// \brief Called on well-formed 'reduction' clause.
8133  OMPClause *
8136  SourceLocation EndLoc,
8137  CXXScopeSpec &ReductionIdScopeSpec,
8138  const DeclarationNameInfo &ReductionId);
8139  /// \brief Called on well-formed 'linear' clause.
8140  OMPClause *
8142  SourceLocation StartLoc, SourceLocation LParenLoc,
8143  OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
8145  /// \brief Called on well-formed 'aligned' clause.
8147  Expr *Alignment,
8148  SourceLocation StartLoc,
8149  SourceLocation LParenLoc,
8151  SourceLocation EndLoc);
8152  /// \brief Called on well-formed 'copyin' clause.
8154  SourceLocation StartLoc,
8155  SourceLocation LParenLoc,
8156  SourceLocation EndLoc);
8157  /// \brief Called on well-formed 'copyprivate' clause.
8159  SourceLocation StartLoc,
8160  SourceLocation LParenLoc,
8161  SourceLocation EndLoc);
8162  /// \brief Called on well-formed 'flush' pseudo clause.
8164  SourceLocation StartLoc,
8165  SourceLocation LParenLoc,
8166  SourceLocation EndLoc);
8167  /// \brief Called on well-formed 'depend' clause.
8168  OMPClause *
8171  SourceLocation StartLoc, SourceLocation LParenLoc,
8172  SourceLocation EndLoc);
8173  /// \brief Called on well-formed 'device' clause.
8175  SourceLocation LParenLoc,
8176  SourceLocation EndLoc);
8177  /// \brief Called on well-formed 'map' clause.
8179  OpenMPMapClauseKind MapTypeModifier, OpenMPMapClauseKind MapType,
8181  SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
8182  /// \brief Called on well-formed 'num_teams' clause.
8184  SourceLocation LParenLoc,
8185  SourceLocation EndLoc);
8186  /// \brief Called on well-formed 'thread_limit' clause.
8188  SourceLocation StartLoc,
8189  SourceLocation LParenLoc,
8190  SourceLocation EndLoc);
8191  /// \brief Called on well-formed 'priority' clause.
8193  SourceLocation LParenLoc,
8194  SourceLocation EndLoc);
8195 
8196  /// \brief The kind of conversion being performed.
8198  /// \brief An implicit conversion.
8200  /// \brief A C-style cast.
8202  /// \brief A functional-style cast.
8204  /// \brief A cast other than a C-style cast.
8206  };
8207 
8208  /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
8209  /// cast. If there is already an implicit cast, merge into the existing one.
8210  /// If isLvalue, the result of the cast is an lvalue.
8212  ExprValueKind VK = VK_RValue,
8213  const CXXCastPath *BasePath = nullptr,
8216 
8217  /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
8218  /// to the conversion from scalar type ScalarTy to the Boolean type.
8220 
8221  /// IgnoredValueConversions - Given that an expression's result is
8222  /// syntactically ignored, perform any conversions that are
8223  /// required.
8225 
8226  // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
8227  // functions and arrays to their respective pointers (C99 6.3.2.1).
8229 
8230  /// CallExprUnaryConversions - a special case of an unary conversion
8231  /// performed on a function designator of a call expression.
8233 
8234  // DefaultFunctionArrayConversion - converts functions and arrays
8235  // to their respective pointers (C99 6.3.2.1).
8236  ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose = true);
8237 
8238  // DefaultFunctionArrayLvalueConversion - converts functions and
8239  // arrays to their respective pointers and performs the
8240  // lvalue-to-rvalue conversion.
8242  bool Diagnose = true);
8243 
8244  // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
8245  // the operand. This is DefaultFunctionArrayLvalueConversion,
8246  // except that it assumes the operand isn't of function or array
8247  // type.
8249 
8250  // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
8251  // do not have a prototype. Integer promotions are performed on each
8252  // argument, and arguments that have type float are promoted to double.
8254 
8255  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
8262  };
8263 
8265  const FunctionProtoType *Proto,
8266  Expr *Fn);
8267 
8268  // Used for determining in which context a type is allowed to be passed to a
8269  // vararg function.
8270  enum VarArgKind {
8276  };
8277 
8278  // Determines which VarArgKind fits an expression.
8280 
8281  /// Check to see if the given expression is a valid argument to a variadic
8282  /// function, issuing a diagnostic if not.
8283  void checkVariadicArgument(const Expr *E, VariadicCallType CT);
8284 
8285  /// Check to see if a given expression could have '.c_str()' called on it.
8286  bool hasCStrMethod(const Expr *E);
8287 
8288  /// GatherArgumentsForCall - Collector argument expressions for various
8289  /// form of call prototypes.
8290  bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
8291  const FunctionProtoType *Proto,
8292  unsigned FirstParam, ArrayRef<Expr *> Args,
8293  SmallVectorImpl<Expr *> &AllArgs,
8295  bool AllowExplicit = false,
8296  bool IsListInitialization = false);
8297 
8298  // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
8299  // will create a runtime trap if the resulting type is not a POD type.
8301  FunctionDecl *FDecl);
8302 
8303  // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
8304  // operands and then handles various conversions that are common to binary
8305  // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
8306  // routine returns the first non-arithmetic type found. The client is
8307  // responsible for emitting appropriate error diagnostics.
8309  bool IsCompAssign = false);
8310 
8311  /// AssignConvertType - All of the 'assignment' semantic checks return this
8312  /// enum to indicate whether the assignment was allowed. These checks are
8313  /// done for simple assignments, as well as initialization, return from
8314  /// function, argument passing, etc. The query is phrased in terms of a
8315  /// source and destination type.
8317  /// Compatible - the types are compatible according to the standard.
8319 
8320  /// PointerToInt - The assignment converts a pointer to an int, which we
8321  /// accept as an extension.
8323 
8324  /// IntToPointer - The assignment converts an int to a pointer, which we
8325  /// accept as an extension.
8327 
8328  /// FunctionVoidPointer - The assignment is between a function pointer and
8329  /// void*, which the standard doesn't allow, but we accept as an extension.
8331 
8332  /// IncompatiblePointer - The assignment is between two pointers types that
8333  /// are not compatible, but we accept them as an extension.
8335 
8336  /// IncompatiblePointer - The assignment is between two pointers types which
8337  /// point to integers which have a different sign, but are otherwise
8338  /// identical. This is a subset of the above, but broken out because it's by
8339  /// far the most common case of incompatible pointers.
8341 
8342  /// CompatiblePointerDiscardsQualifiers - The assignment discards
8343  /// c/v/r qualifiers, which we accept as an extension.
8345 
8346  /// IncompatiblePointerDiscardsQualifiers - The assignment
8347  /// discards qualifiers that we don't permit to be discarded,
8348  /// like address spaces.
8350 
8351  /// IncompatibleNestedPointerQualifiers - The assignment is between two
8352  /// nested pointer types, and the qualifiers other than the first two
8353  /// levels differ e.g. char ** -> const char **, but we accept them as an
8354  /// extension.
8356 
8357  /// IncompatibleVectors - The assignment is between two vector types that
8358  /// have the same size, which we accept as an extension.
8360 
8361  /// IntToBlockPointer - The assignment converts an int to a block
8362  /// pointer. We disallow this.
8364 
8365  /// IncompatibleBlockPointer - The assignment is between two block
8366  /// pointers types that are not compatible.
8368 
8369  /// IncompatibleObjCQualifiedId - The assignment is between a qualified
8370  /// id type and something else (that is incompatible with it). For example,
8371  /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
8373 
8374  /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
8375  /// object with __weak qualifier.
8377 
8378  /// Incompatible - We reject this conversion outright, it is invalid to
8379  /// represent it in the AST.
8381  };
8382 
8383  /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
8384  /// assignment conversion type specified by ConvTy. This returns true if the
8385  /// conversion was invalid or false if the conversion was accepted.
8387  SourceLocation Loc,
8388  QualType DstType, QualType SrcType,
8389  Expr *SrcExpr, AssignmentAction Action,
8390  bool *Complained = nullptr);
8391 
8392  /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
8393  /// enum. If AllowMask is true, then we also allow the complement of a valid
8394  /// value, to be used as a mask.
8395  bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
8396  bool AllowMask) const;
8397 
8398  /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
8399  /// integer not in the range of enum values.
8400  void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
8401  Expr *SrcExpr);
8402 
8403  /// CheckAssignmentConstraints - Perform type checking for assignment,
8404  /// argument passing, variable initialization, and function return values.
8405  /// C99 6.5.16.
8407  QualType LHSType,
8408  QualType RHSType);
8409 
8410  /// Check assignment constraints and optionally prepare for a conversion of
8411  /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
8412  /// is true.
8414  ExprResult &RHS,
8415  CastKind &Kind,
8416  bool ConvertRHS = true);
8417 
8418  // CheckSingleAssignmentConstraints - Currently used by
8419  // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking,
8420  // this routine performs the default function/array converions, if ConvertRHS
8421  // is true.
8423  ExprResult &RHS,
8424  bool Diagnose = true,
8425  bool DiagnoseCFAudited = false,
8426  bool ConvertRHS = true);
8427 
8428  // \brief If the lhs type is a transparent union, check whether we
8429  // can initialize the transparent union with the given expression.
8431  ExprResult &RHS);
8432 
8434 
8435  bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
8436 
8439  bool AllowExplicit = false);
8442  bool AllowExplicit,
8445  const ImplicitConversionSequence& ICS,
8450  const StandardConversionSequence& SCS,
8452  CheckedConversionKind CCK);
8453 
8454  /// the following "Check" methods will return a valid/converted QualType
8455  /// or a null QualType (indicating an error diagnostic was issued).
8456 
8457  /// type checking binary operators (subroutines of CreateBuiltinBinOp).
8459  ExprResult &RHS);
8461  ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
8462  SourceLocation OpLoc, bool isIndirect);
8464  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
8465  bool IsDivide);
8466  QualType CheckRemainderOperands( // C99 6.5.5
8467  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8468  bool IsCompAssign = false);
8469  QualType CheckAdditionOperands( // C99 6.5.6
8470  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8471  BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
8472  QualType CheckSubtractionOperands( // C99 6.5.6
8473  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8474  QualType* CompLHSTy = nullptr);
8475  QualType CheckShiftOperands( // C99 6.5.7
8476  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8477  BinaryOperatorKind Opc, bool IsCompAssign = false);
8478  QualType CheckCompareOperands( // C99 6.5.8/9
8479  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8480  BinaryOperatorKind Opc, bool isRelational);
8481  QualType CheckBitwiseOperands( // C99 6.5.[10...12]
8482  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8483  bool IsCompAssign = false);
8484  QualType CheckLogicalOperands( // C99 6.5.[13,14]
8485  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8486  BinaryOperatorKind Opc);
8487  // CheckAssignmentOperands is used for both simple and compound assignment.
8488  // For simple assignment, pass both expressions and a null converted type.
8489  // For compound assignment, pass both expressions and the converted type.
8490  QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
8491  Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType);
8492 
8494  UnaryOperatorKind Opcode, Expr *Op);
8496  BinaryOperatorKind Opcode,
8497  Expr *LHS, Expr *RHS);
8500 
8501  QualType CheckConditionalOperands( // C99 6.5.15
8502  ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
8503  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
8505  ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
8506  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
8508  bool *NonStandardCompositeType = nullptr);
8510  ExprResult &E1, ExprResult &E2,
8511  bool *NonStandardCompositeType = nullptr) {
8512  Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
8513  QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp,
8514  NonStandardCompositeType);
8515  E1 = E1Tmp;
8516  E2 = E2Tmp;
8517  return Composite;
8518  }
8519 
8521  SourceLocation QuestionLoc);
8522 
8523  bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
8524  SourceLocation QuestionLoc);
8525 
8528  bool IsEqual, SourceRange Range);
8529 
8530  /// type checking for vector binary operators.
8532  SourceLocation Loc, bool IsCompAssign,
8533  bool AllowBothBool, bool AllowBoolConversion);
8536  SourceLocation Loc, bool isRelational);
8538  SourceLocation Loc);
8539 
8540  bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
8541  bool isLaxVectorConversion(QualType srcType, QualType destType);
8542 
8543  /// type checking declaration initializers (C99 6.7.8)
8545 
8546  // type checking C++ declaration initializers (C++ [dcl.init]).
8547 
8548  /// ReferenceCompareResult - Expresses the result of comparing two
8549  /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
8550  /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
8552  /// Ref_Incompatible - The two types are incompatible, so direct
8553  /// reference binding is not possible.
8555  /// Ref_Related - The two types are reference-related, which means
8556  /// that their unqualified forms (T1 and T2) are either the same
8557  /// or T1 is a base class of T2.
8559  /// Ref_Compatible_With_Added_Qualification - The two types are
8560  /// reference-compatible with added qualification, meaning that
8561  /// they are reference-compatible and the qualifiers on T1 (cv1)
8562  /// are greater than the qualifiers on T2 (cv2).
8564  /// Ref_Compatible - The two types are reference-compatible and
8565  /// have equivalent qualifiers (cv1 == cv2).
8567  };
8568 
8570  QualType T1, QualType T2,
8571  bool &DerivedToBase,
8572  bool &ObjCConversion,
8573  bool &ObjCLifetimeConversion);
8574 
8577  ExprValueKind &VK, CXXCastPath &Path);
8578 
8579  /// \brief Force an expression with unknown-type to an expression of the
8580  /// given type.
8582 
8583  /// \brief Type-check an expression that's being passed to an
8584  /// __unknown_anytype parameter.
8586  Expr *result, QualType &paramType);
8587 
8588  // CheckVectorCast - check type constraints for vectors.
8589  // Since vectors are an extension, there are no C standard reference for this.
8590  // We allow casting between vectors and integer datatypes of the same size.
8591  // returns true if the cast is invalid
8592  bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
8593  CastKind &Kind);
8594 
8595  /// \brief Prepare `SplattedExpr` for a vector splat operation, adding
8596  /// implicit casts if necessary.
8597  ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
8598 
8599  // CheckExtVectorCast - check type constraints for extended vectors.
8600  // Since vectors are an extension, there are no C standard reference for this.
8601  // We allow casting between vectors and integer datatypes of the same size,
8602  // or vectors and the element type of that vector.
8603  // returns the cast expr
8605  CastKind &Kind);
8606 
8608  SourceLocation LParenLoc,
8609  Expr *CastExpr,
8610  SourceLocation RParenLoc);
8611 
8613 
8614  /// \brief Checks for invalid conversions and casts between
8615  /// retainable pointers and other pointer kinds.
8617  QualType castType, Expr *&op,
8619  bool Diagnose = true,
8620  bool DiagnoseCFAudited = false,
8622  );
8623 
8625  void diagnoseARCUnbridgedCast(Expr *e);
8626 
8628  QualType ExprType);
8629 
8630  /// checkRetainCycles - Check whether an Objective-C message send
8631  /// might create an obvious retain cycle.
8633  void checkRetainCycles(Expr *receiver, Expr *argument);
8634  void checkRetainCycles(VarDecl *Var, Expr *Init);
8635 
8636  /// checkUnsafeAssigns - Check whether +1 expr is being assigned
8637  /// to weak/__unsafe_unretained type.
8638  bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
8639 
8640  /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
8641  /// to weak/__unsafe_unretained expression.
8642  void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
8643 
8644  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
8645  /// \param Method - May be null.
8646  /// \param [out] ReturnType - The return type of the send.
8647  /// \return true iff there were any incompatible types.
8648  bool CheckMessageArgumentTypes(QualType ReceiverType,
8649  MultiExprArg Args, Selector Sel,
8650  ArrayRef<SourceLocation> SelectorLocs,
8651  ObjCMethodDecl *Method, bool isClassMessage,
8652  bool isSuperMessage,
8653  SourceLocation lbrac, SourceLocation rbrac,
8654  SourceRange RecRange,
8655  QualType &ReturnType, ExprValueKind &VK);
8656 
8657  /// \brief Determine the result of a message send expression based on
8658  /// the type of the receiver, the method expected to receive the message,
8659  /// and the form of the message send.
8661  ObjCMethodDecl *Method,
8662  bool isClassMessage, bool isSuperMessage);
8663 
8664  /// \brief If the given expression involves a message send to a method
8665  /// with a related result type, emit a note describing what happened.
8666  void EmitRelatedResultTypeNote(const Expr *E);
8667 
8668  /// \brief Given that we had incompatible pointer types in a return
8669  /// statement, check whether we're in a method with a related result
8670  /// type, and if so, emit a note describing what happened.
8672 
8673  /// CheckBooleanCondition - Diagnose problems involving the use of
8674  /// the given expression as a boolean condition (e.g. in an if
8675  /// statement). Also performs the standard function and array
8676  /// decays, possibly changing the input variable.
8677  ///
8678  /// \param Loc - A location associated with the condition, e.g. the
8679  /// 'if' keyword.
8680  /// \return true iff there were any errors
8682 
8684  Expr *SubExpr);
8685 
8686  /// DiagnoseAssignmentAsCondition - Given that an expression is
8687  /// being used as a boolean condition, warn if it's an assignment.
8689 
8690  /// \brief Redundant parentheses over an equality comparison can indicate
8691  /// that the user intended an assignment used as condition.
8693 
8694  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
8696 
8697  /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
8698  /// the specified width and sign. If an overflow occurs, detect it and emit
8699  /// the specified diagnostic.
8700  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
8701  unsigned NewWidth, bool NewSign,
8702  SourceLocation Loc, unsigned DiagID);
8703 
8704  /// Checks that the Objective-C declaration is declared in the global scope.
8705  /// Emits an error and marks the declaration as invalid if it's not declared
8706  /// in the global scope.
8707  bool CheckObjCDeclScope(Decl *D);
8708 
8709  /// \brief Abstract base class used for diagnosing integer constant
8710  /// expression violations.
8712  public:
8713  bool Suppress;
8714 
8715  VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { }
8716 
8717  virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) =0;
8718  virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR);
8719  virtual ~VerifyICEDiagnoser() { }
8720  };
8721 
8722  /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
8723  /// and reports the appropriate diagnostics. Returns false on success.
8724  /// Can optionally return the value of the expression.
8726  VerifyICEDiagnoser &Diagnoser,
8727  bool AllowFold = true);
8729  unsigned DiagID,
8730  bool AllowFold = true);
8732  llvm::APSInt *Result = nullptr);
8733 
8734  /// VerifyBitField - verifies that a bit field expression is an ICE and has
8735  /// the correct width, and that the field type is valid.
8736  /// Returns false on success.
8737  /// Can optionally return whether the bit-field is of width 0
8739  QualType FieldTy, bool IsMsStruct,
8740  Expr *BitWidth, bool *ZeroWidth = nullptr);
8741 
8748  };
8749 
8751 
8753  CFP_Never, // Invalid caller/callee combination.
8754  CFP_LastResort, // Lowest priority. Only in effect if
8755  // LangOpts.CUDADisableTargetCallChecks is true.
8756  CFP_Fallback, // Low priority caller/callee combination
8757  CFP_Best, // Preferred caller/callee combination
8758  };
8759 
8760  /// Identifies relative preference of a given Caller/Callee
8761  /// combination, based on their host/device attributes.
8762  /// \param Caller function which needs address of \p Callee.
8763  /// nullptr in case of global context.
8764  /// \param Callee target function
8765  ///
8766  /// \returns preference value for particular Caller/Callee combination.
8768  const FunctionDecl *Callee);
8769 
8770  bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee);
8771 
8772  /// Finds a function in \p Matches with highest calling priority
8773  /// from \p Caller context and erases all functions with lower
8774  /// calling priority.
8775  void EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
8777  void EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
8780  const FunctionDecl *Caller,
8781  SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
8782 
8783  /// Given a implicit special member, infer its CUDA target from the
8784  /// calls it needs to make to underlying base/field special members.
8785  /// \param ClassDecl the class for which the member is being created.
8786  /// \param CSM the kind of special member.
8787  /// \param MemberDecl the special member itself.
8788  /// \param ConstRHS true if this is a copy operation with a const object on
8789  /// its RHS.
8790  /// \param Diagnose true if this call should emit diagnostics.
8791  /// \return true if there was an error inferring.
8792  /// The result of this call is implicit CUDA target attribute(s) attached to
8793  /// the member declaration.
8795  CXXSpecialMember CSM,
8796  CXXMethodDecl *MemberDecl,
8797  bool ConstRHS,
8798  bool Diagnose);
8799 
8800  /// \name Code completion
8801  //@{
8802  /// \brief Describes the context in which code completion occurs.
8804  /// \brief Code completion occurs at top-level or namespace context.
8806  /// \brief Code completion occurs within a class, struct, or union.
8808  /// \brief Code completion occurs within an Objective-C interface, protocol,
8809  /// or category.
8811  /// \brief Code completion occurs within an Objective-C implementation or
8812  /// category implementation
8814  /// \brief Code completion occurs within the list of instance variables
8815  /// in an Objective-C interface, protocol, category, or implementation.
8817  /// \brief Code completion occurs following one or more template
8818  /// headers.
8820  /// \brief Code completion occurs following one or more template
8821  /// headers within a class.
8823  /// \brief Code completion occurs within an expression.
8825  /// \brief Code completion occurs within a statement, which may
8826  /// also be an expression or a declaration.
8828  /// \brief Code completion occurs at the beginning of the
8829  /// initialization statement (or expression) in a for loop.
8831  /// \brief Code completion occurs within the condition of an if,
8832  /// while, switch, or for statement.
8834  /// \brief Code completion occurs within the body of a function on a
8835  /// recovery path, where we do not have a specific handle on our position
8836  /// in the grammar.
8838  /// \brief Code completion occurs where only a type is permitted.
8840  /// \brief Code completion occurs in a parenthesized expression, which
8841  /// might also be a type cast.
8843  /// \brief Code completion occurs within a sequence of declaration
8844  /// specifiers within a function, method, or block.
8846  };
8847 
8850  ParserCompletionContext CompletionContext);
8851  void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
8852  bool AllowNonIdentifiers,
8853  bool AllowNestedNameSpecifiers);
8854 
8855  struct CodeCompleteExpressionData;
8856  void CodeCompleteExpression(Scope *S,
8857  const CodeCompleteExpressionData &Data);
8859  SourceLocation OpLoc,
8860  bool IsArrow);
8862  void CodeCompleteTag(Scope *S, unsigned TagSpec);
8864  void CodeCompleteCase(Scope *S);
8865  void CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args);
8867  ArrayRef<Expr *> Args);
8868  void CodeCompleteInitializer(Scope *S, Decl *D);
8869  void CodeCompleteReturn(Scope *S);
8870  void CodeCompleteAfterIf(Scope *S);
8871  void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS);
8872 
8874  bool EnteringContext);
8875  void CodeCompleteUsing(Scope *S);
8881  Decl *Constructor,
8882  ArrayRef<CXXCtorInitializer *> Initializers);
8883 
8885  bool AfterAmpersand);
8886 
8895  bool IsParameter);
8898  ArrayRef<IdentifierInfo *> SelIdents,
8899  bool AtArgumentExpression);
8900  void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
8901  ArrayRef<IdentifierInfo *> SelIdents,
8902  bool AtArgumentExpression,
8903  bool IsSuper = false);
8904  void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
8905  ArrayRef<IdentifierInfo *> SelIdents,
8906  bool AtArgumentExpression,
8907  ObjCInterfaceDecl *Super = nullptr);
8909  DeclGroupPtrTy IterationVar);
8911  ArrayRef<IdentifierInfo *> SelIdents);
8913  ArrayRef<IdentifierLocPair> Protocols);
8917  IdentifierInfo *ClassName,
8918  SourceLocation ClassNameLoc);
8921  IdentifierInfo *ClassName,
8922  SourceLocation ClassNameLoc);
8924  IdentifierInfo *ClassName,
8925  SourceLocation ClassNameLoc);
8928  IdentifierInfo *PropertyName);
8930  bool IsInstanceMethod,
8931  ParsedType ReturnType);
8933  bool IsInstanceMethod,
8934  bool AtParameterName,
8935  ParsedType ReturnType,
8936  ArrayRef<IdentifierInfo *> SelIdents);
8937  void CodeCompletePreprocessorDirective(bool InConditional);
8939  void CodeCompletePreprocessorMacroName(bool IsDefinition);
8942  IdentifierInfo *Macro,
8944  unsigned Argument);
8947  CodeCompletionTUInfo &CCTUInfo,
8949  //@}
8950 
8951  //===--------------------------------------------------------------------===//
8952  // Extra semantic analysis beyond the C type system
8953 
8954 public:
8956  unsigned ByteNo) const;
8957 
8958 private:
8959  void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
8960  const ArraySubscriptExpr *ASE=nullptr,
8961  bool AllowOnePastEnd=true, bool IndexNegated=false);
8962  void CheckArrayAccess(const Expr *E);
8963  // Used to grab the relevant information from a FormatAttr and a
8964  // FunctionDeclaration.
8965  struct FormatStringInfo {
8966  unsigned FormatIdx;
8967  unsigned FirstDataArg;
8968  bool HasVAListArg;
8969  };
8970 
8971  static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
8972  FormatStringInfo *FSI);
8973  bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
8974  const FunctionProtoType *Proto);
8975  bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
8976  ArrayRef<const Expr *> Args);
8977  bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
8978  const FunctionProtoType *Proto);
8979  bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
8980  void CheckConstructorCall(FunctionDecl *FDecl,
8981  ArrayRef<const Expr *> Args,
8982  const FunctionProtoType *Proto,
8983  SourceLocation Loc);
8984 
8985  void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
8986  ArrayRef<const Expr *> Args, bool IsMemberFunction,
8987  SourceLocation Loc, SourceRange Range,
8988  VariadicCallType CallType);
8989 
8990  bool CheckObjCString(Expr *Arg);
8991 
8992  ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
8993  unsigned BuiltinID, CallExpr *TheCall);
8994 
8995  bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
8996  unsigned MaxWidth);
8997  bool CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
8998  bool CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
8999 
9000  bool CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9001  bool CheckMipsBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9002  bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9003  bool CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9004  bool CheckPPCBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9005 
9006  bool SemaBuiltinVAStartImpl(CallExpr *TheCall);
9007  bool SemaBuiltinVAStart(CallExpr *TheCall);
9008  bool SemaBuiltinMSVAStart(CallExpr *TheCall);
9009  bool SemaBuiltinVAStartARM(CallExpr *Call);
9010  bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
9011  bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
9012 
9013 public:
9014  // Used by C++ template instantiation.
9015  ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
9016  ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
9017  SourceLocation BuiltinLoc,
9018  SourceLocation RParenLoc);
9019 
9020 private:
9021  bool SemaBuiltinPrefetch(CallExpr *TheCall);
9022  bool SemaBuiltinAssume(CallExpr *TheCall);
9023  bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
9024  bool SemaBuiltinLongjmp(CallExpr *TheCall);
9025  bool SemaBuiltinSetjmp(CallExpr *TheCall);
9026  ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
9027  ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
9028  ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
9030  bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
9031  llvm::APSInt &Result);
9032  bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
9033  int Low, int High);
9034  bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
9035  int ArgNum, unsigned ExpectedFieldNum,
9036  bool AllowName);
9037 public:
9048  };
9049  static FormatStringType GetFormatStringType(const FormatAttr *Format);
9050 
9051  void CheckFormatString(const StringLiteral *FExpr, const Expr *OrigFormatExpr,
9052  ArrayRef<const Expr *> Args, bool HasVAListArg,
9053  unsigned format_idx, unsigned firstDataArg,
9054  FormatStringType Type, bool inFunctionCall,
9055  VariadicCallType CallType,
9056  llvm::SmallBitVector &CheckedVarArgs);
9057 
9058  bool FormatStringHasSArg(const StringLiteral *FExpr);
9059 
9060  static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
9061 
9062 private:
9063  bool CheckFormatArguments(const FormatAttr *Format,
9065  bool IsCXXMember,
9066  VariadicCallType CallType,
9067  SourceLocation Loc, SourceRange Range,
9068  llvm::SmallBitVector &CheckedVarArgs);
9069  bool CheckFormatArguments(ArrayRef<const Expr *> Args,
9070  bool HasVAListArg, unsigned format_idx,
9071  unsigned firstDataArg, FormatStringType Type,
9072  VariadicCallType CallType,
9073  SourceLocation Loc, SourceRange range,
9074  llvm::SmallBitVector &CheckedVarArgs);
9075 
9076  void CheckAbsoluteValueFunction(const CallExpr *Call,
9077  const FunctionDecl *FDecl,
9078  IdentifierInfo *FnInfo);
9079 
9080  void CheckMemaccessArguments(const CallExpr *Call,
9081  unsigned BId,
9082  IdentifierInfo *FnName);
9083 
9084  void CheckStrlcpycatArguments(const CallExpr *Call,
9085  IdentifierInfo *FnName);
9086 
9087  void CheckStrncatArguments(const CallExpr *Call,
9088  IdentifierInfo *FnName);
9089 
9090  void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
9091  SourceLocation ReturnLoc,
9092  bool isObjCMethod = false,
9093  const AttrVec *Attrs = nullptr,
9094  const FunctionDecl *FD = nullptr);
9095 
9096  void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS);
9097  void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
9098  void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
9099  void CheckForIntOverflow(Expr *E);
9100  void CheckUnsequencedOperations(Expr *E);
9101 
9102  /// \brief Perform semantic checks on a completed expression. This will either
9103  /// be a full-expression or a default argument expression.
9104  void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
9105  bool IsConstexpr = false);
9106 
9107  void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
9108  Expr *Init);
9109 
9110  /// \brief Check if the given expression contains 'break' or 'continue'
9111  /// statement that produces control flow different from GCC.
9112  void CheckBreakContinueBinding(Expr *E);
9113 
9114  /// \brief Check whether receiver is mutable ObjC container which
9115  /// attempts to add itself into the container
9116  void CheckObjCCircularContainer(ObjCMessageExpr *Message);
9117 
9118  void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
9119  void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
9120  bool DeleteWasArrayForm);
9121 public:
9122  /// \brief Register a magic integral constant to be used as a type tag.
9123  void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
9124  uint64_t MagicValue, QualType Type,
9125  bool LayoutCompatible, bool MustBeNull);
9126 
9127  struct TypeTagData {
9129 
9130  TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull) :
9131  Type(Type), LayoutCompatible(LayoutCompatible),
9132  MustBeNull(MustBeNull)
9133  {}
9134 
9136 
9137  /// If true, \c Type should be compared with other expression's types for
9138  /// layout-compatibility.
9139  unsigned LayoutCompatible : 1;
9140  unsigned MustBeNull : 1;
9141  };
9142 
9143  /// A pair of ArgumentKind identifier and magic value. This uniquely
9144  /// identifies the magic value.
9145  typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
9146 
9147 private:
9148  /// \brief A map from magic value to type information.
9149  std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
9150  TypeTagForDatatypeMagicValues;
9151 
9152  /// \brief Peform checks on a call of a function with argument_with_type_tag
9153  /// or pointer_with_type_tag attributes.
9154  void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
9155  const Expr * const *ExprArgs);
9156 
9157  /// \brief The parser's current scope.
9158  ///
9159  /// The parser maintains this state here.
9160  Scope *CurScope;
9161 
9162  mutable IdentifierInfo *Ident_super;
9163  mutable IdentifierInfo *Ident___float128;
9164 
9165  /// Nullability type specifiers.
9166  IdentifierInfo *Ident__Nonnull = nullptr;
9167  IdentifierInfo *Ident__Nullable = nullptr;
9168  IdentifierInfo *Ident__Null_unspecified = nullptr;
9169 
9170  IdentifierInfo *Ident_NSError = nullptr;
9171 
9172 protected:
9173  friend class Parser;
9175  friend class ASTReader;
9176  friend class ASTDeclReader;
9177  friend class ASTWriter;
9178 
9179 public:
9180  /// Retrieve the keyword associated
9182 
9183  /// The struct behind the CFErrorRef pointer.
9184  RecordDecl *CFError = nullptr;
9185 
9186  /// Retrieve the identifier "NSError".
9188 
9189  /// \brief Retrieve the parser's current scope.
9190  ///
9191  /// This routine must only be used when it is certain that semantic analysis
9192  /// and the parser are in precisely the same context, which is not the case
9193  /// when, e.g., we are performing any kind of template instantiation.
9194  /// Therefore, the only safe places to use this scope are in the parser
9195  /// itself and in routines directly invoked from the parser and *never* from
9196  /// template substitution or instantiation.
9197  Scope *getCurScope() const { return CurScope; }
9198 
9200  return CurScope->incrementMSManglingNumber();
9201  }
9202 
9205 
9206  Decl *getObjCDeclContext() const;
9207 
9210  }
9211 
9213 
9215  const DeclContext *DC = getCurLexicalContext();
9216  // A category implicitly has the attribute of the interface.
9217  if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
9218  DC = CatD->getClassInterface();
9219  return DC;
9220  }
9221 
9222  /// \brief To be used for checking whether the arguments being passed to
9223  /// function exceeds the number of parameters expected for it.
9224  static bool TooManyArguments(size_t NumParams, size_t NumArgs,
9225  bool PartialOverloading = false) {
9226  // We check whether we're just after a comma in code-completion.
9227  if (NumArgs > 0 && PartialOverloading)
9228  return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
9229  return NumArgs > NumParams;
9230  }
9231 
9232  // Emitting members of dllexported classes is delayed until the class
9233  // (including field initializers) is fully parsed.
9235 };
9236 
9237 /// \brief RAII object that enters a new expression evaluation context.
9239  Sema &Actions;
9240 
9241 public:
9244  Decl *LambdaContextDecl = nullptr,
9245  bool IsDecltype = false)
9246  : Actions(Actions) {
9247  Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
9248  IsDecltype);
9249  }
9253  bool IsDecltype = false)
9254  : Actions(Actions) {
9255  Actions.PushExpressionEvaluationContext(NewContext,
9257  IsDecltype);
9258  }
9259 
9261  Actions.PopExpressionEvaluationContext();
9262  }
9263 };
9264 
9265 DeductionFailureInfo
9267  sema::TemplateDeductionInfo &Info);
9268 
9269 /// \brief Contains a late templated function.
9270 /// Will be parsed at the end of the translation unit, used by Sema & Parser.
9273  /// \brief The template function declaration to be late parsed.
9275 };
9276 
9277 } // end namespace clang
9278 
9279 #endif
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition: Sema.h:391
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
Abstract class used to diagnose incomplete types.
Definition: Sema.h:1320
void FreePackedContext()
FreePackedContext - Deallocate and null out PackContext.
Definition: SemaAttr.cpp:110
bool CheckNoReturnAttr(const AttributeList &attr)
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
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...
static FormatStringType GetFormatStringType(const FormatAttr *Format)
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid...
Definition: Sema.h:7714
llvm::DenseMap< Selector, ObjCMethodDecl * > ProtocolsMethodsMap
Definition: Sema.h:3012
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
VtorDispStackRAII(Sema &S, bool ShouldSaveAndRestore)
Definition: Sema.h:1014
ExprResult BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
Module * getOwningModule(Decl *Entity)
Get the module owning an entity.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
Definition: SemaExpr.cpp:13815
VariadicCallType
Definition: Sema.h:8256
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: Sema.h:718
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Definition: SemaDecl.cpp:2575
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 ...
CanThrowResult canThrow(const Expr *E)
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
PragmaStack< StringLiteral * > CodeSegStack
Definition: Sema.h:388
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
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:493
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *BeginEndDecl, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind)
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
Definition: SemaStmt.cpp:2145
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the bianry type trait support pseudo-functions.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id)
Called on correct id-expression from the '#pragma omp threadprivate'.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1483
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1436
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
Definition: SemaType.cpp:4944
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition: Sema.h:455
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
SmallVector< Module *, 16 > ActiveTemplateInstantiationLookupModules
Extra modules inspected when performing a lookup during a template instantiation. ...
Definition: Sema.h:6605
int Position
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchers.h:1192
A set of visible modules.
Definition: Basic/Module.h:508
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition: Sema.h:5950
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:212
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, TemplateIdAnnotation &TemplateId, AttributeList *Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition: Sema.h:443
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition: Sema.h:9197
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
Definition: SemaExpr.cpp:5812
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
AttributeList * ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition: Sema.h:7371
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
bool CheckNontrivialField(FieldDecl *FD)
Definition: SemaDecl.cpp:13219
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
Definition: Sema.h:771
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition: Sema.h:6674
no exception specification
IdentifierInfo * getSuperIdentifier() const
Definition: Sema.cpp:1497
Smart pointer class that efficiently represents Objective-C method names.
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
Definition: SemaType.cpp:2250
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source. ...
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
We are instantiating a default argument for a template parameter.
Definition: Sema.h:6493
unsigned Length
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension...
Definition: Sema.h:8322
Stores the type being destroyed by a pseudo-destructor expression.
Definition: ExprCXX.h:1997
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
Definition: SemaExpr.cpp:3152
A (possibly-)qualified type.
Definition: Type.h:575
ASTConsumer & Consumer
Definition: Sema.h:296
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, 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:13294
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
Definition: SemaDecl.cpp:1378
Simple class containing the result of Sema::CorrectTypo.
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType)
Definition: SemaExpr.cpp:9698
TemplateDeductionResult
Describes the result of template argument deduction.
Definition: Sema.h:6287
LateTemplateParserCB * LateTemplateParser
Definition: Sema.h:526
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< Decl * > Params, SourceLocation RAngleLoc)
ActOnTemplateParameterList - Builds a TemplateParameterList that contains the template parameters in ...
bool isInvalid() const
Definition: Ownership.h:159
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:268
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
bool isActive() const
Determine whether this diagnostic is still active.
Definition: Diagnostic.h:908
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< FunctionDecl * > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
Definition: SemaCUDA.cpp:240
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id)
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
Definition: SemaDecl.cpp:14794
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition: Sema.h:1209
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:1078
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules, and thus an ambiguity error can be downgraded to an extension warning.
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition: Sema.cpp:139
Instantiation or recovery rebuild of a for-range statement.
Definition: Sema.h:3356
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
PragmaMSCommentKind
Definition: Sema.h:7571
unsigned MSAsmLabelNameCounter
counter for internal MS Asm label names.
Definition: Sema.h:748
DeclContext * getCurLexicalContext() const
Definition: Sema.h:9208
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
Definition: SemaStmt.cpp:3814
NameClassification(const IdentifierInfo *Keyword)
Definition: Sema.h:1538
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, unsigned NewWidth, bool NewSign, SourceLocation Loc, unsigned DiagID)
ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have the specified width and sign...
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
Definition: ASTConsumer.h:36
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
Defines enumerations for the type traits support.
A cast other than a C-style cast.
Definition: Sema.h:8205
LateParsedTemplateMapT LateParsedTemplateMap
Definition: Sema.h:521
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition: Template.h:178
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
Definition: SemaDecl.cpp:5218
FormatStringType
Definition: Sema.h:9038
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
Definition: SemaExpr.cpp:6798
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
CorrectTypoKind
Definition: Sema.h:2832
static bool getPrintable(bool B)
Definition: Sema.h:1329
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:3450
DeclContext * getFunctionLevelDeclContext()
Definition: Sema.cpp:927
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
Definition: SemaExpr.cpp:3114
Code completion occurs within a class, struct, or union.
Definition: Sema.h:8807
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
Definition: SemaOpenMP.cpp:939
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:7016
Template argument deduction was successful.
Definition: Sema.h:6289
RecordDecl * MSVCGuidDecl
The MSVC "_GUID" struct, which is defined in MSVC header files.
Definition: Sema.h:697
OpenCL volatile options.
Definition: LangOptions.h:166
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:385
Represents a lazily-loaded vector of data.
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.
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
Definition: Sema.h:2636
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition: Sema.h:471
A class which encapsulates the logic for delaying diagnostics during parsing and other processing...
Definition: Sema.h:549
IntrusiveRefCntPtr< MangleNumberingContext > MangleNumbering
The context information used to mangle lambda expressions and block literals within this context...
Definition: Sema.h:830
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:1881
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:411
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
Definition: SemaExpr.cpp:5983
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, IdentifierInfo *Id, unsigned InitStyle, Expr *Init)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
Definition: SemaLambda.cpp:766
const LangOptions & getLangOpts() const
Definition: Sema.h:1041
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition: Sema.cpp:474
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
An initializer.
Definition: Sema.h:5985
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
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...
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier...
Definition: Sema.h:7416
Look up the name of an Objective-C protocol.
Definition: Sema.h:2670
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition: Sema.h:4579
OpenCLOptions OpenCLFeatures
Definition: Sema.h:290
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:271
We are matching the template parameter lists of two templates that might be redeclarations.
Definition: Sema.h:5844
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:2847
PragmaVtorDispKind
Definition: Sema.h:327
FullExprArg MakeFullExpr(Expr *Arg)
Definition: Sema.h:3249
Provides information about an attempted template argument deduction, whose success or failure was des...
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition: Sema.h:2098
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, SourceLocation RParenLoc)
Microsoft __if_not_exists.
Definition: Sema.h:6003
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
We are substituting prior template arguments into a new template parameter.
Definition: Sema.h:6514
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2397
LazyVector< CXXConstructorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition: Sema.h:497
SmallVector< MSVtorDispAttr::Mode, 2 > VtorDispModeStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition: Sema.h:353
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
We are instantiating a default argument for a function.
Definition: Sema.h:6498
StmtResult ActOnExprStmt(ExprResult Arg)
Definition: SemaStmt.cpp:43
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4053
void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS)
The name refers to a function template or a set of overloaded functions that includes at least one fu...
Definition: TemplateKinds.h:26
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Definition: Decl.h:2598
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class...
friend bool operator==(const ActiveTemplateInstantiation &X, const ActiveTemplateInstantiation &Y)
Definition: Sema.h:6560
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:10355
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
Definition: SemaDecl.cpp:10351
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:1750
ActionResult< Expr * > ExprResult
Definition: Ownership.h:252
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed...
Definition: SemaExpr.cpp:4404
The current expression is potentially evaluated at run time, which means that code may be generated t...
Definition: Sema.h:781
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
Definition: SemaLookup.cpp:718
ExprResult BuildCoawaitExpr(SourceLocation KwLoc, Expr *E)
ObjCSubscriptKind
Definition: Sema.h:2359
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, void *InsertPos, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentType IT)
Definition: SemaExpr.cpp:2993
llvm::StringRef StackSlotLabel
Definition: Sema.h:364
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition: Sema.h:356
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsExplicitSpecialization)
Perform semantic checking of a new function declaration.
Definition: SemaDecl.cpp:8323
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments...
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
Definition: SemaStmt.cpp:2997
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:10984
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed...
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition: SemaStmt.cpp:331
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, Expr *TailExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind, OpenMPLinearClauseKind LinKind, OpenMPMapClauseKind MapTypeModifier, OpenMPMapClauseKind MapType, SourceLocation DepLinMapLoc)
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
Defines the clang::Module class, which describes a module in the source code.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Definition: Sema.h:1118
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:7810
bool DiagnoseConditionalForNull(Expr *LHSExpr, 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:5993
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
Definition: SemaExpr.cpp:11605
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:77
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
void incrementMSManglingNumber() const
Definition: Sema.h:9199
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:4699
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToMemberFunction - Build a call to a member function.
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
ExprResult CheckBooleanCondition(Expr *E, SourceLocation Loc)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
Definition: SemaExpr.cpp:13990
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:768
void CodeCompleteUsing(Scope *S)
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, const InitializedEntity &Entity, AccessSpecifier Access, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:23
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for...
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed...
Definition: Sema.h:6906
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition: Sema.h:8316
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2586
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function...
Definition: SemaDecl.cpp:5155
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
Microsoft __if_exists.
Definition: Sema.h:6000
PragmaOptionsAlignKind
Definition: Sema.h:7546
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...
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition: Sema.h:680
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:3918
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition: Sema.h:311
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition: SemaExpr.cpp:798
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1605
The size of a bit-field.
Definition: Sema.h:5964
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
Definition: SemaType.cpp:1990
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowFunctionParameters)
Definition: SemaStmt.cpp:2693
bool CheckVecStepExpr(Expr *E)
Definition: SemaExpr.cpp:3744
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
Definition: SemaInit.cpp:7652
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
Definition: SemaExpr.cpp:14471
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Evaluate the implicit exception specification for a defaulted special member function.
void CodeCompleteNaturalLanguage()
PtrTy get() const
Definition: Ownership.h:163
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4262
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
Definition: SemaExpr.cpp:11851
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition: Sema.h:6846
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, AttributeList *attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
The base class of the type hierarchy.
Definition: Type.h:1249
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition: Sema.h:6946
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: Sema.h:3187
OMPClause * ActOnOpenMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
Records and restores the vtordisp state on entry/exit of C++ method body.
Definition: Sema.h:1012
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:8412
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:8170
MissingImportKind
Kinds of missing import.
Definition: Sema.h:1838
std::unique_ptr< llvm::MemoryBuffer > Buffer
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1117
Declaration of a variable template.
ForRangeStatus
Definition: Sema.h:2535
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition: Sema.h:5594
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
Definition: SemaExpr.cpp:13645
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:402
Template argument deduction produced inconsistent deduced values for the given template parameter...
Definition: Sema.h:6300
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Sema.h:2679
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:46
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaStmt.cpp:3333
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST...
Definition: Sema.h:8380
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:90
void ActOnExitFunctionContext()
Definition: SemaDecl.cpp:1172
LazyVector< const DeclaratorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition: Sema.h:489
A container of type source information.
Definition: Decl.h:61
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed...
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition: Sema.h:1333
Wrapper for void* pointer.
Definition: Ownership.h:45
Parser - This implements a parser for the C family of languages.
Definition: Parse/Parser.h:56
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition: Sema.h:2652
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition: Sema.h:6902
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...
OMPClause * ActOnOpenMPProcBindClause(OpenMPProcBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
Floating point control options.
Definition: LangOptions.h:155
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
Definition: SemaStmt.cpp:2629
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:296
IdentifierInfo * getFloat128Identifier() const
Definition: Sema.cpp:1503
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Definition: SemaExpr.cpp:9250
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
unsigned fp_contract
Definition: LangOptions.h:157
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition: Sema.h:586
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
void PopDeclContext()
Definition: SemaDecl.cpp:1076
void ActOnPragmaFPContract(tok::OnOffSwitch OOS)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT.
Definition: SemaAttr.cpp:565
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
Abstract base class used for diagnosing integer constant expression violations.
Definition: Sema.h:8711
FileNullability Nullability
Definition: Sema.h:237
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition: Sema.h:2689
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition: Sema.cpp:554
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2134
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
unsigned NonInstantiationEntries
The number of ActiveTemplateInstantiation entries in ActiveTemplateInstantiations that are not actual...
Definition: Sema.h:6627
We are instantiating a template declaration.
Definition: Sema.h:6486
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
void CodeCompleteObjCMessageReceiver(Scope *S)
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
void CodeCompleteObjCPropertyGetter(Scope *S)
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
Definition: SemaDecl.cpp:6697
enum clang::Sema::ActiveTemplateInstantiation::InstantiationKind Kind
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
Definition: SemaExpr.cpp:11958
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
Determining whether a for-range statement could be built.
Definition: Sema.h:3359
bool checkObjCKindOfType(QualType &type, SourceLocation loc)
Check the application of the Objective-C '__kindof' qualifier to the given type.
Definition: SemaType.cpp:5659
void CheckCXXDefaultArguments(FunctionDecl *FD)
CheckCXXDefaultArguments - Verify that the default arguments for a function declaration are well-form...
void CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef< Expr * > Args)
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition: Sema.h:6538
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
VerifyICEDiagnoser(bool Suppress=false)
Definition: Sema.h:8715
RAII object to handle the state changes required to synthesize a function body.
Definition: Sema.h:635
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group, bool TypeMayContainAuto=true)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Definition: SemaDecl.cpp:10303
Look up a namespace name within a C++ using directive or namespace alias definition, ignoring non-namespace names (C++ [basic.lookup.udir]p1).
Definition: Sema.h:2656
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition: Sema/Lookup.h:699
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition: Sema.h:6877
void DiagnoseInvalidJumps(Stmt *Body)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
Definition: SemaExpr.cpp:11344
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:80
void ActOnFinishCXXNonNestedClass(Decl *D)
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
Definition: SemaStmt.cpp:1252
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class, then each of the following shall have a name different from T:
Definition: SemaDecl.cpp:4671
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
Definition: SemaExpr.cpp:5724
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition: Sema.cpp:50
void ActOnObjCReenterContainerContext(DeclContext *DC)
Definition: SemaDecl.cpp:12809
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
Definition: SemaExpr.cpp:2662
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:40
RAII object that enters a new expression evaluation context.
Definition: Sema.h:9238
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:699
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Definition: SemaInternal.h:25
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:1727
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition: Sema.h:4027
std::pair< CXXRecordDecl *, CXXSpecialMember > SpecialMemberDecl
Definition: Sema.h:979
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1608
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaStmt.cpp:3349
DiagnosticsEngine & Diags
Definition: Sema.h:297
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition: SemaStmt.cpp:81
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, bool ConvertToBoolean)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl)
Records and restores the FP_CONTRACT state on entry/exit of compound statements.
Definition: Sema.h:999
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
void NoteOverloadCandidate(FunctionDecl *Fn, QualType DestType=QualType(), bool TakingAddress=false)
Extra information about a function prototype.
Definition: Type.h:3067
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, unsigned ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD)
Retrieve the message suffix that should be added to a diagnostic complaining about the given function...
Definition: SemaExpr.cpp:384
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:45
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
CUDAFunctionPreference
Definition: Sema.h:8752
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
StmtResult ActOnCoreturnStmt(SourceLocation KwLoc, Expr *E)
Represents a variable template specialization, which refers to a variable template with a given set o...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
Definition: SemaDecl.cpp:1097
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition: Sema.h:9234
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:1361
void ActOnObjCTemporaryExitContainerContext(DeclContext *DC)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaDecl.cpp:12803
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition: Sema.h:4583
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition: Sema.h:2694
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1356
void ActOnStartStmtExpr()
Definition: SemaExpr.cpp:11256
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so, check that it's a valid override and remember it.
Definition: SemaDecl.cpp:6780
SpecialMemberOverloadResult * LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void Clear() const
Clear out the current diagnostic.
Definition: Diagnostic.h:901
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:48
MangleNumberingContext & getMangleNumberingContext(ASTContext &Ctx)
Retrieve the mangling numbering context, used to consistently number constructs like lambdas for mang...
Definition: SemaLambda.cpp:346
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, SmallVectorImpl< TemplateArgument > &Converted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:35
Code completion occurs within an Objective-C implementation or category implementation.
Definition: Sema.h:8813
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition: Sema.h:727
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:7377
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: Sema.h:966
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
Definition: SemaDecl.cpp:10398
bool IsDecltype
Whether we are in a decltype expression.
Definition: Sema.h:804
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement. ...
Definition: SemaStmt.cpp:2404
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input)
Definition: SemaExpr.cpp:11171
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
static NameClassification NestedNameSpecifier()
Definition: Sema.h:1549
SourceLocation PragmaLocation
Definition: Sema.h:366
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:11019
bool tryCaptureVariable(VarDecl *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:13182
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition: Sema.h:2665
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1299
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, bool KnownDependent, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
Definition: SemaLambda.cpp:243
SourceLocation PointOfInstantiation
The point of instantiation within the source code.
Definition: Sema.h:6526
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:1042
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: Sema.h:736
FPOptions & getFPOptions()
Definition: Sema.h:1043
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
FormatAttr * mergeFormatAttr(Decl *D, SourceRange Range, IdentifierInfo *Format, int FormatIdx, int FirstArg, unsigned AttrSpellingListIndex)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
Definition: SemaDecl.cpp:3643
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
The collection of all-type qualifiers we support.
Definition: Type.h:116
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto)
Definition: SemaDecl.cpp:9663
MethodMatchStrategy
Definition: Sema.h:3104
Information about a template-id annotation token.
static SourceRange getPrintable(TypeLoc TL)
Definition: Sema.h:1341
void setMethod(CXXMethodDecl *MD)
Definition: Sema.h:896
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
Definition: SemaExpr.cpp:5002
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
void threadSafetyCleanup(BeforeSet *Cache)
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:12936
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType...
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
void CheckDelayedMemberExceptionSpecs()
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Definition: SemaExpr.cpp:13731
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=None, ArrayRef< DeclGroupPtrTy > allTUVars=None)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS)
Create a binary operation that may resolve to an overloaded operator.
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:40
#pragma vtordisp(mode)
Definition: Sema.h:329
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool OdrUse)
Perform marking for a reference to an arbitrary declaration.
Definition: SemaExpr.cpp:13679
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
Definition: SemaType.cpp:2289
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:10677
void CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args)
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
ActiveTemplateInstantiation LastTemplateInstantiationErrorContext
The last template from which a template instantiation error or warning was produced.
Definition: Sema.h:6636
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3166
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, AttributeList *AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
Definition: SemaExpr.cpp:6539
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
Definition: SemaAttr.cpp:536
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
The message is a class message, and the identifier is a type name.
Definition: Sema.h:7423
An arbitrary expression.
Definition: Sema.h:5952
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6...
Definition: SemaExpr.cpp:749
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition: Sema.h:1109
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
Definition: SemaExpr.cpp:4011
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition: Sema.h:2288
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition: Sema.h:700
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:6873
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:1429
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition: Sema.cpp:1188
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition: Sema.h:2697
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension...
Definition: Sema.h:8326
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
Definition: SemaDecl.cpp:4432
bool isOpenMPTargetCapturedVar(VarDecl *VD, unsigned Level)
Check if the specified variable is captured by 'target' directive.
Definition: SemaOpenMP.cpp:914
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition: Sema.h:564
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
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:5137
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:233
Step
Definition: OpenMPClause.h:311
void DiagnoseUnusedExprResult(const Stmt *S)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused...
Definition: SemaStmt.cpp:185
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:3255
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition: Sema.h:4253
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier...
Definition: Sema.h:8376
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
void CodeCompleteObjCInterfaceDecl(Scope *S)
Enumerator value with fixed underlying type.
Definition: Sema.h:2272
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool HasTypenameKeyword, SourceLocation TypenameLoc)
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4381
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition: Sema.cpp:1223
Value of a non-type template parameter.
Definition: Sema.h:2273
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
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...
VarDecl * getCopyElisionCandidate(QualType ReturnType, Expr *E, bool AllowFunctionParameters)
Determine whether the given expression is a candidate for copy elision in either a return statement o...
Definition: SemaStmt.cpp:2673
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:91
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1054
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
QualType BuildParenType(QualType T)
Build a paren type including T.
Definition: SemaType.cpp:1732
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=None)
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e...
Definition: SemaDecl.cpp:12709
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
Definition: SemaDecl.cpp:11583
A C-style cast.
Definition: Sema.h:8201
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo &ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
Decl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
OMPClause * ActOnOpenMPDependClause(OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, ParsedAttributes &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition: Sema.cpp:1192
FileNullability & operator[](FileID file)
Definition: Sema.h:241
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:83
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...
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:11665
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...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2209
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true)
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations, so that repeated attempts to correct an identifier in a given location are ignored if typo correction already failed for it.
Definition: Sema.h:6888
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly...
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
Decl * Entity
The entity that is being instantiated.
Definition: Sema.h:6534
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition: Sema.h:6892
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition: SemaDecl.cpp:53
The arguments included an overloaded function name that could not be resolved to a suitable function...
Definition: Sema.h:6326
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: Sema.h:706
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaStmt.cpp:1675
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:92
bool isAbstractType(SourceLocation Loc, QualType T)
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.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, FullExprArg Second, Decl *SecondVar, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:1607
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition: Sema.cpp:660
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false)
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Definition: ASTMatchers.h:259
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
Definition: SemaOpenMP.cpp:924
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > LateParsedTemplateMapT
Definition: Sema.h:520
PragmaPackKind
Definition: Sema.h:7559
Code completion occurs following one or more template headers within a class.
Definition: Sema.h:8822
This is not an overload because the signature exactly matches an existing declaration.
Definition: Sema.h:2181
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType)
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:28
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
Definition: SemaExpr.cpp:13963
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.
CachedTokens Toks
Definition: Sema.h:9272
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaType.cpp:4992
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
Token - This structure provides full information about a lexed token.
Definition: Token.h:37
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void CodeCompleteCase(Scope *S)
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
Definition: SemaDecl.cpp:14067
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition: Sema.h:8344
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:3524
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
The fixed underlying type of an enumeration.
Definition: Sema.h:5970
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
Definition: SemaDecl.cpp:8585
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3268
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible...
Definition: Sema.h:8554
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
LazyVector< VarDecl *, ExternalSemaSource,&ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition: Sema.h:482
FrontendAction * Action
Definition: Tooling.cpp:195
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
Definition: SemaDecl.cpp:11524
Defines some OpenMP-specific enums and functions.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true)
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
Definition: SemaExpr.cpp:14650
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, AttributeList *Attrs, SourceLocation EqualLoc, Expr *Val)
Definition: SemaDecl.cpp:14093
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition: SemaDecl.cpp:539
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
Definition: SemaDecl.cpp:11317
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:101
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input)
Create a unary operation that may resolve to an overloaded operator.
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
Definition: SemaExprCXX.cpp:82
bool isOpenMPPrivateVar(VarDecl *VD, unsigned Level)
Check if the specified variable is used in 'private' clause.
Definition: SemaOpenMP.cpp:908
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:6419
The type of a non-type template parameter.
Definition: Sema.h:5991
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule, e.g., std.vector.
Definition: ModuleLoader.h:26
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 DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition: SemaExpr.cpp:497
Decl * ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
Definition: SemaDecl.cpp:11850
void PopExpressionEvaluationContext()
Definition: SemaExpr.cpp:12479
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
OverloadKind
C++ Overloading.
Definition: Sema.h:2174
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
void EndOpenMPClause()
End analysis of clauses.
Definition: SemaOpenMP.cpp:935
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator, which is not a function declaration or definition and therefore is not permitted to have default arguments.
SourceRange getExprRange(Expr *E) const
Definition: SemaExpr.cpp:488
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
Definition: SemaDecl.cpp:5664
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
We are checking the validity of a default template argument that has been used when naming a template...
Definition: Sema.h:6518
Code completion occurs where only a type is permitted.
Definition: Sema.h:8839
Describes a module or submodule.
Definition: Basic/Module.h:47
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...
llvm::BumpPtrAllocator BumpAlloc
Definition: Sema.h:919
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures...
Definition: Sema.h:3205
void ActOnAbortSEHFinallyBlock()
Definition: SemaStmt.cpp:3715
void diagnoseMisplacedModuleImport(Module *M, SourceLocation ImportLoc)
Check if module import may be found in the current context, emit error if not.
Definition: SemaDecl.cpp:14645
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
Definition: DeclSpec.h:2246
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition: Sema.h:879
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition: SemaExpr.cpp:201
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors...
Definition: Sema.h:5495
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:102
The type of an exception.
Definition: Sema.h:5994
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
Code completion occurs at top-level or namespace context.
Definition: Sema.h:8805
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Definition: SemaStmt.cpp:3737
ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc, Expr *SubExpr)
Definition: SemaExpr.cpp:14020
SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition: Sema.h:1076
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
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.
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
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.
An allocator used specifically for the purpose of code completion.
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition: Sema.h:6880
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
Represents a C++ using-declaration.
Definition: DeclCXX.h:2858
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition: Sema.h:8837
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)
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
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...
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter, check that it is non-null, and that if it is formed by array-to-pointer decay, the underlying array is sufficiently large.
Definition: SemaExpr.cpp:4818
void adjustMemberFunctionCC(QualType &T, bool IsStatic, 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:5977
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...
void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE, unsigned SpellingListIndex)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
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:11735
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
Definition: SemaExpr.cpp:1331
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
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:3572
BinaryOperatorKind
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:874
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
bool isFunctionConsideredUnavailable(FunctionDecl *FD)
Checks availability of the function depending on the current function context.Inside an unavailable f...
bool isCompleteType(SourceLocation Loc, QualType T)
Definition: Sema.h:1416
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:1080
Look up implicit 'self' parameter of an objective-c method.
Definition: Sema.h:2672
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:432
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
Definition: Sema.h:791
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace...
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
Definition: SemaCUDA.cpp:23
Represents the results of name lookup.
Definition: Sema/Lookup.h:30
static const std::string & getPrintable(const std::string &S)
Definition: Sema.h:1332
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition: SemaExpr.cpp:727
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, SourceRange Range, TypeVisibilityAttr::VisibilityType Vis, unsigned AttrSpellingListIndex)
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
Definition: SemaDecl.cpp:2370
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
Definition: SemaExpr.cpp:324
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition: Sema.h:6855
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
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:5967
MinSizeAttr * mergeMinSizeAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:696
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
Definition: SemaExpr.cpp:11578
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition: Sema.cpp:952
ImplicitExceptionSpecification ComputeInheritingCtorExceptionSpec(CXXConstructorDecl *CD)
Determine what sort of exception specification an inheriting constructor of a class will have...
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition: Sema.h:6550
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=ParsedType(), bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
Definition: SemaDecl.cpp:241
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, bool &DerivedToBase, bool &ObjCConversion, bool &ObjCLifetimeConversion)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition: SemaAttr.cpp:144
A convenient class for passing around template argument information.
Definition: TemplateBase.h:517
void ActOnStartSEHFinallyBlock()
Definition: SemaStmt.cpp:3711
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool AllowAbstractFieldReference
A flag to indicate that we're in a context that permits abstract references to fields.
Definition: Sema.h:756
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
Definition: SemaDecl.cpp:1683
uint32_t Offset
Definition: CacheTokens.cpp:44
void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope)
Introduce the lambda parameters into scope.
Definition: SemaLambda.cpp:475
bool isObjCMethodDecl(Decl *D)
Definition: Sema.h:1748
Ref_Compatible - The two types are reference-compatible and have equivalent qualifiers (cv1 == cv2)...
Definition: Sema.h:8566
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation Loc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:2666
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition: Sema.h:2335
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.
Code completion occurs following one or more template headers.
Definition: Sema.h:8819
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression...
bool isSpecialMemberAccessibleForDeletion(CXXMethodDecl *decl, AccessSpecifier access, QualType objectType)
Is the given special member function accessible for the purposes of deciding whether to define a spec...
The base type of a class type.
Definition: Sema.h:5955
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
Definition: SemaDecl.cpp:9626
Look up all declarations in a scope with the given name, including resolved using declarations...
Definition: Sema.h:2660
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
OriginalCallArg(QualType OriginalParamType, unsigned ArgIdx, QualType OriginalArgType)
Definition: Sema.h:6351
bool CheckUsingShadowDecl(UsingDecl *UD, 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...
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing, variable initialization, and function return values.
Definition: SemaExpr.cpp:7066
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Expr *ArraySize, SourceRange DirectInitRange, Expr *Initializer, bool TypeMayContainAuto=true)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool IsArrow)
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
void CheckFormatString(const StringLiteral *FExpr, const Expr *OrigFormatExpr, ArrayRef< const Expr * > Args, bool HasVAListArg, unsigned format_idx, unsigned firstDataArg, FormatStringType Type, bool inFunctionCall, VariadicCallType CallType, llvm::SmallBitVector &CheckedVarArgs)
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true)
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...
void ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, Expr *Alignment, SourceLocation PragmaLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition: SemaAttr.cpp:190
Code completion occurs within an expression.
Definition: Sema.h:8824
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec...
bool CheckConstexprFunctionDecl(const FunctionDecl *FD)
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:5697
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition: Sema.h:462
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
Definition: SemaDecl.cpp:12723
ObjCContainerKind
Definition: Sema.h:7145
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
We are substituting template argument determined as part of template argument deduction for either a ...
Definition: Sema.h:6509
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
Definition: SemaStmt.cpp:3761
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition: Sema.h:2705
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:135
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition: Sema.h:6610
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
Definition: SemaDecl.cpp:4699
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, AttributeList *AttrList, bool IsInstantiation, bool HasTypenameKeyword, SourceLocation TypenameLoc)
Builds a using declaration.
bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: Sema.h:962
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2486
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
Substitution of the deduced template argument values resulted in an error.
Definition: Sema.h:6308
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
A set of unresolved declarations.
Definition: UnresolvedSet.h:55
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, SourceRange Range, IdentifierInfo *Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, AvailabilityMergeKind AMK, unsigned AttrSpellingListIndex)
Attribute merging methods. Return true if a new attribute was added.
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition: Sema.h:448
void CheckDelegatingCtorCycles()
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal...
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
Definition: SemaStmt.cpp:2641
ImplicitExceptionSpecification ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted destructor of a class will have...
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition: Sema.h:6294
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition: Sema.h:6461
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:8197
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
std::pair< StringRef, QualType > CapturedParamNameType
Definition: Sema.h:3389
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition: Sema.h:2718
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
Definition: SemaStmt.cpp:2585
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...
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...
bool UnifySection(StringRef SectionName, int SectionFlags, DeclaratorDecl *TheDecl)
Definition: SemaAttr.cpp:363
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition: Sema.h:687
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
Definition: SemaAttr.cpp:516
AccessResult
A copy of Sema's enum without AR_delayed.
Definition: SemaAccess.cpp:30
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope...
Definition: SemaExpr.cpp:13392
We are substituting explicit template arguments provided for a function template. ...
Definition: Sema.h:6502
ExprResult ActOnCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition: Sema.cpp:327
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
Definition: SemaDecl.cpp:14692
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:38
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
The type of a data member.
Definition: Sema.h:5961
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
Definition: SemaDecl.cpp:14599
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:187
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:4918
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
Definition: SemaType.cpp:2185
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition: Sema.h:594
bool CanUseDecl(NamedDecl *D)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition: SemaExpr.cpp:52
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
ExprResult ActOnCXXThis(SourceLocation loc)
Decl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
void DiagnoseUnusedDecl(const NamedDecl *ND)
DiagnoseUnusedDecl - Emit warnings about declarations that are not used unless they are marked attr(u...
Definition: SemaDecl.cpp:1551
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:63
void emitAndClearUnusedLocalTypedefWarnings()
Definition: Sema.cpp:644
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2610
void ActOnFinishInlineMethodDef(CXXMethodDecl *D)
Definition: SemaDecl.cpp:10689
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
PragmaMSStructKind
Definition: Sema.h:7566
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1728
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:6673
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
AccessResult
Definition: Sema.h:5430
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:86
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
Definition: SemaDecl.cpp:1842
void CheckCompleteVariableDeclaration(VarDecl *var)
Definition: SemaDecl.cpp:9957
void CheckVariableDeclarationType(VarDecl *NewVD)
Definition: SemaDecl.cpp:6500
Preprocessor & PP
Definition: Sema.h:294
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: Sema.h:703
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition: SemaExpr.cpp:715
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3180
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
Definition: SemaStmt.cpp:3719
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted)
Check that the given template arguments can be be provided to the given template, converting the argu...
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
Definition: SemaStmt.cpp:3726
LambdaCaptureInitKind
Definition: DeclSpec.h:2294
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Definition: SemaExpr.cpp:7432
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition: Sema.h:6891
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
Definition: SemaDecl.cpp:8732
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
Definition: SemaDecl.cpp:11039
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.
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification, including the language and (if present) the '{'.
This represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:3560
Represents an ObjC class declaration.
Definition: DeclObjC.h:853
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition: Sema.h:818
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)
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:5497
Member name lookup, which finds the names of class/struct/union members.
Definition: Sema.h:2644
We are matching the template parameter lists of a template template argument against the template par...
Definition: Sema.h:5865
detail::InMemoryDirectory::const_iterator I
IncompatiblePointer - The assignment is between two pointers types which point to integers which have...
Definition: Sema.h:8340
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Definition: SemaExpr.cpp:2739
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared...
Definition: Sema.h:662
Decl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed...
void PushCompoundScope()
Definition: Sema.cpp:1175
FullExprArg(Sema &actions)
Definition: Sema.h:3227
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
Definition: SemaExpr.cpp:14475
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: Sema.h:724
void addOverloadedOperatorToUnresolvedSet(UnresolvedSetImpl &Functions, DeclAccessPair Operator, QualType T1, QualType T2)
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaStmt.cpp:3386
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3).
Definition: SemaExpr.cpp:13608
bool ExprNeedsCleanups
ExprNeedsCleanups - True if the current evaluation context requires cleanups to be run at its conclus...
Definition: Sema.h:413
OMPClause * ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
llvm::SpecificBumpPtrAllocator< FormatToken > Allocator
Definition: Format.cpp:1358
const LangOptions & LangOpts
Definition: Sema.h:293
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool AllowClassTemplates=false)
Definition: SemaDecl.cpp:555
void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL, bool IncludeCXX11Attributes=true)
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
static NameClassification TypeTemplate(TemplateName Name)
Definition: Sema.h:1553
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:6650
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition: Sema.h:2685
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:588
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition: Sema.h:222
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:53
void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
Definition: Sema.h:6811
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
bool isKnownName(StringRef name)
void ActOnStmtExprError()
Definition: SemaExpr.cpp:11260
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
ParsingClassState PushParsingClass()
Definition: Sema.h:3530
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition: Sema.h:808
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition: Sema.h:463
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: Sema.h:3182
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl)
Code completion occurs within a sequence of declaration specifiers within a function, method, or block.
Definition: Sema.h:8845
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
AvailabilityResult
Captures the result of checking the availability of a declaration.
Definition: DeclBase.h:63
bool MSStructPragmaOn
Definition: Sema.h:321
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
CXXMethodDecl * getMethod() const
Definition: Sema.h:895
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition: Sema.h:5854
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition: Sema.h:6820
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, llvm::InlineAsmIdentifierInfo &Info, SourceLocation AsmLoc)
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
AnnotatingParser & P
Defines the clang::TemplateNameKind enum.
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition: Sema.h:6655
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
void CodeCompleteObjCMethodDecl(Scope *S, bool IsInstanceMethod, ParsedType ReturnType)
CXXSpecialMember
Kinds of C++ special members.
Definition: Sema.h:969
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
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.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Definition: SemaType.cpp:2340
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false)
BuildVariableInstantiation - Used after a new variable has been created.
virtual ~TypeDiagnoser()
Definition: Sema.h:1324
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind)
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
Definition: SemaStmt.cpp:1940
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &Converted)
An error occurred.
Definition: Sema.h:4039
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition: Sema.h:6545
IdentifierInfo * IdentInfo
Definition: Sema.h:3993
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:259
Decl * ActOnEmptyDeclaration(Scope *S, AttributeList *AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression)
void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name)
Make the given externally-produced declaration visible at the top level scope.
Definition: SemaDecl.cpp:1263
Merge availability attributes for an implementation of a protocol requirement.
Definition: Sema.h:2101
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, Optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:866
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition: SemaStmt.cpp:71
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
Definition: CallEvent.h:840
bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee)
Definition: SemaCUDA.cpp:151
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &Converted, CheckTemplateArgumentKind CTAK=CTAK_Specified)
Check that the given template argument corresponds to the given template parameter.
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
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:887
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3041
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit, bool TypeMayContainAuto)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
Definition: SemaDecl.cpp:9194
A functional-style cast.
Definition: Sema.h:8203
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:834
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition: Sema.h:485
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:1525
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: Sema.h:7536
llvm::DenseMap< Selector, GlobalMethods > GlobalMethodPool
Definition: Sema.h:954
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:10435
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
Retains information about a captured region.
Definition: ScopeInfo.h:596
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: Sema.h:3011
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
A RAII object to enter scope of a compound statement.
Definition: Sema.h:3274
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:506
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...
bool inferObjCARCLifetime(ValueDecl *decl)
Definition: SemaDecl.cpp:5352
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:577
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
CastKind
CastKind - The kind of operation required for a conversion.
The return type of classify().
Definition: Expr.h:298
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
Definition: SemaStmt.cpp:3116
ImplicitExceptionSpecification ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted default constructor of a class will have...
NameClassificationKind getKind() const
Definition: Sema.h:1571
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, SourceRange OpRange=SourceRange())
Add overload candidates for overloaded operators that are member functions.
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
Definition: ScopeInfo.h:841
Template argument deduction did not deduce a value for every template parameter.
Definition: Sema.h:6297
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:8092
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition: Sema.h:8330
void PopCompoundScope()
Definition: Sema.cpp:1179
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...
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:9266
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:2430
StmtResult ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:492
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
Definition: SemaDecl.cpp:2664
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
Definition: SemaLambda.cpp:471
bool CheckMessageArgumentTypes(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.
void ActOnFinishOfCompoundStmt()
Definition: SemaStmt.cpp:323
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition: Sema.h:5836
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
DelayedDiagnosticsState ParsingDeclState
Definition: Sema.h:544
bool checkNullabilityTypeSpecifier(QualType &type, NullabilityKind nullability, SourceLocation nullabilityLoc, bool isContextSensitive)
Check whether a nullability type specifier can be added to the given type.
Definition: SemaType.cpp:5554
SourceLocation NameLoc
Definition: Sema.h:7364
const SmallVectorImpl< AnnotatedLine * >::const_iterator End
Captures information about a #pragma weak directive.
Definition: Weak.h:25
StmtResult ActOnAttributedStmt(SourceLocation AttrLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition: SemaStmt.cpp:483
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition: Sema.h:1171
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
SourceManager & SM
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, bool AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, llvm::InlineAsmIdentifierInfo &Info, bool IsUnevaluatedContext)
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition: Sema.h:2716
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:3344
void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:9294
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=false)
Build an Objective-C object pointer type.
Definition: SemaType.cpp:1005
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
Definition: SemaExpr.cpp:5377
OMPClause * ActOnOpenMPMapClause(OpenMPMapClauseKind MapTypeModifier, OpenMPMapClauseKind MapType, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'map' clause.
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition...
Definition: SemaExpr.cpp:13905
int * Depth
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:10843
NameClassification(ParsedType Type)
Definition: Sema.h:1536
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:569
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition: Sema.h:580
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
friend class ASTContext
Definition: Type.h:4012
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3369
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:521
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
Definition: SemaExpr.cpp:5187
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, Scope *CurScope)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed...
Expr - This represents one expression.
Definition: Expr.h:104
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, std::unique_ptr< CorrectionCandidateCallback > CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=None, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
Definition: SemaExpr.cpp:1799
Defines the clang::LangOptions interface.
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false)
Finish template argument deduction for a function template, checking the deduced template arguments f...
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
Definition: SemaOpenMP.cpp:931
LookupNameKind
Describes the kind of name lookup to perform.
Definition: Sema.h:2632
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition: Sema.h:673
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition: Sema.h:570
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:99
DLLImportAttr * mergeDLLImportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
TemplateNameKind getTemplateNameKind() const
Definition: Sema.h:1589
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast...
ImplicitExceptionSpecification ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move constructor of a class will have...
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
Helper class that collects exception specifications for implicitly-declared special member functions...
Definition: Sema.h:4227
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
Definition: SemaLambda.cpp:703
When performing template argument deduction for a function template, there were too many call argumen...
Definition: Sema.h:6317
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition: Sema.h:475
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
StateNode * Previous
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool instance)
Returns instance or factory methods in global method pool for given selector.
Declaration of a template type parameter.
The message is an instance message.
Definition: Sema.h:7420
void CodeCompleteObjCPropertyDefinition(Scope *S)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:437
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition: SemaStmt.cpp:445
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
void addImplicitTypedef(StringRef Name, QualType T)
Definition: Sema.cpp:133
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
This file defines the classes used to store parsed information about declaration-specifiers and decla...
bool isModuleVisible(Module *M)
Definition: Sema.h:1385
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:4189
TypeResult ActOnTypeName(Scope *S, Declarator &D)
Definition: SemaType.cpp:4963
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
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...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4580
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2345
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition: Sema.h:683
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:7051
llvm::SmallSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition: Sema.h:984
SavePendingInstantiationsAndVTableUsesRAII(Sema &S, bool Enabled)
Definition: Sema.h:6910
Code completion occurs within an Objective-C interface, protocol, or category.
Definition: Sema.h:8810
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition: Sema.h:6622
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure...
Definition: SemaDecl.cpp:4379
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared, in the method definition's AST.
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
Definition: SemaExpr.cpp:12273
IncompatibleVectors - The assignment is between two vector types that have the same size...
Definition: Sema.h:8359
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition: Sema.h:656
void completeExprArrayBound(Expr *E)
Definition: SemaType.cpp:6420
bool isInitListConstructor(const CXXConstructorDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init.list]p2.
void CodeCompleteObjCAtVisibility(Scope *S)
#pragma vtordisp()
Definition: Sema.h:331
OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:33
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, AttributeList *Attrs=nullptr)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
void CheckAlignasUnderalignment(Decl *D)
void PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, const BlockExpr *blkExpr=nullptr)
Definition: Sema.cpp:1159
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:386
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...
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition: Sema.h:4273
SourceLocation LocStart
Definition: Sema.h:3990
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition: SemaCast.cpp:236
Initial building of a for-range statement.
Definition: Sema.h:3353
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:12029
When performing template argument deduction for a function template, there were too few call argument...
Definition: Sema.h:6320
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member, and after instantiating an in-class initializer in a class template.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:65
FormatToken * Token
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition: Sema.h:8349
void NoteAllFoundTemplates(TemplateName Name)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Definition: SemaExpr.cpp:14543
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition: Sema.h:8558
Represents a C++ template name within the type system.
Definition: TemplateName.h:175
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given function template specialization.
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:5259
void CodeCompletePreprocessorExpression()
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: Sema.h:709
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition: Sema.h:8551
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, bool Mutable)
Endow the lambda scope info with the relevant properties.
Definition: SemaLambda.cpp:436
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Definition: SemaType.cpp:6518
Block expression,.
Definition: Sema.h:6009
llvm::DenseMap< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition: Sema.h:942
Defines the clang::TypeLoc interface and its subclasses.
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:12926
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition: Sema.h:1388
void DiscardCleanupsInEvaluationContext()
Definition: SemaExpr.cpp:12537
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition: Sema.h:8827
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
bool isSameOrCompatibleFunctionType(CanQualType Param, CanQualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment...
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition: SemaAttr.cpp:446
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: Sema.h:6541
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...
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, Decl *CondVar)
Definition: SemaStmt.cpp:583
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:13043
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase, unsigned AttrSpellingListIndex, MSInheritanceAttr::Spelling SemanticSpelling)
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
Definition: TemplateKinds.h:21
ASTMutationListener * getASTMutationListener() const
Definition: Sema.cpp:318
CXXMethodDecl * startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, ArrayRef< ParmVarDecl * > Params)
Start the definition of a lambda expression.
Definition: SemaLambda.cpp:354
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition: Sema.h:7061
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition: Sema.h:5252
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:3289
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
StorageClass
Storage classes.
Definition: Specifiers.h:198
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...
Decl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc)
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void CheckCompletedCXXClass(CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
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:9224
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition: Sema.h:434
void AdjustDestructorExceptionSpec(CXXRecordDecl *ClassDecl, CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
llvm::SmallPtrSet< CXXRecordDecl *, 16 > AssociatedClassSet
Definition: Sema.h:2387
InClassInitStyle
In-class initialization styles for non-static data members.
Definition: Specifiers.h:221
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, 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.
Partial specialization.
Definition: Sema.h:5997
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add all of the function declarations in the given function set to the overload candidate set...
NameClassification(ExprResult Expr)
Definition: Sema.h:1534
void ActOnPragmaDetectMismatch(StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:291
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition: SemaStmt.cpp:66
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:860
A mapping from file IDs to a record of whether we've seen nullability information in that file...
Definition: Sema.h:230
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition: Template.h:42
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
TypeSourceInfo * GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, TypeSourceInfo *ReturnTypeInfo)
Create and instantiate a TypeSourceInfo with type source information.
Definition: SemaType.cpp:4897
bool isExternallyVisible() const
Definition: Decl.h:280
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
Definition: Sema.h:6601
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
Definition: SemaType.cpp:6818
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:11534
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1425
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
DiagnosticsEngine & getDiagnostics() const
Definition: Sema.h:1045
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
Definition: SemaExprCXX.cpp:48
CXXRecordDecl * getStdBadAlloc() const
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: Sema.h:733
OMPClause * ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
void CleanupVarDeclMarking()
Definition: SemaExpr.cpp:13467
DeclContext * getContainingDC(DeclContext *DC)
Definition: SemaDecl.cpp:1033
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:3988
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool isRelational)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
Definition: SemaExpr.cpp:9204
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1203
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:499
Wraps an identifier and optional source location for the identifier.
Definition: AttributeList.h:50
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident, unsigned AttrSpellingListIndex)
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization)
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
The symbol exists.
Definition: Sema.h:4029
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
Definition: Sema.h:6311
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2392
sema::LambdaScopeInfo * PushLambdaScope()
Definition: Sema.cpp:1144
The result type of a method or function.
llvm::FoldingSet< SpecialMemberOverloadResult > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition: Sema.h:904
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
StmtResult ProcessStmtAttributes(Stmt *Stmt, AttributeList *Attrs, SourceRange Range)
Stmt attributes - this routine is the top level dispatcher.
bool ParentNeedsCleanups
Whether the enclosing context needed a cleanup.
Definition: Sema.h:801
Code completion occurs within the list of instance variables in an Objective-C interface, protocol, category, or implementation.
Definition: Sema.h:8816
void CodeCompleteNamespaceDecl(Scope *S)
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
Definition: SemaType.cpp:6478
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
Definition: SemaExpr.cpp:5391
OpenMPProcBindClauseKind
OpenMP attributes for 'proc_bind' clause.
Definition: OpenMPKinds.h:50
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind...
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition: DeclObjC.h:514
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion...
unsigned size() const
The number of exceptions in the exception specification.
Definition: Sema.h:4260
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition: TokenKinds.h:41
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
void CodeCompleteInitializer(Scope *S, Decl *D)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:228
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition: Sema.h:219
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition: Sema.h:922
OMPClause * ActOnOpenMPDeviceClause(Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition: Sema.h:2177
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, bool ParentNeedsCleanups, Decl *ManglingContextDecl, bool IsDecltype)
Definition: Sema.h:840
void CodeCompleteObjCPropertySetter(Scope *S)
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
Definition: SemaType.cpp:4455
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
ExprResult ActOnFinishFullExpr(Expr *Expr)
Definition: Sema.h:4784
bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body)
Check the body for the given constexpr function declaration only contains the permitted types of stat...
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool *NonStandardCompositeType=nullptr)
Find a merged pointer type and convert the two expressions to it.
An abstract interface that should be implemented by external AST sources that also provide informatio...
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, bool IsAddressOfOperand, std::unique_ptr< 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:731
void * PackContext
PackContext - Manages the stack for #pragma pack.
Definition: Sema.h:319
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, llvm::function_ref< ExprResult(Expr *)> Filter)
Definition: Sema.h:2890
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void CodeCompleteObjCAtExpression(Scope *S)
static StringRef getPrintable(StringRef S)
Definition: Sema.h:1331
BuildForRangeKind
Definition: Sema.h:3351
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
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:501
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
Definition: SemaCast.cpp:2463
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
Definition: SemaExpr.cpp:3454
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:5689
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
A declaration qualifier.
Definition: Sema.h:5982
FieldDecl * buildInitCaptureField(sema::LambdaScopeInfo *LSI, VarDecl *Var)
Build the implicit field for an init-capture.
Definition: SemaLambda.cpp:787
void CodeCompleteTypeQualifiers(DeclSpec &DS)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition: Sema.h:9145
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:10749
const QualType * data() const
The set of exceptions in the exception specification.
Definition: Sema.h:4263
Decl * ActOnSkippedFunctionBody(Decl *Decl)
Definition: SemaDecl.cpp:11031
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
LazyVector< TypedefNameDecl *, ExternalSemaSource,&ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition: Sema.h:438
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:11332
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:492
bool hasVisibleDefinition(const NamedDecl *D)
Definition: Sema.h:1397
void ActOnStartOfCompoundStmt()
Definition: SemaStmt.cpp:319
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition: Sema.h:225
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:394
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition: Sema.cpp:1139
CanThrowResult
Possible results from evaluation of a noexcept expression.
static unsigned getPrintable(unsigned I)
Definition: Sema.h:1328
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition: Sema.h:1512
ParsedType getDestructorType(const DeclSpec &DS, ParsedType ObjectType)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
std::vector< NamedDecl * > DeclsInPrototypeScope
List of decls defined in a function prototype.
Definition: Sema.h:1478
void CodeCompleteObjCAtDirective(Scope *S)
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
Definition: SemaDecl.cpp:10640
ARCConversionResult
Definition: Sema.h:8612
#define false
Definition: stdbool.h:33
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor...
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition: Sema.h:2639
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition: Sema.h:694
Kind
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2402
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:375
PragmaSectionKind
Definition: Sema.h:7606
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Sema::ReuseLambdaContextDecl_t, bool IsDecltype=false)
Definition: Sema.h:9250
bool CheckCaseExpression(Expr *E)
Definition: SemaExpr.cpp:14640
bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, DeclarationName Name, MultiExprArg Args, DeclContext *Ctx, bool AllowMissing, FunctionDecl *&Operator, bool Diagnose=true)
Find an fitting overload for the allocation function in the specified scope.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Definition: Ownership.h:145
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3053
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
LookupInObjCMethod - The parser has read a name in, and Sema has detected that we're currently inside...
Definition: SemaExpr.cpp:2368
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4692
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:51
Represents the parsed form of a C++ template argument.
A stack object to be created when performing template instantiation.
Definition: Sema.h:6687
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition: SemaStmt.cpp:437
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition: Sema.h:9130
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
The template argument was deduced from an array bound via template argument deduction.
Definition: Sema.h:5773
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:14334
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
Definition: SemaExpr.cpp:1357
This is not an overload because the lookup results contain a non-function.
Definition: Sema.h:2185
DeduceAutoResult
Result type of DeduceAutoType.
Definition: Sema.h:6407
Encodes a location in the source.
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
Definition: SemaExpr.cpp:5172
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
llvm::SmallPtrSet< Expr *, 2 > MaybeODRUseExprs
Store a list of either DeclRefExprs or MemberExprs that contain a reference to a variable (constant) ...
Definition: Sema.h:426
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: SemaAttr.cpp:329
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
Definition: SemaDecl.cpp:8752
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:75
Defines enumerations for expression traits intrinsics.
SourceLocation CurrentPragmaLocation
Definition: Sema.h:381
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
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...
llvm::SmallPtrSet< Expr *, 2 > SavedMaybeODRUseExprs
Definition: Sema.h:814
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
Definition: SemaExpr.cpp:5482
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition: SemaExpr.cpp:840
static const char * getPrintable(const char *S)
Definition: Sema.h:1330
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle...
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
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:1171
bool IsNoReturnConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noreturn"...
void ActOnPragmaMSVtorDisp(PragmaVtorDispKind Kind, SourceLocation PragmaLoc, MSVtorDispAttr::Mode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:303
DLLExportAttr * mergeDLLExportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
Definition: SemaExpr.cpp:11976
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
Definition: SemaDecl.cpp:10142
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function...
Definition: SemaDecl.cpp:11427
static SourceRange getPrintable(const Expr *E)
Definition: Sema.h:1340
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
Definition: SemaDecl.cpp:14780
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
Definition: SemaStmt.cpp:3097
void InstantiateStaticDataMemberDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given variable from its template.
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D)
IdentifyCUDATarget - Determine the CUDA compilation target for this function.
Definition: SemaCUDA.cpp:41
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition: SemaStmt.cpp:460
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition: Sema.h:6305
void ExitDeclaratorContext(Scope *S)
Definition: SemaDecl.cpp:1133
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2644
bool IsSimplyAccessible(NamedDecl *decl, DeclContext *Ctx)
Checks access to Decl from the given class.
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc)
Build the type that describes a C++ typename specifier, e.g., "typename T::type". ...
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:1661
ASTContext & getASTContext() const
Definition: Sema.h:1048
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation)
Definition: Sema.h:367
CommonAttr * mergeCommonAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident, unsigned AttrSpellingListIndex)
OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:23
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition: Sema.cpp:297
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:355
IncompatiblePointer - The assignment is between two pointers types that are not compatible, but we accept them as an extension.
Definition: Sema.h:8334
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
AvailabilityDiagnostic
Definition: Sema.h:3539
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3059
DelayedDiagnosticsState ProcessingContextState
Definition: Sema.h:545
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method, and set any properties that should be inherited.
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition: Sema.h:823
void CodeCompleteReturn(Scope *S)
bool hasVisibleMergedDefinition(NamedDecl *Def)
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:116
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>. ...
Definition: Sema.h:691
ObjCSpecialMethodKind
Definition: Sema.h:7353
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1701
StmtResult ActOnCapturedRegionEnd(Stmt *S)
Definition: SemaStmt.cpp:3909
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition: Sema.h:561
QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit)
Adds a conversion function template specialization candidate to the overload set, using template argu...
ExprResult TransformToPotentiallyEvaluated(Expr *E)
Definition: SemaExpr.cpp:12449
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
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:10995
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: Sema.h:9184
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
Definition: SemaType.cpp:6540
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *&RetExpr, AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec.auto]p6.
Definition: SemaStmt.cpp:3006
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}_cast's.
Definition: SemaCast.cpp:213
ExprResult DefaultLvalueConversion(Expr *E)
Definition: SemaExpr.cpp:618
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void CodeCompleteOperatorName(Scope *S)
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
Definition: SemaStmt.cpp:3360
void CodeCompletePreprocessorDirective(bool InConditional)
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T)
Retrieve a version of the type 'T' that is elaborated by Keyword and qualified by the nested-name-spe...
Definition: SemaType.cpp:6900
void DiagnoseUseOfUnimplementedSelectors()
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition: Sema.h:466
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition: Sema.h:6827
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
The declaration was invalid; do nothing.
Definition: Sema.h:6291
Ref_Compatible_With_Added_Qualification - The two types are reference-compatible with added qualifica...
Definition: Sema.h:8563
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: SemaStmt.cpp:3697
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
ASTConsumer & getASTConsumer() const
Definition: Sema.h:1049
static DeclarationName getPrintable(DeclarationName N)
Definition: Sema.h:1336
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:1931
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:32
OMPClause * ActOnOpenMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
The message is sent to 'super'.
Definition: Sema.h:7418
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:3188
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:5441
Represents a canonical, potentially-qualified type.
Definition: CanonicalType.h:52
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, 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...
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition: Sema.h:301
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).
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition: TokenKinds.h:25
Decl * ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:5512
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
Definition: SemaAccess.cpp:39
A friend declaration.
Definition: Sema.h:5979
AbstractDiagSelID
Definition: Sema.h:5497
Look up any declaration with any name.
Definition: Sema.h:2674
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
Definition: SemaExpr.cpp:7380
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition: Sema.cpp:966
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
Definition: SemaType.cpp:1654
bool Matches
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...
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition: Sema.h:403
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition: SemaStmt.cpp:729
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
Represents a C++11 virt-specifier-seq.
Definition: DeclSpec.h:2254
bool FormatStringHasSArg(const StringLiteral *FExpr)
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition: Sema.h:304
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition: Sema.h:812
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:2416
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition: Sema.h:530
OpaquePtr< TemplateName > TemplateTy
Definition: Sema.h:287
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool isRelational)
Definition: SemaExpr.cpp:8786
void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD, const FunctionProtoType *T)
Check whether the exception specification provided for an explicitly-defaulted special member matches...
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
llvm::SmallPtrSet< DeclContext *, 16 > AssociatedNamespaceSet
Definition: Sema.h:2386
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.
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.
MangleNumberingContext * getCurrentMangleNumberContext(const DeclContext *DC, Decl *&ManglingContextDecl)
Compute the mangling number context for a lambda expression or block literal.
Definition: SemaLambda.cpp:278
A default argument.
Definition: Sema.h:5988
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLoc, Expr *Length, SourceLocation RBLoc)
Definition: SemaExpr.cpp:4128
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition: Sema.h:446
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...
static NameClassification FunctionTemplate(TemplateName Name)
Definition: Sema.h:1565
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.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
Definition: SemaType.cpp:1889
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
The name is a dependent name, so the results will differ from one instantiation to the next...
Definition: Sema.h:4036
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions...
Definition: SemaDecl.cpp:13408
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition: Sema.h:409
sema::FunctionScopeInfo * getCurFunction() const
Definition: Sema.h:1167
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition: Sema.cpp:1517
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Definition: Overload.h:700
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
Definition: SemaDecl.cpp:13442
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaStmt.cpp:3440
Constant expression in a noptr-new-declarator.
Definition: Sema.h:2274
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
Definition: SemaExpr.cpp:12545
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass)
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition: Sema.h:925
TentativeAnalysisScope(Sema &SemaRef)
Definition: Sema.h:6861
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const
void CodeCompletePreprocessorMacroName(bool IsDefinition)
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over.call.object]), which can end up invoking an overloaded function call operator (operator()) or performing a user-defined conversion on the object argument.
__SIZE_TYPE__ size_t
Definition: stddef.h:62
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
Definition: SemaExpr.cpp:11269
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:193
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition: Sema.h:640
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList)
friend bool operator!=(const ActiveTemplateInstantiation &X, const ActiveTemplateInstantiation &Y)
Definition: Sema.h:6588
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: Sema.h:712
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
getSpecialMember - get the special member enum for a method.
Definition: SemaDecl.cpp:2525
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:14457
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, unsigned NumCallArguments2)
Returns the more specialized function template according to the rules of function template partial or...
Defines various enumerations that describe declaration and type specifiers.
A POD class for pairing a NamedDecl* with an access specifier.
The expression in a static assertion.
Definition: Sema.h:5967
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists), where Base is an expression of class type and Member is the name of the member we're trying to find.
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
Definition: SemaExpr.cpp:5467
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<U>...
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId)
Called on well-formed 'reduction' clause.
Expression in a case label.
Definition: Sema.h:2271
ReuseLambdaContextDecl_t
Definition: Sema.h:3569
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization, which was named as part of an explicit instantiation.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
A class for storing results from argument-dependent lookup.
Definition: Sema/Lookup.h:726
OpaquePtr< QualType > TypeTy
Definition: Sema.h:288
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery...
Definition: SemaDecl.cpp:14737
Decl * 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.g.
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
Definition: SemaExpr.cpp:13657
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2526
Abstract interface for a consumer of code-completion information.
sema::LambdaScopeInfo * getCurLambda()
Retrieve the current lambda scope info, if any.
Definition: Sema.cpp:1207
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
Definition: TemplateBase.h:40
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
Definition: SemaDecl.cpp:1147
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
Definition: SemaInit.cpp:7667
ParserCompletionContext
Describes the context in which code completion occurs.
Definition: Sema.h:8803
ParsedType ActOnDelayedDefaultTemplateArg(const IdentifierInfo &II, SourceLocation NameLoc)
For compatibility with MSVC, we delay parsing of some default template type arguments until instantia...
Definition: SemaDecl.cpp:474
ObjCDeclSpec DeclSpec
Definition: Sema.h:7368
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
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:1740
TagTypeKind
The kind of a tag type.
Definition: Type.h:4174
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool *NonStandardCompositeType=nullptr)
Definition: Sema.h:8509
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:66
bool ActOnCXXNestedNameSpecifier(Scope *S, IdentifierInfo &Identifier, SourceLocation IdentifierLoc, SourceLocation CCLoc, ParsedType ObjectType, bool EnteringContext, CXXScopeSpec &SS, bool ErrorRecoveryLookup=false, bool *IsCorrectedToColon=nullptr)
The parser has parsed a nested-name-specifier 'identifier::'.
bool checkStringLiteralArgumentAttr(const AttributeList &Attr, unsigned ArgNum, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument ArgNum of Attr is a ASCII string literal.
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition: Sema.h:2283
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
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...
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration...
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition: Sema.h:6883
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition: Sema.h:527
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:838
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:3458
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition: Sema.h:359
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:6644
bool SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams=nullptr)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
Don't merge availability attributes at all.
Definition: Sema.h:2092
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
Definition: SemaDecl.cpp:10516
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
ObjCContainerKind getObjCContainerKind() const
void recordUseOfEvaluatedWeak(const ExprT *E, bool IsRead=true)
Definition: Sema.h:1184
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, IdentifierInfo &Identifier, SourceLocation IdentifierLoc, SourceLocation ColonLoc, ParsedType ObjectType, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1121
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: Sema.h:715
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
Definition: SemaExpr.cpp:11219
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:1927
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl...
Definition: SemaAttr.cpp:115
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2226
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:331
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
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:1104
A template instantiation that is currently in progress.
Definition: Sema.h:6481
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
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:616
QualType GetSignedVectorType(QualType V)
Definition: SemaExpr.cpp:9184
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W)
DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak applied to it...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchers.h:1723
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition: Sema.cpp:369
void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, SourceLocation RBraceLoc, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, AttributeList *Attr)
Definition: SemaDecl.cpp:14363
void ActOnCapturedRegionError()
Definition: SemaStmt.cpp:3893
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
void ProcessPragmaWeak(Scope *S, Decl *D)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1446
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceLocation RBraceLoc)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
Definition: SemaDecl.cpp:12770
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, SourceLocation Loc)
DeclClonePragmaWeak - clone existing decl (maybe definition), #pragma weak needs a non-definition dec...
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:311
ImplicitExceptionSpecification ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defautled copy assignment operator of a class will h...
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
Definition: SemaExpr.cpp:8638
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool EnumUnderlyingIsImplicit, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
Definition: SemaDecl.cpp:11600
void CodeCompleteTag(Scope *S, unsigned TagSpec)
bool BuildCXXNestedNameSpecifier(Scope *S, IdentifierInfo &Identifier, SourceLocation IdentifierLoc, SourceLocation CCLoc, QualType ObjectType, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2437
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition: Sema.cpp:1150
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types...
StmtResult ActOnExprStmtError()
Definition: SemaStmt.cpp:61
Decl * 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, AttributeList *AttrList)
void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
Definition: SemaDecl.cpp:14719
static NameClassification VarTemplate(TemplateName Name)
Definition: Sema.h:1559
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceAttr::Spelling SemanticSpelling)
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
Definition: SemaExpr.cpp:5151
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Definition: SemaExpr.cpp:13836
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
void makeMergedDefinitionVisible(NamedDecl *ND, SourceLocation Loc)
Make a merged definition of an existing hidden definition ND visible at the specified location...
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition: Sema.h:7056
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
Definition: SemaCast.cpp:1660
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
Definition: SemaType.cpp:1854
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Definition: Sema.h:9242
SectionAttr * mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name, unsigned AttrSpellingListIndex)
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition: Sema.h:6882
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
A non-depnedent component of the parameter did not match the corresponding component of the argument...
Definition: Sema.h:6314
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared...
Definition: Sema.h:752
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
Definition: SemaStmt.cpp:2594
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
Definition: SemaExpr.cpp:3547
DeclarationName - The name of a declaration.
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.
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
ImplicitExceptionSpecification ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted copy constructor of a class will have...
Label name lookup.
Definition: Sema.h:2641
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
Definition: SemaDecl.cpp:3616
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:1459
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1069
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:5248
ExpressionEvaluationContext Context
The expression evaluation context.
Definition: Sema.h:798
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
Definition: SemaExpr.cpp:5744
bool IsOpenMPCapturedByRef(VarDecl *VD, const sema::CapturedRegionScopeInfo *RSI)
Return true if the provided declaration VD should be captured by reference in the provided scope RSI...
Definition: SemaOpenMP.cpp:775
EnumDecl - Represents an enum.
Definition: Decl.h:2930
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition: Sema.h:8367
VisibilityAttr * mergeVisibilityAttr(Decl *D, SourceRange Range, VisibilityAttr::VisibilityType Vis, unsigned AttrSpellingListIndex)
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition: Sema.h:2701
StmtResult ActOnOpenMPTaskgroupDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
detail::InMemoryDirectory::const_iterator E
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From, which has the (possibly adjusted) type FromType, can be converted to the type ToType via a member pointer conversion (C++ 4.11).
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
Definition: SemaCast.cpp:2486
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const
Determine whether the token kind starts a simple-type-specifier.
Definition: SemaDecl.cpp:94
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:138
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition: SemaStmt.cpp:327
IdentifierResolver IdResolver
Definition: Sema.h:675
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition: Sema.cpp:410
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
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 .
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
Definition: SemaDecl.cpp:12733
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
Definition: SemaExpr.cpp:3043
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
Definition: SemaDecl.cpp:10574
Abstract interface for a module loader.
Definition: ModuleLoader.h:56
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in...
Definition: Sema.cpp:959
The name refers to a template whose specialization produces a type.
Definition: TemplateKinds.h:30
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
StringRef Typo
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
ExprResult ActOnConstantExpression(ExprResult Res)
Definition: SemaExpr.cpp:13453
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition: Sema.h:609
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given function from its template.
#pragma vtordisp(push, mode)
Definition: Sema.h:328
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
void CodeCompleteNamespaceAliasDecl(Scope *S)
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Definition: Sema.h:464
A dependently-generated diagnostic.
void ActOnPragmaMSComment(PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:272
ExprResult checkPseudoObjectRValue(Expr *E)
void CodeCompleteUsingDirective(Scope *S)
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.
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored, perform any conversions that are required.
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, QualType T1, QualType T2, UnresolvedSetImpl &Functions)
PragmaMsStackAction
Definition: Sema.h:334
Represents a pointer to an Objective C object.
Definition: Type.h:4821
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated", "unavailable", and "availability").
Definition: Sema.h:2090
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
Definition: SemaDecl.cpp:5176
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition: Sema.h:524
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:127
bool IsOpenMPCapturedVar(VarDecl *VD)
Check if the specified variable is used in one of the private clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP constructs.
Definition: SemaOpenMP.cpp:863
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:34
OnOffSwitch
Defines the possible values of an on-off-switch (C99 6.10.6p2).
Definition: TokenKinds.h:49
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures...
Definition: Sema.h:3197
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaType.cpp:3030
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:1039
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
Definition: SemaStmt.cpp:3749
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
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...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2220
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement...
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:3957
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, AttributeList *AttrList, UsingDirectiveDecl *&UsingDecl)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
void DiagnoseUnusedParameters(ParmVarDecl *const *Begin, ParmVarDecl *const *End)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
Definition: SemaDecl.cpp:10529
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal, SourceLocation DotDotDotLoc, Expr *RHSVal, SourceLocation ColonLoc)
Definition: SemaStmt.cpp:375
ExprResult getExpression() const
Definition: Sema.h:1578
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx)
ExprResult CheckCXXBooleanCondition(Expr *CondExpr)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
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...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3544
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition: Sema.h:315
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:421
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, Scope *CurScope)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
Definition: SemaLambda.cpp:802
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:296
SourceManager & getSourceManager() const
Definition: Sema.h:1046
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
The lookup is a reference to this name that is not for the purpose of redeclaring the name...
Definition: Sema.h:2682
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
Definition: SemaDecl.cpp:12814
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition: Sema.h:5765
ExprResult BuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
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...
ExternalSemaSource * getExternalSource() const
Definition: Sema.h:1051
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2049
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
Definition: Sema.h:1853
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition: Sema.h:5762
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
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:92
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:4584
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
ObjCLiteralKind
Definition: Sema.h:2368
ValueType CurrentValue
Definition: Sema.h:380
LocalInstantiationScope * Scope
Definition: Sema.h:7053
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const AttributeList *AttrList)
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition: Sema.h:8363
Represents a C++ base or member initializer.
Definition: DeclCXX.h:1885
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Definition: SemaExpr.cpp:12460
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure...
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:2285
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...
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
Definition: SemaExpr.cpp:5777
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
void CodeCompleteObjCSelector(Scope *S, ArrayRef< IdentifierInfo * > SelIdents)
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false)
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S'...
Definition: SemaDecl.cpp:1268
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression...
FunctionDecl * getCurFunctionDecl()
getCurFunctionDecl - If inside of a function body, this returns a pointer to the function decl for th...
Definition: Sema.cpp:947
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
Definition: SemaDecl.cpp:13896
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
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:1273
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
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...
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, bool NeedDefinition, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
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.
QualType BuildPipeType(QualType T, SourceLocation Loc)
Build a Pipe type.
Definition: SemaType.cpp:1946
void * OpaqueParser
Definition: Sema.h:528
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition: Sema.h:934
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsExplicitSpecialization, bool &Invalid)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:58
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
Definition: SemaType.cpp:7000
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
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.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition: Sema.h:860
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
Checks access to an overloaded member operator, including conversion operators.
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:10272
void CodeCompleteObjCAtStatement(Scope *S)
void CheckShadow(Scope *S, VarDecl *D, const LookupResult &R)
Diagnose variable or built-in function shadowing.
Definition: SemaDecl.cpp:6299
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:14755
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
Definition: SemaExpr.cpp:10954
static NameClassification Error()
Definition: Sema.h:1541
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, AttributeList *Attr)
TemplateName getTemplateName() const
Definition: Sema.h:1583
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
void ActOnCXXForRangeDecl(Decl *D)
Definition: SemaDecl.cpp:9888
OpenMPDefaultClauseKind
OpenMP attributes for 'default' clause.
Definition: OpenMPKinds.h:42
friend class ArgumentPackSubstitutionRAII
Definition: Sema.h:6665
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:4116
Deduction failed; that's all we know.
Definition: Sema.h:6328
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Definition: Sema.h:2883
static NameClassification Unknown()
Definition: Sema.h:1545
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: Sema.h:730
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed '#pragma omp threadprivate'.
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs, SourceLocation AttrEnd)
Definition: SemaDecl.cpp:9927
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
SmallVector< BlockDecl *, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition: Sema.h:418
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Definition: APValue.h:38
DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc, ModuleIdPath Path)
The parser has processed a module import declaration.
Definition: SemaDecl.cpp:14649
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
static SourceRange getPrintable(SourceLocation L)
Definition: Sema.h:1339
Represents a base class of a C++ class.
Definition: DeclCXX.h:157
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
Definition: SemaExpr.cpp:11515
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Definition: SemaType.cpp:2354
void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:387
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void DiagnoseSentinelCalls(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:396
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3055
ProcessingContextState ParsingClassState
Definition: Sema.h:3529
void * SkippedDefinitionContext
Definition: Sema.h:1966
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:7559
The type-property cache.
Definition: Type.cpp:3238
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, std::unique_ptr< CorrectionCandidateCallback > CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
Definition: SemaExpr.cpp:2046
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
Definition: SemaDecl.cpp:4781
Describes whether we've seen any nullability information for the given file.
Definition: Sema.h:216
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...
QualType QIDNSCopying
id<NSCopying> type.
Definition: Sema.h:742
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
An implicit conversion.
Definition: Sema.h:8199
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
void ActOnTranslationUnitScope(Scope *S)
Definition: Sema.cpp:68
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition: Sema.cpp:1108
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e...
Definition: SemaDecl.cpp:3599
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Definition: SemaDecl.cpp:1634
A template argument list.
Definition: DeclTemplate.h:172
bool CheckRegparmAttr(const AttributeList &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
Merge availability attributes for a redeclaration, which requires an exact match. ...
Definition: Sema.h:2095
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:2344
const DeclContext * getCurObjCLexicalContext() const
Definition: Sema.h:9214
bool CheckParamExceptionSpec(const PartialDiagnostic &NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:11761
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
Definition: Type.h:3057
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:9101
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute...
Definition: SemaAttr.cpp:579
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
Definition: SemaExpr.cpp:3878
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
Definition: ASTMatchers.h:1695
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:3598
CCEKind
Contexts in which a converted constant expression is required.
Definition: Sema.h:2270
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition: SemaExpr.cpp:933
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: Sema.h:286
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups, surround it with a ExprWithCleanups node.
ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
Definition: SemaExpr.cpp:1665
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const VarDecl *NRVOCandidate, QualType ResultType, Expr *Value, bool AllowNRVO=true)
Perform the initialization of a potentially-movable value, which is the result of return value...
Definition: SemaStmt.cpp:2738
TemplateNameKind ActOnDependentTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template)
Form a dependent template name.
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their argum...
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body, and it is located on the same line.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2297
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
ExprResult CorrectDelayedTyposInExpr(Expr *E, llvm::function_ref< ExprResult(Expr *)> Filter)
Definition: Sema.h:2877
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation, for substitutions of prior template arguments.
Definition: Sema.h:6531
Data structure used to record current or nested expression evaluation contexts.
Definition: Sema.h:796
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:398
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Captures information about "declaration specifiers".
Definition: DeclSpec.h:228
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition: Sema.h:8830
void LateTemplateParserCleanupCB(void *P)
Definition: Sema.h:525
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D...
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes...
Definition: SemaStmt.cpp:2818
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, SourceLocation IdLoc, IdentifierInfo &II, ParsedType ObjectType)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
Compatible - the types are compatible according to the standard.
Definition: Sema.h:8318
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation())
Definition: SemaType.cpp:2475
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
Decl * D
The template function declaration to be late parsed.
Definition: Sema.h:9274
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:3380
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
CUDAFunctionTarget
Definition: Sema.h:8742
ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth, bool *ZeroWidth=nullptr)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width...
Definition: SemaDecl.cpp:12833
StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
Look up a friend of a local class.
Definition: Sema.h:2668
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 CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD)
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
Definition: Sema.h:776
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void PopParsingClass(ParsingClassState state)
Definition: Sema.h:3533
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, DeclarationName Name)
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:91
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...
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter, but we can't parse it yet because we're inside a class definition.
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1609
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition: Sema.h:325
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, 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...
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs)
Find the instantiation of the given declaration within the current instantiation. ...
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
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:5716
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
TryCaptureKind
Definition: Sema.h:3598
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...
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
Definition: SemaExpr.cpp:13384
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: Sema.h:745
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:114
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, QualType Param1, QualType Param2=QualType(), bool addRestrictAttr=false)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
Definition: SemaExpr.cpp:7787
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.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads, Expr *MinBlocks, unsigned SpellingListIndex)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration. ...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition: Sema.h:307
bool CheckParmsForFunctionDef(ParmVarDecl *const *Param, ParmVarDecl *const *ParamEnd, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition: SemaExpr.cpp:301
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:178
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
Definition: SemaDecl.cpp:1590
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:615
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< 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...
The enumerator value.
Definition: Sema.h:5973
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:84
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
Definition: SemaType.cpp:3009
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, AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant, according to C++ [class.virtual]p5.
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition: Sema.cpp:1304
const StringRef Input
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition: Sema.h:917
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all...
Definition: Sema.h:760
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 BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1452
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2134
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
Definition: SemaExpr.cpp:7614
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
Definition: SemaStmt.cpp:2567
void UpdateMarkingForLValueToRValue(Expr *E)
Definition: SemaExpr.cpp:13428
Represents a complete lambda introducer.
Definition: DeclSpec.h:2302
a linked list of methods with the same selector name but different signatures.
AvailabilityResult getCurContextAvailability() const
Definition: SemaDecl.cpp:14817
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
Definition: Sema.h:953
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
The translation unit is a complete translation unit.
Definition: LangOptions.h:180
QualType getMessageSendResultType(QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver, the method expected to receive the message, and the form of the message send.
void DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl *const *Begin, ParmVarDecl *const *End, 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:10545
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Definition: SemaExpr.cpp:2514
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
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)
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.
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
Definition: SemaStmt.cpp:3404
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E)
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type...
A using declaration.
Definition: Sema.h:5976
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
void PrintStats() const
Print out statistics about the semantic analysis.
Definition: Sema.cpp:344
void ActOnComment(SourceRange Comment)
Definition: Sema.cpp:1232
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
Designation - Represent a full designation, which is a sequence of designators.
Definition: Designator.h:181
void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization)
static OpaquePtr make(QualTypeP)
Definition: Ownership.h:54
FPOptions FPFeatures
Definition: Sema.h:291
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition: Sema.h:3252
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
Definition: SemaAttr.cpp:550
The name refers to a variable template whose specialization produces a variable.
Definition: TemplateKinds.h:33
ImplicitExceptionSpecification ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move assignment operator of a class will h...
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:922
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
static SourceRange getPrintable(SourceRange R)
Definition: Sema.h:1338
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition: Sema.h:8833
Lambda expression.
Definition: Sema.h:6006
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
Definition: SemaExpr.cpp:11859
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
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...
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any...
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable...
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
Definition: Sema.h:766
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
Definition: SemaDecl.cpp:5147
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool OdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
Definition: SemaExpr.cpp:12583
void ActOnObjCContainerFinishDefinition()
Definition: SemaDecl.cpp:12798
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:5258
SourceManager & SourceMgr
Definition: Sema.h:298
void CodeCompleteObjCImplementationDecl(Scope *S)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e.g.
Definition: SemaExpr.cpp:1545
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:17
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Contains a late templated function.
Definition: Sema.h:9271
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
Definition: DeclSpec.h:1165
static int getPrintable(int I)
Definition: Sema.h:1327
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
Definition: SemaDecl.cpp:1083
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness, issuing any diagnostics required.
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type...
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
A collection of diagnostics which were delayed.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result)
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3213
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
Definition: SemaDecl.cpp:14727
InstantiationKind
The kind of template instantiation we are performing.
Definition: Sema.h:6483
#define true
Definition: stdbool.h:32
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition: Sema.h:6775
A trivial tuple used to represent a source range.
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, 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 ...
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted...
ASTContext & Context
Definition: Sema.h:295
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< 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...
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition: Sema.h:8372
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:352
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident, unsigned AttrSpellingListIndex)
NamedDecl - This represents a decl with a name.
Definition: Decl.h:145
void DeclareInheritingConstructors(CXXRecordDecl *ClassDecl)
Declare all inheriting constructors for the given class.
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K)
Definition: Sema.cpp:1509
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
Definition: SemaExpr.cpp:5884
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...
bool hasExplicitCallingConv(QualType &T)
Definition: SemaType.cpp:5967
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
Decl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters can be deduced from a given template argument list.
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
Definition: SemaExpr.cpp:13863
ARCConversionResult CheckObjCARCConversion(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...
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false)
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:10876
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: Sema.h:721
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition: Sema.h:3255
Represents C++ using-directive.
Definition: DeclCXX.h:2546
void DiagnoseAbstractType(const CXXRecordDecl *RD)
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition: Sema.h:507
The template argument was deduced via template argument deduction.
Definition: Sema.h:5769
PragmaStack(const ValueType &Value)
Definition: Sema.h:377
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition: Sema.h:2648
Describes an entity that is being initialized.
static QualType getPrintable(QualType T)
Definition: Sema.h:1337
SpecialMemberOverloadResult(const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:891
Decl * getObjCDeclContext() const
Definition: SemaDecl.cpp:14813
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:132
ExprResult release()
Definition: Sema.h:3229
NamedDecl * Previous
Definition: Sema.h:1471
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
Definition: SemaDecl.cpp:3225
The type of an arbitrary declaration.
Definition: Sema.h:5958
NamespaceDecl * getStdNamespace() const
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
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 CodeCompleteAfterIf(Scope *S)
AssignmentAction
Definition: Sema.h:2162
ParsedAttributes - A collection of parsed attributes.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
SourceLocation ColonLoc
Location of ':'.
Definition: OpenMPClause.h:266
SmallVector< Slot, 2 > Stack
Definition: Sema.h:379
brief A function argument from which we performed template argument
Definition: Sema.h:6350
void EmitAvailabilityWarning(AvailabilityDiagnostic AD, NamedDecl *D, StringRef Message, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass, const ObjCPropertyDecl *ObjCProperty, bool ObjCPropertyAccess)
ParsedType getType() const
Definition: Sema.h:1573
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions, such as the default constructor, copy constructor, or destructor, to the given C++ class (C++ [special]p1).
#pragma vtordisp(pop)
Definition: Sema.h:330
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:36
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2139
The explicitly-specified template arguments were not valid template arguments for the given template...
Definition: Sema.h:6323
The lookup resulted in an error.
Definition: Sema.h:2691
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
Definition: SemaDecl.cpp:4426
SmallVector< std::pair< CXXMethodDecl *, const FunctionProtoType * >, 2 > DelayedDefaultedMemberExceptionSpecs
All the members seen during a class definition which were both explicitly defaulted and had explicitl...
Definition: Sema.h:517
This class handles loading and caching of source files into memory.
Preprocessor & getPreprocessor() const
Definition: Sema.h:1047
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types...
Definition: Sema.h:8355
The symbol does not exist.
Definition: Sema.h:4032
Declaration of a template function.
Definition: DeclTemplate.h:830
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition: Sema.h:908
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition: Sema.h:8842
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
bool IsInsideALocalClassWithinATemplateFunction()
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, AttributeList *MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
void PushFunctionScope()
Enter a new function scope.
Definition: Sema.cpp:1127
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
void CodeCompleteObjCProtocolDecl(Scope *S)
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
Definition: Expr.h:655
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, bool UseGlobal, QualType AllocType, bool IsArray, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete)
FindAllocationFunctions - Finds the overloads of operator new and delete that are appropriate for the...
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition: Sema.h:451
Attr - This represents one attribute.
Definition: Attr.h:44
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...
IdentifierInfo * Name
Definition: Sema.h:7363
CastType
Definition: SemaCast.cpp:39
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, bool IsCompAssign=false)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6...
Definition: SemaExpr.cpp:1256
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2766
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Definition: SemaExpr.cpp:11225
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Definition: SemaType.cpp:4338
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:485
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
Definition: SemaExpr.cpp:10000
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and...
Definition: SemaAttr.cpp:473
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, 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:5010
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
Definition: SemaType.cpp:6915
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: SemaStmt.cpp:3661
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: Sema.h:739
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:11723
Helper class that creates diagnostics with optional template instantiation stacks.
Definition: Sema.h:1071
Decl * ActOnDeclarator(Scope *S, Declarator &D)
Definition: SemaDecl.cpp:4653
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:96
AttributeList - Represents a syntactic attribute.
Definition: AttributeList.h:72
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity)
Perform substitution on the type T with a given set of template arguments.
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:1290
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
Definition: Decl.h:237
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc)
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition: Sema.h:938
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template)
A RAII object to temporarily push a declaration context.
Definition: Sema.h:601
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
Definition: SemaExpr.cpp:4498
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond, Decl *CondVar, Stmt *Body)
Definition: SemaStmt.cpp:1225
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
Definition: SemaDecl.cpp:1537
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).
Definition: Overload.h:131
SourceLocation CurInitSegLoc
Definition: Sema.h:395