clang  3.9.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"
19 #include "clang/AST/Availability.h"
21 #include "clang/AST/Expr.h"
22 #include "clang/AST/ExprObjC.h"
24 #include "clang/AST/LocInfoType.h"
26 #include "clang/AST/NSAPI.h"
28 #include "clang/AST/TypeLoc.h"
31 #include "clang/Basic/Module.h"
34 #include "clang/Basic/Specifiers.h"
36 #include "clang/Basic/TypeTraits.h"
38 #include "clang/Sema/CleanupInfo.h"
39 #include "clang/Sema/DeclSpec.h"
43 #include "clang/Sema/Ownership.h"
44 #include "clang/Sema/Scope.h"
45 #include "clang/Sema/ScopeInfo.h"
47 #include "clang/Sema/Weak.h"
48 #include "llvm/ADT/ArrayRef.h"
49 #include "llvm/ADT/Optional.h"
50 #include "llvm/ADT/SetVector.h"
51 #include "llvm/ADT/SmallPtrSet.h"
52 #include "llvm/ADT/SmallVector.h"
53 #include "llvm/ADT/TinyPtrVector.h"
54 #include <deque>
55 #include <memory>
56 #include <string>
57 #include <vector>
58 
59 namespace llvm {
60  class APSInt;
61  template <typename ValueT> struct DenseMapInfo;
62  template <typename ValueT, typename ValueInfoT> class DenseSet;
63  class SmallBitVector;
64  class InlineAsmIdentifierInfo;
65 }
66 
67 namespace clang {
68  class ADLResult;
69  class ASTConsumer;
70  class ASTContext;
71  class ASTMutationListener;
72  class ASTReader;
73  class ASTWriter;
74  class ArrayType;
75  class AttributeList;
76  class BlockDecl;
77  class CapturedDecl;
78  class CXXBasePath;
79  class CXXBasePaths;
80  class CXXBindTemporaryExpr;
82  class CXXConstructorDecl;
83  class CXXConversionDecl;
84  class CXXDeleteExpr;
85  class CXXDestructorDecl;
86  class CXXFieldCollector;
87  class CXXMemberCallExpr;
88  class CXXMethodDecl;
89  class CXXScopeSpec;
90  class CXXTemporary;
91  class CXXTryStmt;
92  class CallExpr;
93  class ClassTemplateDecl;
94  class ClassTemplatePartialSpecializationDecl;
95  class ClassTemplateSpecializationDecl;
96  class VarTemplatePartialSpecializationDecl;
97  class CodeCompleteConsumer;
98  class CodeCompletionAllocator;
99  class CodeCompletionTUInfo;
100  class CodeCompletionResult;
101  class Decl;
102  class DeclAccessPair;
103  class DeclContext;
104  class DeclRefExpr;
105  class DeclaratorDecl;
106  class DeducedTemplateArgument;
107  class DependentDiagnostic;
108  class DesignatedInitExpr;
109  class Designation;
110  class EnableIfAttr;
111  class EnumConstantDecl;
112  class Expr;
113  class ExtVectorType;
114  class FormatAttr;
115  class FriendDecl;
116  class FunctionDecl;
117  class FunctionProtoType;
118  class FunctionTemplateDecl;
119  class ImplicitConversionSequence;
120  class InitListExpr;
121  class InitializationKind;
122  class InitializationSequence;
123  class InitializedEntity;
124  class IntegerLiteral;
125  class LabelStmt;
126  class LambdaExpr;
127  class LangOptions;
128  class LocalInstantiationScope;
129  class LookupResult;
130  class MacroInfo;
132  class ModuleLoader;
133  class MultiLevelTemplateArgumentList;
134  class NamedDecl;
135  class ObjCCategoryDecl;
136  class ObjCCategoryImplDecl;
137  class ObjCCompatibleAliasDecl;
138  class ObjCContainerDecl;
139  class ObjCImplDecl;
140  class ObjCImplementationDecl;
141  class ObjCInterfaceDecl;
142  class ObjCIvarDecl;
143  template <class T> class ObjCList;
144  class ObjCMessageExpr;
145  class ObjCMethodDecl;
146  class ObjCPropertyDecl;
147  class ObjCProtocolDecl;
148  class OMPThreadPrivateDecl;
149  class OMPDeclareReductionDecl;
150  class OMPDeclareSimdDecl;
151  class OMPClause;
152  struct OverloadCandidate;
153  class OverloadCandidateSet;
154  class OverloadExpr;
155  class ParenListExpr;
156  class ParmVarDecl;
157  class Preprocessor;
158  class PseudoDestructorTypeStorage;
159  class PseudoObjectExpr;
160  class QualType;
161  class StandardConversionSequence;
162  class Stmt;
163  class StringLiteral;
164  class SwitchStmt;
165  class TemplateArgument;
166  class TemplateArgumentList;
167  class TemplateArgumentLoc;
168  class TemplateDecl;
169  class TemplateParameterList;
170  class TemplatePartialOrderingContext;
171  class TemplateTemplateParmDecl;
172  class Token;
173  class TypeAliasDecl;
174  class TypedefDecl;
175  class TypedefNameDecl;
176  class TypeLoc;
177  class TypoCorrectionConsumer;
178  class UnqualifiedId;
179  class UnresolvedLookupExpr;
180  class UnresolvedMemberExpr;
181  class UnresolvedSetImpl;
182  class UnresolvedSetIterator;
183  class UsingDecl;
184  class UsingShadowDecl;
185  class ValueDecl;
186  class VarDecl;
187  class VarTemplateSpecializationDecl;
188  class VisibilityAttr;
189  class VisibleDeclConsumer;
190  class IndirectFieldDecl;
191  struct DeductionFailureInfo;
192  class TemplateSpecCandidateSet;
193 
194 namespace sema {
195  class AccessedEntity;
196  class BlockScopeInfo;
197  class CapturedRegionScopeInfo;
198  class CapturingScopeInfo;
199  class CompoundScopeInfo;
200  class DelayedDiagnostic;
201  class DelayedDiagnosticPool;
202  class FunctionScopeInfo;
203  class LambdaScopeInfo;
204  class PossiblyUnreachableDiag;
205  class TemplateDeductionInfo;
206 }
207 
208 namespace threadSafety {
209  class BeforeSet;
210  void threadSafetyCleanup(BeforeSet* Cache);
211 }
212 
213 // FIXME: No way to easily map from TemplateTypeParmTypes to
214 // TemplateTypeParmDecls, so we have this horrible PointerUnion.
215 typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
217 
218 /// Describes whether we've seen any nullability information for the given
219 /// file.
221  /// The first pointer declarator (of any pointer kind) in the file that does
222  /// not have a corresponding nullability annotation.
224 
225  /// Which kind of pointer declarator we saw.
226  uint8_t PointerKind;
227 
228  /// Whether we saw any type nullability annotations in the given file.
229  bool SawTypeNullability = false;
230 };
231 
232 /// A mapping from file IDs to a record of whether we've seen nullability
233 /// information in that file.
235  /// A mapping from file IDs to the nullability information for each file ID.
236  llvm::DenseMap<FileID, FileNullability> Map;
237 
238  /// A single-element cache based on the file ID.
239  struct {
242  } Cache;
243 
244 public:
246  // Check the single-element cache.
247  if (file == Cache.File)
248  return Cache.Nullability;
249 
250  // It's not in the single-element cache; flush the cache if we have one.
251  if (!Cache.File.isInvalid()) {
252  Map[Cache.File] = Cache.Nullability;
253  }
254 
255  // Pull this entry into the cache.
256  Cache.File = file;
257  Cache.Nullability = Map[file];
258  return Cache.Nullability;
259  }
260 };
261 
262 /// Sema - This implements semantic analysis and AST building for C.
263 class Sema {
264  Sema(const Sema &) = delete;
265  void operator=(const Sema &) = delete;
266 
267  ///\brief Source of additional semantic information.
268  ExternalSemaSource *ExternalSource;
269 
270  ///\brief Whether Sema has generated a multiplexer and has to delete it.
271  bool isMultiplexExternalSource;
272 
273  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
274 
275  bool isVisibleSlow(const NamedDecl *D);
276 
277  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
278  const NamedDecl *New) {
279  // We are about to link these. It is now safe to compute the linkage of
280  // the new decl. If the new decl has external linkage, we will
281  // link it with the hidden decl (which also has external linkage) and
282  // it will keep having external linkage. If it has internal linkage, we
283  // will not link it. Since it has no previous decls, it will remain
284  // with internal linkage.
285  return isVisible(Old) || New->isExternallyVisible();
286  }
287  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
288 
289 public:
293 
296 
303 
304  /// \brief Flag indicating whether or not to collect detailed statistics.
306 
307  /// \brief Code-completion consumer.
309 
310  /// CurContext - This is the current declaration context of parsing.
312 
313  /// \brief Generally null except when we temporarily switch decl contexts,
314  /// like in \see ActOnObjCTemporaryExitContainerContext.
316 
317  /// VAListTagName - The declaration name corresponding to __va_list_tag.
318  /// This is used as part of a hack to omit that class from ADL results.
320 
321  bool MSStructPragmaOn; // True when \#pragma ms_struct on
322 
323  /// \brief Controls member pointer representation format under the MS ABI.
326 
327  /// Stack of active SEH __finally scopes. Can be empty.
329 
330  /// \brief Source location for newly created implicit MSInheritanceAttrs
332 
334  PSK_Reset = 0x0, // #pragma ()
335  PSK_Set = 0x1, // #pragma (value)
336  PSK_Push = 0x2, // #pragma (push[, id])
337  PSK_Pop = 0x4, // #pragma (pop[, id])
338  PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
339  PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
340  PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
341  };
342 
343  template<typename ValueType>
344  struct PragmaStack {
345  struct Slot {
346  llvm::StringRef StackSlotLabel;
347  ValueType Value;
349  Slot(llvm::StringRef StackSlotLabel,
350  ValueType Value,
352  : StackSlotLabel(StackSlotLabel), Value(Value),
353  PragmaLocation(PragmaLocation) {}
354  };
355  void Act(SourceLocation PragmaLocation,
357  llvm::StringRef StackSlotLabel,
358  ValueType Value);
359 
360  // MSVC seems to add artificial slots to #pragma stacks on entering a C++
361  // method body to restore the stacks on exit, so it works like this:
362  //
363  // struct S {
364  // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
365  // void Method {}
366  // #pragma <name>(pop, InternalPragmaSlot)
367  // };
368  //
369  // It works even with #pragma vtordisp, although MSVC doesn't support
370  // #pragma vtordisp(push [, id], n)
371  // syntax.
372  //
373  // Push / pop a named sentinel slot.
374  void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
375  assert((Action == PSK_Push || Action == PSK_Pop) &&
376  "Can only push / pop #pragma stack sentinels!");
377  Act(CurrentPragmaLocation, Action, Label, CurrentValue);
378  }
379 
380  // Constructors.
381  explicit PragmaStack(const ValueType &Default)
382  : DefaultValue(Default), CurrentValue(Default) {}
383 
385  ValueType DefaultValue; // Value used for PSK_Reset action.
386  ValueType CurrentValue;
388  };
389  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
390  // we shouldn't do so if they're in a module).
391 
392  /// \brief Whether to insert vtordisps prior to virtual bases in the Microsoft
393  /// C++ ABI. Possible values are 0, 1, and 2, which mean:
394  ///
395  /// 0: Suppress all vtordisps
396  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
397  /// structors
398  /// 2: Always insert vtordisps to support RTTI on partially constructed
399  /// objects
401  // #pragma pack.
402  // Sentinel to represent when the stack is set to mac68k alignment.
403  static const unsigned kMac68kAlignmentSentinel = ~0U;
405  // Segment #pragmas.
410 
411  // RAII object to push / pop sentinel slots for all MS #pragma stacks.
412  // Actions should be performed only if we enter / exit a C++ method body.
414  public:
415  PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
417 
418  private:
419  Sema &S;
420  StringRef SlotLabel;
421  bool ShouldAct;
422  };
423 
424  /// A mapping that describes the nullability we've seen in each header file.
426 
427  /// Last section used with #pragma init_seg.
430 
431  /// VisContext - Manages the stack for \#pragma GCC visibility.
432  void *VisContext; // Really a "PragmaVisStack*"
433 
434  /// \brief This represents the last location of a "#pragma clang optimize off"
435  /// directive if such a directive has not been closed by an "on" yet. If
436  /// optimizations are currently "on", this is set to an invalid location.
438 
439  /// \brief Flag indicating if Sema is building a recovery call expression.
440  ///
441  /// This flag is used to avoid building recovery call expressions
442  /// if Sema is already doing so, which would cause infinite recursions.
444 
445  /// Used to control the generation of ExprWithCleanups.
447 
448  /// ExprCleanupObjects - This is the stack of objects requiring
449  /// cleanup that are created by the current full expression. The
450  /// element type here is ExprWithCleanups::Object.
452 
453  /// \brief Store a list of either DeclRefExprs or MemberExprs
454  /// that contain a reference to a variable (constant) that may or may not
455  /// be odr-used in this Expr, and we won't know until all lvalue-to-rvalue
456  /// and discarded value conversions have been applied to all subexpressions
457  /// of the enclosing full expression. This is cleared at the end of each
458  /// full expression.
459  llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
460 
461  /// \brief Stack containing information about each of the nested
462  /// function, block, and method scopes that are currently active.
463  ///
464  /// This array is never empty. Clients should ignore the first
465  /// element, which is used to cache a single FunctionScopeInfo
466  /// that's used to parse every top-level function.
468 
472 
473  /// ExtVectorDecls - This is a list all the extended vector types. This allows
474  /// us to associate a raw vector type with one of the ext_vector type names.
475  /// This is only necessary for issuing pretty diagnostics.
477 
478  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
479  std::unique_ptr<CXXFieldCollector> FieldCollector;
480 
482 
483  /// \brief Set containing all declared private fields that are not used.
485 
486  /// \brief Set containing all typedefs that are likely unused.
489 
490  /// \brief Delete-expressions to be analyzed at the end of translation unit
491  ///
492  /// This list contains class members, and locations of delete-expressions
493  /// that could not be proven as to whether they mismatch with new-expression
494  /// used in initializer of the field.
495  typedef std::pair<SourceLocation, bool> DeleteExprLoc;
497  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
498 
499  typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy;
500 
501  /// PureVirtualClassDiagSet - a set of class declarations which we have
502  /// emitted a list of pure virtual functions. Used to prevent emitting the
503  /// same list more than once.
504  std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
505 
506  /// ParsingInitForAutoVars - a set of declarations with auto types for which
507  /// we are currently parsing the initializer.
508  llvm::SmallPtrSet<const Decl*, 4> ParsingInitForAutoVars;
509 
510  /// \brief Look for a locally scoped extern "C" declaration by the given name.
512 
516 
517  /// \brief All the tentative definitions encountered in the TU.
519 
523 
524  /// \brief The set of file scoped decls seen so far that have not been used
525  /// and must warn if not used. Only contains the first declaration.
527 
531 
532  /// \brief All the delegating constructors seen so far in the file, used for
533  /// cycle detection at the end of the TU.
535 
536  /// \brief All the overriding functions seen during a class definition
537  /// that had their exception spec checks delayed, plus the overridden
538  /// function.
541 
542  /// \brief All the members seen during a class definition which were both
543  /// explicitly defaulted and had explicitly-specified exception
544  /// specifications, along with the function type containing their
545  /// user-specified exception specification. Those exception specifications
546  /// were overridden with the default specifications, but we still need to
547  /// check whether they are compatible with the default specification, and
548  /// we can't do that until the nesting set of class definitions is complete.
551 
552  typedef llvm::MapVector<const FunctionDecl *, LateParsedTemplate *>
555 
556  /// \brief Callback to the parser to parse templated functions when needed.
557  typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
558  typedef void LateTemplateParserCleanupCB(void *P);
562 
564  LateTemplateParserCleanupCB *LTPCleanup,
565  void *P) {
566  LateTemplateParser = LTP;
567  LateTemplateParserCleanup = LTPCleanup;
568  OpaqueParser = P;
569  }
570 
571  class DelayedDiagnostics;
572 
574  sema::DelayedDiagnosticPool *SavedPool;
576  };
579 
580  /// A class which encapsulates the logic for delaying diagnostics
581  /// during parsing and other processing.
583  /// \brief The current pool of diagnostics into which delayed
584  /// diagnostics should go.
586 
587  public:
588  DelayedDiagnostics() : CurPool(nullptr) {}
589 
590  /// Adds a delayed diagnostic.
591  void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
592 
593  /// Determines whether diagnostics should be delayed.
594  bool shouldDelayDiagnostics() { return CurPool != nullptr; }
595 
596  /// Returns the current delayed-diagnostics pool.
598  return CurPool;
599  }
600 
601  /// Enter a new scope. Access and deprecation diagnostics will be
602  /// collected in this pool.
605  state.SavedPool = CurPool;
606  CurPool = &pool;
607  return state;
608  }
609 
610  /// Leave a delayed-diagnostic state that was previously pushed.
611  /// Do not emit any of the diagnostics. This is performed as part
612  /// of the bookkeeping of popping a pool "properly".
614  CurPool = state.SavedPool;
615  }
616 
617  /// Enter a new scope where access and deprecation diagnostics are
618  /// not delayed.
621  state.SavedPool = CurPool;
622  CurPool = nullptr;
623  return state;
624  }
625 
626  /// Undo a previous pushUndelayed().
628  assert(CurPool == nullptr);
629  CurPool = state.SavedPool;
630  }
632 
633  /// A RAII object to temporarily push a declaration context.
634  class ContextRAII {
635  private:
636  Sema &S;
637  DeclContext *SavedContext;
638  ProcessingContextState SavedContextState;
639  QualType SavedCXXThisTypeOverride;
640 
641  public:
642  ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
643  : S(S), SavedContext(S.CurContext),
644  SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
645  SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
646  {
647  assert(ContextToPush && "pushing null context");
648  S.CurContext = ContextToPush;
649  if (NewThisContext)
651  }
652 
653  void pop() {
654  if (!SavedContext) return;
655  S.CurContext = SavedContext;
656  S.DelayedDiagnostics.popUndelayed(SavedContextState);
657  S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
658  SavedContext = nullptr;
659  }
660 
662  pop();
663  }
664  };
665 
666  /// \brief RAII object to handle the state changes required to synthesize
667  /// a function body.
669  Sema &S;
670  Sema::ContextRAII SavedContext;
671 
672  public:
674  : S(S), SavedContext(S, DC)
675  {
676  S.PushFunctionScope();
678  }
679 
683  }
684  };
685 
686  /// WeakUndeclaredIdentifiers - Identifiers contained in
687  /// \#pragma weak before declared. rare. may alias another
688  /// identifier, declared or undeclared
689  llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
690 
691  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
692  /// \#pragma redefine_extname before declared. Used in Solaris system headers
693  /// to define functions that occur in multiple standards to call the version
694  /// in the currently selected standard.
695  llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
696 
697 
698  /// \brief Load weak undeclared identifiers from the external source.
700 
701  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
702  /// \#pragma weak during processing of other Decls.
703  /// I couldn't figure out a clean way to generate these in-line, so
704  /// we store them here and handle separately -- which is a hack.
705  /// It would be best to refactor this.
707 
709 
710  /// Translation Unit Scope - useful to Objective-C actions that need
711  /// to lookup file scope declarations in the "ordinary" C decl namespace.
712  /// For example, user-defined classes, built-in "id" type, etc.
714 
715  /// \brief The C++ "std" namespace, where the standard library resides.
717 
718  /// \brief The C++ "std::bad_alloc" class, which is defined by the C++
719  /// standard library.
721 
722  /// \brief The C++ "std::initializer_list" template, which is defined in
723  /// <initializer_list>.
725 
726  /// \brief The C++ "type_info" declaration, which is defined in <typeinfo>.
728 
729  /// \brief The MSVC "_GUID" struct, which is defined in MSVC header files.
731 
732  /// \brief Caches identifiers/selectors for NSFoundation APIs.
733  std::unique_ptr<NSAPI> NSAPIObj;
734 
735  /// \brief The declaration of the Objective-C NSNumber class.
737 
738  /// \brief The declaration of the Objective-C NSValue class.
740 
741  /// \brief Pointer to NSNumber type (NSNumber *).
743 
744  /// \brief Pointer to NSValue type (NSValue *).
746 
747  /// \brief The Objective-C NSNumber methods used to create NSNumber literals.
749 
750  /// \brief The declaration of the Objective-C NSString class.
752 
753  /// \brief Pointer to NSString type (NSString *).
755 
756  /// \brief The declaration of the stringWithUTF8String: method.
758 
759  /// \brief The declaration of the valueWithBytes:objCType: method.
761 
762  /// \brief The declaration of the Objective-C NSArray class.
764 
765  /// \brief The declaration of the arrayWithObjects:count: method.
767 
768  /// \brief The declaration of the Objective-C NSDictionary class.
770 
771  /// \brief The declaration of the dictionaryWithObjects:forKeys:count: method.
773 
774  /// \brief id<NSCopying> type.
776 
777  /// \brief will hold 'respondsToSelector:'
779 
780  /// \brief counter for internal MS Asm label names.
782 
783  /// A flag to remember whether the implicit forms of operator new and delete
784  /// have been declared.
786 
787  /// A flag to indicate that we're in a context that permits abstract
788  /// references to fields. This is really a
790 
791  /// \brief Describes how the expressions currently being parsed are
792  /// evaluated at run-time, if at all.
794  /// \brief The current expression and its subexpressions occur within an
795  /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
796  /// \c sizeof, where the type of the expression may be significant but
797  /// no code will be generated to evaluate the value of the expression at
798  /// run time.
800 
801  /// \brief The current expression occurs within a discarded statement.
802  /// This behaves largely similarly to an unevaluated operand in preventing
803  /// definitions from being required, but not in other ways.
805 
806  /// \brief The current expression occurs within an unevaluated
807  /// operand that unconditionally permits abstract references to
808  /// fields, such as a SIZE operator in MS-style inline assembly.
810 
811  /// \brief The current context is "potentially evaluated" in C++11 terms,
812  /// but the expression is evaluated at compile-time (like the values of
813  /// cases in a switch statement).
815 
816  /// \brief The current expression is potentially evaluated at run time,
817  /// which means that code may be generated to evaluate the value of the
818  /// expression at run time.
820 
821  /// \brief The current expression is potentially evaluated, but any
822  /// declarations referenced inside that expression are only used if
823  /// in fact the current expression is used.
824  ///
825  /// This value is used when parsing default function arguments, for which
826  /// we would like to provide diagnostics (e.g., passing non-POD arguments
827  /// through varargs) but do not want to mark declarations as "referenced"
828  /// until the default argument is used.
830  };
831 
832  /// \brief Data structure used to record current or nested
833  /// expression evaluation contexts.
835  /// \brief The expression evaluation context.
837 
838  /// \brief Whether the enclosing context needed a cleanup.
840 
841  /// \brief Whether we are in a decltype expression.
843 
844  /// \brief The number of active cleanup objects when we entered
845  /// this expression evaluation context.
847 
848  /// \brief The number of typos encountered during this expression evaluation
849  /// context (i.e. the number of TypoExprs created).
850  unsigned NumTypos;
851 
852  llvm::SmallPtrSet<Expr*, 2> SavedMaybeODRUseExprs;
853 
854  /// \brief The lambdas that are present within this context, if it
855  /// is indeed an unevaluated context.
857 
858  /// \brief The declaration that provides context for lambda expressions
859  /// and block literals if the normal declaration context does not
860  /// suffice, e.g., in a default function argument.
862 
863  /// \brief The context information used to mangle lambda expressions
864  /// and block literals within this context.
865  ///
866  /// This mangling information is allocated lazily, since most contexts
867  /// do not have lambda expressions or block literals.
869 
870  /// \brief If we are processing a decltype type, a set of call expressions
871  /// for which we have deferred checking the completeness of the return type.
873 
874  /// \brief If we are processing a decltype type, a set of temporary binding
875  /// expressions for which we have deferred checking the destructor.
877 
879  unsigned NumCleanupObjects,
882  bool IsDecltype)
883  : Context(Context), ParentCleanup(ParentCleanup),
884  IsDecltype(IsDecltype), NumCleanupObjects(NumCleanupObjects),
885  NumTypos(0),
886  ManglingContextDecl(ManglingContextDecl), MangleNumbering() { }
887 
888  /// \brief Retrieve the mangling numbering context, used to consistently
889  /// number constructs like lambdas for mangling.
891 
892  bool isUnevaluated() const {
894  }
895  };
896 
897  /// A stack of expression evaluation contexts.
899 
900  /// \brief Compute the mangling number context for a lambda expression or
901  /// block literal.
902  ///
903  /// \param DC - The DeclContext containing the lambda expression or
904  /// block literal.
905  /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl
906  /// associated with the context, if relevant.
908  const DeclContext *DC,
909  Decl *&ManglingContextDecl);
910 
911 
912  /// SpecialMemberOverloadResult - The overloading result for a special member
913  /// function.
914  ///
915  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
916  /// integer are used to determine whether overload resolution succeeded.
917  class SpecialMemberOverloadResult : public llvm::FastFoldingSetNode {
918  public:
919  enum Kind {
923  };
924 
925  private:
926  llvm::PointerIntPair<CXXMethodDecl*, 2> Pair;
927 
928  public:
929  SpecialMemberOverloadResult(const llvm::FoldingSetNodeID &ID)
930  : FastFoldingSetNode(ID)
931  {}
932 
933  CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
934  void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
935 
936  Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
937  void setKind(Kind K) { Pair.setInt(K); }
938  };
939 
940  /// \brief A cache of special member function overload resolution results
941  /// for C++ records.
942  llvm::FoldingSet<SpecialMemberOverloadResult> SpecialMemberCache;
943 
944  /// \brief A cache of the flags available in enumerations with the flag_bits
945  /// attribute.
946  mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
947 
948  /// \brief The kind of translation unit we are processing.
949  ///
950  /// When we're processing a complete translation unit, Sema will perform
951  /// end-of-translation-unit semantic tasks (such as creating
952  /// initializers for tentative definitions in C) once parsing has
953  /// completed. Modules and precompiled headers perform different kinds of
954  /// checks.
956 
957  llvm::BumpPtrAllocator BumpAlloc;
958 
959  /// \brief The number of SFINAE diagnostics that have been trapped.
960  unsigned NumSFINAEErrors;
961 
962  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
964 
965  /// \brief A mapping from parameters with unparsed default arguments to the
966  /// set of instantiations of each parameter.
967  ///
968  /// This mapping is a temporary data structure used when parsing
969  /// nested class templates or nested classes of class templates,
970  /// where we might end up instantiating an inner class before the
971  /// default arguments of its methods have been parsed.
973 
974  // Contains the locations of the beginning of unparsed default
975  // argument locations.
976  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
977 
978  /// UndefinedInternals - all the used, undefined objects which require a
979  /// definition in this translation unit.
980  llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
981 
982  /// Obtain a sorted list of functions that are undefined but ODR-used.
983  void getUndefinedButUsed(
984  SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
985 
986  /// Retrieves list of suspicious delete-expressions that will be checked at
987  /// the end of translation unit.
988  const llvm::MapVector<FieldDecl *, DeleteLocs> &
990 
991  typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods;
992  typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
993 
994  /// Method Pool - allows efficient lookup when typechecking messages to "id".
995  /// We need to maintain a list, since selectors can have differing signatures
996  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
997  /// of selectors are "overloaded").
998  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
999  /// methods inside categories with a particular selector.
1001 
1002  /// Method selectors used in a \@selector expression. Used for implementation
1003  /// of -Wselector.
1004  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1005 
1006  /// Kinds of C++ special members.
1015  };
1016 
1017  typedef std::pair<CXXRecordDecl*, CXXSpecialMember> SpecialMemberDecl;
1018 
1019  /// The C++ special members which we are currently in the process of
1020  /// declaring. If this process recursively triggers the declaration of the
1021  /// same special member, we should act as if it is not yet declared.
1022  llvm::SmallSet<SpecialMemberDecl, 4> SpecialMembersBeingDeclared;
1023 
1024  void ReadMethodPool(Selector Sel);
1026 
1027  /// Private Helper predicate to check for 'self'.
1028  bool isSelfExpr(Expr *RExpr);
1029  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1030 
1031  /// \brief Cause the active diagnostic on the DiagosticsEngine to be
1032  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1033  /// should not be used elsewhere.
1034  void EmitCurrentDiagnostic(unsigned DiagID);
1035 
1036  /// Records and restores the FP_CONTRACT state on entry/exit of compound
1037  /// statements.
1039  public:
1041  : S(S), OldFPContractState(S.FPFeatures.fp_contract) {}
1043  S.FPFeatures.fp_contract = OldFPContractState;
1044  }
1045  private:
1046  Sema& S;
1047  bool OldFPContractState : 1;
1048  };
1049 
1050  void addImplicitTypedef(StringRef Name, QualType T);
1051 
1052 public:
1053  Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1055  CodeCompleteConsumer *CompletionConsumer = nullptr);
1056  ~Sema();
1057 
1058  /// \brief Perform initialization that occurs after the parser has been
1059  /// initialized but before it parses anything.
1060  void Initialize();
1061 
1062  const LangOptions &getLangOpts() const { return LangOpts; }
1065 
1068  Preprocessor &getPreprocessor() const { return PP; }
1069  ASTContext &getASTContext() const { return Context; }
1070  ASTConsumer &getASTConsumer() const { return Consumer; }
1072  ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1073 
1074  ///\brief Registers an external source. If an external source already exists,
1075  /// creates a multiplex external source and appends to it.
1076  ///
1077  ///\param[in] E - A non-null external sema source.
1078  ///
1080 
1081  void PrintStats() const;
1082 
1083  /// \brief Helper class that creates diagnostics with optional
1084  /// template instantiation stacks.
1085  ///
1086  /// This class provides a wrapper around the basic DiagnosticBuilder
1087  /// class that emits diagnostics. SemaDiagnosticBuilder is
1088  /// responsible for emitting the diagnostic (as DiagnosticBuilder
1089  /// does) and, if the diagnostic comes from inside a template
1090  /// instantiation, printing the template instantiation stack as
1091  /// well.
1093  Sema &SemaRef;
1094  unsigned DiagID;
1095 
1096  public:
1097  SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1098  : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
1099 
1100  // This is a cunning lie. DiagnosticBuilder actually performs move
1101  // construction in its copy constructor (but due to varied uses, it's not
1102  // possible to conveniently express this as actual move construction). So
1103  // the default copy ctor here is fine, because the base class disables the
1104  // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op
1105  // in that case anwyay.
1106  SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;
1107 
1109  // If we aren't active, there is nothing to do.
1110  if (!isActive()) return;
1111 
1112  // Otherwise, we need to emit the diagnostic. First flush the underlying
1113  // DiagnosticBuilder data, and clear the diagnostic builder itself so it
1114  // won't emit the diagnostic in its own destructor.
1115  //
1116  // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1117  // do its own needless checks to see if the diagnostic needs to be
1118  // emitted. However, because we take care to ensure that the builder
1119  // objects never escape, a sufficiently smart compiler will be able to
1120  // eliminate that code.
1121  FlushCounts();
1122  Clear();
1123 
1124  // Dispatch to Sema to emit the diagnostic.
1125  SemaRef.EmitCurrentDiagnostic(DiagID);
1126  }
1127 
1128  /// Teach operator<< to produce an object of the correct type.
1129  template<typename T>
1131  const SemaDiagnosticBuilder &Diag, const T &Value) {
1132  const DiagnosticBuilder &BaseDiag = Diag;
1133  BaseDiag << Value;
1134  return Diag;
1135  }
1136  };
1137 
1138  /// \brief Emit a diagnostic.
1140  DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
1141  return SemaDiagnosticBuilder(DB, *this, DiagID);
1142  }
1143 
1144  /// \brief Emit a partial diagnostic.
1145  SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic& PD);
1146 
1147  /// \brief Build a partial diagnostic.
1148  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1149 
1150  bool findMacroSpelling(SourceLocation &loc, StringRef name);
1151 
1152  /// \brief Get a string to suggest for zero-initialization of a type.
1153  std::string
1155  std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1156 
1157  /// \brief Calls \c Lexer::getLocForEndOfToken()
1159 
1160  /// \brief Retrieve the module loader associated with the preprocessor.
1161  ModuleLoader &getModuleLoader() const;
1162 
1164 
1166 
1168 
1170 
1171  void PushFunctionScope();
1172  void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1174 
1175  /// \brief This is used to inform Sema what the current TemplateParameterDepth
1176  /// is during Parsing. Currently it is used to pass on the depth
1177  /// when parsing generic lambda 'auto' parameters.
1179 
1180  void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1181  RecordDecl *RD,
1182  CapturedRegionKind K);
1183  void
1185  const Decl *D = nullptr,
1186  const BlockExpr *blkExpr = nullptr);
1187 
1189  return FunctionScopes.back();
1190  }
1191 
1193  if (FunctionScopes.empty())
1194  return nullptr;
1195 
1196  for (int e = FunctionScopes.size()-1; e >= 0; --e) {
1197  if (isa<sema::BlockScopeInfo>(FunctionScopes[e]))
1198  continue;
1199  return FunctionScopes[e];
1200  }
1201  return nullptr;
1202  }
1203 
1204  template <typename ExprT>
1205  void recordUseOfEvaluatedWeak(const ExprT *E, bool IsRead=true) {
1206  if (!isUnevaluatedContext())
1207  getCurFunction()->recordUseOfWeak(E, IsRead);
1208  }
1209 
1210  void PushCompoundScope();
1211  void PopCompoundScope();
1212 
1214 
1216 
1217  /// \brief Retrieve the current block, if any.
1219 
1220  /// \brief Retrieve the current lambda scope info, if any.
1222 
1223  /// \brief Retrieve the current generic lambda info, if any.
1225 
1226  /// \brief Retrieve the current captured region, if any.
1228 
1229  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1231 
1232  void ActOnComment(SourceRange Comment);
1233 
1234  //===--------------------------------------------------------------------===//
1235  // Type Analysis / Processing: SemaType.cpp.
1236  //
1237 
1239  const DeclSpec *DS = nullptr);
1240  QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
1241  const DeclSpec *DS = nullptr);
1243  SourceLocation Loc, DeclarationName Entity);
1244  QualType BuildReferenceType(QualType T, bool LValueRef,
1245  SourceLocation Loc, DeclarationName Entity);
1247  Expr *ArraySize, unsigned Quals,
1248  SourceRange Brackets, DeclarationName Entity);
1249  QualType BuildExtVectorType(QualType T, Expr *ArraySize,
1250  SourceLocation AttrLoc);
1251 
1253 
1254  /// \brief Build a function type.
1255  ///
1256  /// This routine checks the function type according to C++ rules and
1257  /// under the assumption that the result type and parameter types have
1258  /// just been instantiated from a template. It therefore duplicates
1259  /// some of the behavior of GetTypeForDeclarator, but in a much
1260  /// simpler form that is only suitable for this narrow use case.
1261  ///
1262  /// \param T The return type of the function.
1263  ///
1264  /// \param ParamTypes The parameter types of the function. This array
1265  /// will be modified to account for adjustments to the types of the
1266  /// function parameters.
1267  ///
1268  /// \param Loc The location of the entity whose type involves this
1269  /// function type or, if there is no such entity, the location of the
1270  /// type that will have function type.
1271  ///
1272  /// \param Entity The name of the entity that involves the function
1273  /// type, if known.
1274  ///
1275  /// \param EPI Extra information about the function type. Usually this will
1276  /// be taken from an existing function with the same prototype.
1277  ///
1278  /// \returns A suitable function type, if there are no errors. The
1279  /// unqualified type will always be a FunctionProtoType.
1280  /// Otherwise, returns a NULL type.
1282  MutableArrayRef<QualType> ParamTypes,
1283  SourceLocation Loc, DeclarationName Entity,
1284  const FunctionProtoType::ExtProtoInfo &EPI);
1285 
1287  SourceLocation Loc,
1288  DeclarationName Entity);
1290  SourceLocation Loc, DeclarationName Entity);
1294  SourceLocation Loc);
1295 
1299  TypeSourceInfo *ReturnTypeInfo);
1300 
1301  /// \brief Package the given type and TSI into a ParsedType.
1306  TypeSourceInfo **TInfo = nullptr);
1307  CanThrowResult canThrow(const Expr *E);
1309  const FunctionProtoType *FPT);
1316  const FunctionProtoType *Old, SourceLocation OldLoc,
1317  const FunctionProtoType *New, SourceLocation NewLoc);
1319  const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1320  const FunctionProtoType *Old, SourceLocation OldLoc,
1321  const FunctionProtoType *New, SourceLocation NewLoc,
1322  bool *MissingExceptionSpecification = nullptr,
1323  bool *MissingEmptyExceptionSpecification = nullptr,
1324  bool AllowNoexceptAllMatchWithNoSpec = false,
1325  bool IsOperatorNew = false);
1327  const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1328  const FunctionProtoType *Superset, SourceLocation SuperLoc,
1329  const FunctionProtoType *Subset, SourceLocation SubLoc);
1330  bool CheckParamExceptionSpec(const PartialDiagnostic & NoteID,
1331  const FunctionProtoType *Target, SourceLocation TargetLoc,
1332  const FunctionProtoType *Source, SourceLocation SourceLoc);
1333 
1335 
1336  /// \brief The parser has parsed the context-sensitive type 'instancetype'
1337  /// in an Objective-C message declaration. Return the appropriate type.
1339 
1340  /// \brief Abstract class used to diagnose incomplete types.
1341  struct TypeDiagnoser {
1343 
1344  virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
1345  virtual ~TypeDiagnoser() {}
1346  };
1347 
1348  static int getPrintable(int I) { return I; }
1349  static unsigned getPrintable(unsigned I) { return I; }
1350  static bool getPrintable(bool B) { return B; }
1351  static const char * getPrintable(const char *S) { return S; }
1352  static StringRef getPrintable(StringRef S) { return S; }
1353  static const std::string &getPrintable(const std::string &S) { return S; }
1354  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
1355  return II;
1356  }
1358  static QualType getPrintable(QualType T) { return T; }
1359  static SourceRange getPrintable(SourceRange R) { return R; }
1360  static SourceRange getPrintable(SourceLocation L) { return L; }
1361  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
1362  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
1363 
1364  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
1365  unsigned DiagID;
1366  std::tuple<const Ts &...> Args;
1367 
1368  template <std::size_t... Is>
1369  void emit(const SemaDiagnosticBuilder &DB,
1370  llvm::index_sequence<Is...>) const {
1371  // Apply all tuple elements to the builder in order.
1372  bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1373  (void)Dummy;
1374  }
1375 
1376  public:
1377  BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
1378  : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1379  assert(DiagID != 0 && "no diagnostic for type diagnoser");
1380  }
1381 
1382  void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1383  const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1384  emit(DB, llvm::index_sequence_for<Ts...>());
1385  DB << T;
1386  }
1387  };
1388 
1389 private:
1390  bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
1391  TypeDiagnoser *Diagnoser);
1392 
1393  VisibleModuleSet VisibleModules;
1394  llvm::SmallVector<VisibleModuleSet, 16> VisibleModulesStack;
1395 
1396  Module *CachedFakeTopLevelModule;
1397 
1398 public:
1399  /// \brief Get the module owning an entity.
1400  Module *getOwningModule(Decl *Entity);
1401 
1402  /// \brief Make a merged definition of an existing hidden definition \p ND
1403  /// visible at the specified location.
1405 
1406  bool isModuleVisible(Module *M) { return VisibleModules.isVisible(M); }
1407 
1408  /// Determine whether a declaration is visible to name lookup.
1409  bool isVisible(const NamedDecl *D) {
1410  return !D->isHidden() || isVisibleSlow(D);
1411  }
1412 
1413  /// Determine whether any declaration of an entity is visible.
1414  bool
1416  llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
1417  return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
1418  }
1419  bool hasVisibleDeclarationSlow(const NamedDecl *D,
1421 
1423 
1424  /// Determine if \p D has a visible definition. If not, suggest a declaration
1425  /// that should be made visible to expose the definition.
1426  bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
1427  bool OnlyNeedComplete = false);
1429  NamedDecl *Hidden;
1430  return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
1431  }
1432 
1433  /// Determine if the template parameter \p D has a visible default argument.
1434  bool
1436  llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1437 
1438  /// Determine if there is a visible declaration of \p D that is a member
1439  /// specialization declaration (as opposed to an instantiated declaration).
1441  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1442 
1443  /// Determine if \p A and \p B are equivalent internal linkage declarations
1444  /// from different modules, and thus an ambiguity error can be downgraded to
1445  /// an extension warning.
1447  const NamedDecl *B);
1449  SourceLocation Loc, const NamedDecl *D,
1451 
1453  return !RequireCompleteTypeImpl(Loc, T, nullptr);
1454  }
1456  TypeDiagnoser &Diagnoser);
1458  unsigned DiagID);
1459 
1460  template <typename... Ts>
1461  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
1462  const Ts &...Args) {
1463  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1464  return RequireCompleteType(Loc, T, Diagnoser);
1465  }
1466 
1467  void completeExprArrayBound(Expr *E);
1468  bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser);
1469  bool RequireCompleteExprType(Expr *E, unsigned DiagID);
1470 
1471  template <typename... Ts>
1472  bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
1473  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1474  return RequireCompleteExprType(E, Diagnoser);
1475  }
1476 
1478  TypeDiagnoser &Diagnoser);
1479  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
1480 
1481  template <typename... Ts>
1482  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
1483  const Ts &...Args) {
1484  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1485  return RequireLiteralType(Loc, T, Diagnoser);
1486  }
1487 
1489  const CXXScopeSpec &SS, QualType T);
1490 
1492  /// If AsUnevaluated is false, E is treated as though it were an evaluated
1493  /// context, such as when building a type for decltype(auto).
1495  bool AsUnevaluated = true);
1498  SourceLocation Loc);
1499 
1500  //===--------------------------------------------------------------------===//
1501  // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
1502  //
1503 
1504  struct SkipBodyInfo {
1505  SkipBodyInfo() : ShouldSkip(false), Previous(nullptr) {}
1508  };
1509 
1510  /// List of decls defined in a function prototype. This contains EnumConstants
1511  /// that incorrectly end up in translation unit scope because there is no
1512  /// function to pin them on. ActOnFunctionDeclarator reads this list and patches
1513  /// them into the FunctionDecl.
1514  std::vector<NamedDecl*> DeclsInPrototypeScope;
1515 
1516  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
1517 
1519 
1521 
1523  Scope *S, CXXScopeSpec *SS = nullptr,
1524  bool isClassName = false, bool HasTrailingDot = false,
1525  ParsedType ObjectType = nullptr,
1526  bool IsCtorOrDtorName = false,
1527  bool WantNontrivialTypeSourceInfo = false,
1528  IdentifierInfo **CorrectedII = nullptr);
1530  bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
1532  SourceLocation IILoc,
1533  Scope *S,
1534  CXXScopeSpec *SS,
1535  ParsedType &SuggestedType,
1536  bool AllowClassTemplates = false);
1537 
1538  /// Attempt to behave like MSVC in situations where lookup of an unqualified
1539  /// type name has failed in a dependent context. In these situations, we
1540  /// automatically form a DependentTypeName that will retry lookup in a related
1541  /// scope during instantiation.
1543  SourceLocation NameLoc,
1544  bool IsTemplateTypeArg);
1545 
1546  /// \brief Describes the result of the name lookup and resolution performed
1547  /// by \c ClassifyName().
1558  };
1559 
1562  ExprResult Expr;
1563  TemplateName Template;
1564  ParsedType Type;
1565  const IdentifierInfo *Keyword;
1566 
1567  explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
1568 
1569  public:
1571 
1572  NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {}
1573 
1575  : Kind(NC_Keyword), Keyword(Keyword) { }
1576 
1578  return NameClassification(NC_Error);
1579  }
1580 
1583  }
1584 
1587  }
1588 
1591  Result.Template = Name;
1592  return Result;
1593  }
1594 
1597  Result.Template = Name;
1598  return Result;
1599  }
1600 
1603  Result.Template = Name;
1604  return Result;
1605  }
1606 
1608 
1610  assert(Kind == NC_Type);
1611  return Type;
1612  }
1613 
1615  assert(Kind == NC_Expression);
1616  return Expr;
1617  }
1618 
1620  assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
1621  Kind == NC_VarTemplate);
1622  return Template;
1623  }
1624 
1626  switch (Kind) {
1627  case NC_TypeTemplate:
1628  return TNK_Type_template;
1629  case NC_FunctionTemplate:
1630  return TNK_Function_template;
1631  case NC_VarTemplate:
1632  return TNK_Var_template;
1633  default:
1634  llvm_unreachable("unsupported name classification.");
1635  }
1636  }
1637  };
1638 
1639  /// \brief Perform name lookup on the given name, classifying it based on
1640  /// the results of name lookup and the following token.
1641  ///
1642  /// This routine is used by the parser to resolve identifiers and help direct
1643  /// parsing. When the identifier cannot be found, this routine will attempt
1644  /// to correct the typo and classify based on the resulting name.
1645  ///
1646  /// \param S The scope in which we're performing name lookup.
1647  ///
1648  /// \param SS The nested-name-specifier that precedes the name.
1649  ///
1650  /// \param Name The identifier. If typo correction finds an alternative name,
1651  /// this pointer parameter will be updated accordingly.
1652  ///
1653  /// \param NameLoc The location of the identifier.
1654  ///
1655  /// \param NextToken The token following the identifier. Used to help
1656  /// disambiguate the name.
1657  ///
1658  /// \param IsAddressOfOperand True if this name is the operand of a unary
1659  /// address of ('&') expression, assuming it is classified as an
1660  /// expression.
1661  ///
1662  /// \param CCC The correction callback, if typo correction is desired.
1663  NameClassification
1665  SourceLocation NameLoc, const Token &NextToken,
1666  bool IsAddressOfOperand,
1667  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr);
1668 
1670 
1672  MultiTemplateParamsArg TemplateParameterLists);
1677  SourceLocation Loc);
1678  void
1679  diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
1680  SourceLocation FallbackLoc,
1681  SourceLocation ConstQualLoc = SourceLocation(),
1682  SourceLocation VolatileQualLoc = SourceLocation(),
1683  SourceLocation RestrictQualLoc = SourceLocation(),
1684  SourceLocation AtomicQualLoc = SourceLocation(),
1685  SourceLocation UnalignedQualLoc = SourceLocation());
1686 
1687  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
1688  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
1689  void CheckShadow(Scope *S, VarDecl *D, const LookupResult& R);
1690  void CheckShadow(Scope *S, VarDecl *D);
1691 
1692  /// Warn if 'E', which is an expression that is about to be modified, refers
1693  /// to a shadowing declaration.
1695 
1696 private:
1697  /// Map of current shadowing declarations to shadowed declarations. Warn if
1698  /// it looks like the user is trying to modify the shadowing declaration.
1699  llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
1700 
1701 public:
1702  void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
1703  void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
1704  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
1705  TypedefNameDecl *NewTD);
1708  TypeSourceInfo *TInfo,
1711  LookupResult &Previous, bool &Redeclaration);
1713  TypeSourceInfo *TInfo,
1715  MultiTemplateParamsArg TemplateParamLists,
1716  bool &AddToScope);
1717  // Returns true if the variable declaration is a redeclaration
1722 
1724  TypeSourceInfo *TInfo,
1726  MultiTemplateParamsArg TemplateParamLists,
1727  bool &AddToScope);
1729 
1730  bool CheckConstexprFunctionDecl(const FunctionDecl *FD);
1731  bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body);
1732 
1735  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1737  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1738  // Returns true if the function declaration is a redeclaration
1741  bool IsExplicitSpecialization);
1742  void CheckMain(FunctionDecl *FD, const DeclSpec &D);
1746  SourceLocation Loc,
1747  QualType T);
1750  QualType T, TypeSourceInfo *TSInfo,
1751  StorageClass SC);
1752  void ActOnParamDefaultArgument(Decl *param,
1753  SourceLocation EqualLoc,
1754  Expr *defarg);
1756  SourceLocation EqualLoc,
1757  SourceLocation ArgLoc);
1758  void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
1759  bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
1760  SourceLocation EqualLoc);
1761 
1762  void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit,
1763  bool TypeMayContainAuto);
1764  void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto);
1765  void ActOnInitializerError(Decl *Dcl);
1766  void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
1767  void ActOnCXXForRangeDecl(Decl *D);
1769  IdentifierInfo *Ident,
1770  ParsedAttributes &Attrs,
1771  SourceLocation AttrEnd);
1772  void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
1773  void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
1774  void FinalizeDeclaration(Decl *D);
1776  ArrayRef<Decl *> Group);
1778  bool TypeMayContainAuto = true);
1779 
1780  /// Should be called on all declarations that might have attached
1781  /// documentation comments.
1782  void ActOnDocumentableDecl(Decl *D);
1784 
1786  SourceLocation LocAfterDecls);
1788  FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
1789  SkipBodyInfo *SkipBody = nullptr);
1791  MultiTemplateParamsArg TemplateParamLists,
1792  SkipBodyInfo *SkipBody = nullptr);
1794  SkipBodyInfo *SkipBody = nullptr);
1797  return D && isa<ObjCMethodDecl>(D);
1798  }
1799 
1800  /// \brief Determine whether we can delay parsing the body of a function or
1801  /// function template until it is used, assuming we don't care about emitting
1802  /// code for that function.
1803  ///
1804  /// This will be \c false if we may need the body of the function in the
1805  /// middle of parsing an expression (where it's impractical to switch to
1806  /// parsing a different function), for instance, if it's constexpr in C++11
1807  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
1808  bool canDelayFunctionBody(const Declarator &D);
1809 
1810  /// \brief Determine whether we can skip parsing the body of a function
1811  /// definition, assuming we don't care about analyzing its body or emitting
1812  /// code for that function.
1813  ///
1814  /// This will be \c false only if we may need the body of the function in
1815  /// order to parse the rest of the program (for instance, if it is
1816  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
1817  bool canSkipFunctionBody(Decl *D);
1818 
1821  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
1824 
1825  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
1826  /// attribute for which parsing is delayed.
1828 
1829  /// \brief Diagnose any unused parameters in the given sequence of
1830  /// ParmVarDecl pointers.
1832 
1833  /// \brief Diagnose whether the size of parameters or return value of a
1834  /// function or obj-c method definition is pass-by-value and larger than a
1835  /// specified threshold.
1836  void
1838  QualType ReturnTy, NamedDecl *D);
1839 
1840  void DiagnoseInvalidJumps(Stmt *Body);
1842  SourceLocation AsmLoc,
1843  SourceLocation RParenLoc);
1844 
1845  /// \brief Handle a C++11 empty-declaration and attribute-declaration.
1847  AttributeList *AttrList,
1848  SourceLocation SemiLoc);
1849 
1850  /// \brief The parser has processed a module import declaration.
1851  ///
1852  /// \param AtLoc The location of the '@' symbol, if any.
1853  ///
1854  /// \param ImportLoc The location of the 'import' keyword.
1855  ///
1856  /// \param Path The module access path.
1858  ModuleIdPath Path);
1859 
1860  /// \brief The parser has processed a module import translated from a
1861  /// #include or similar preprocessing directive.
1862  void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
1863 
1864  /// \brief The parsed has entered a submodule.
1865  void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
1866  /// \brief The parser has left a submodule.
1867  void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
1868 
1869  /// \brief Check if module import may be found in the current context,
1870  /// emit error if not.
1872 
1873  /// \brief Create an implicit import of the given module at the given
1874  /// source location, for error recovery, if possible.
1875  ///
1876  /// This routine is typically used when an entity found by name lookup
1877  /// is actually hidden within a module that we know about but the user
1878  /// has forgotten to import.
1880  Module *Mod);
1881 
1882  /// Kinds of missing import. Note, the values of these enumerators correspond
1883  /// to %select values in diagnostics.
1884  enum class MissingImportKind {
1885  Declaration,
1886  Definition,
1887  DefaultArgument,
1888  ExplicitSpecialization,
1889  PartialSpecialization
1890  };
1891 
1892  /// \brief Diagnose that the specified declaration needs to be visible but
1893  /// isn't, and suggest a module import that would resolve the problem.
1895  MissingImportKind MIK, bool Recover = true);
1897  SourceLocation DeclLoc, ArrayRef<Module *> Modules,
1898  MissingImportKind MIK, bool Recover);
1899 
1900  /// \brief We've found a use of a templated declaration that would trigger an
1901  /// implicit instantiation. Check that any relevant explicit specializations
1902  /// and partial specializations are visible, and diagnose if not.
1904 
1905  /// \brief We've found a use of a template specialization that would select a
1906  /// partial specialization. Check that the partial specialization is visible,
1907  /// and diagnose if not.
1909  NamedDecl *Spec);
1910 
1911  /// \brief Retrieve a suitable printing policy.
1913  return getPrintingPolicy(Context, PP);
1914  }
1915 
1916  /// \brief Retrieve a suitable printing policy.
1917  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
1918  const Preprocessor &PP);
1919 
1920  /// Scope actions.
1921  void ActOnPopScope(SourceLocation Loc, Scope *S);
1923 
1925  RecordDecl *&AnonRecord);
1927  MultiTemplateParamsArg TemplateParams,
1928  bool IsExplicitInstantiation,
1929  RecordDecl *&AnonRecord);
1930 
1932  AccessSpecifier AS,
1933  RecordDecl *Record,
1934  const PrintingPolicy &Policy);
1935 
1937  RecordDecl *Record);
1938 
1940  TagTypeKind NewTag, bool isDefinition,
1941  SourceLocation NewTagLoc,
1942  const IdentifierInfo *Name);
1943 
1944  enum TagUseKind {
1945  TUK_Reference, // Reference to a tag: 'struct foo *X;'
1946  TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
1947  TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
1948  TUK_Friend // Friend declaration: 'friend struct foo;'
1949  };
1950 
1951  Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
1952  SourceLocation KWLoc, CXXScopeSpec &SS,
1955  SourceLocation ModulePrivateLoc,
1956  MultiTemplateParamsArg TemplateParameterLists,
1957  bool &OwnedDecl, bool &IsDependent,
1958  SourceLocation ScopedEnumKWLoc,
1959  bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
1960  bool IsTypeSpecifier, SkipBodyInfo *SkipBody = nullptr);
1961 
1963  unsigned TagSpec, SourceLocation TagLoc,
1964  CXXScopeSpec &SS,
1967  MultiTemplateParamsArg TempParamLists);
1968 
1970  unsigned TagSpec,
1971  TagUseKind TUK,
1972  const CXXScopeSpec &SS,
1974  SourceLocation TagLoc,
1975  SourceLocation NameLoc);
1976 
1977  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
1978  IdentifierInfo *ClassName,
1979  SmallVectorImpl<Decl *> &Decls);
1980  Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
1981  Declarator &D, Expr *BitfieldWidth);
1982 
1983  FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
1984  Declarator &D, Expr *BitfieldWidth,
1985  InClassInitStyle InitStyle,
1986  AccessSpecifier AS);
1988  SourceLocation DeclStart,
1989  Declarator &D, Expr *BitfieldWidth,
1990  InClassInitStyle InitStyle,
1991  AccessSpecifier AS,
1992  AttributeList *MSPropertyAttr);
1993 
1995  TypeSourceInfo *TInfo,
1996  RecordDecl *Record, SourceLocation Loc,
1997  bool Mutable, Expr *BitfieldWidth,
1998  InClassInitStyle InitStyle,
1999  SourceLocation TSSL,
2000  AccessSpecifier AS, NamedDecl *PrevDecl,
2001  Declarator *D = nullptr);
2002 
2003  bool CheckNontrivialField(FieldDecl *FD);
2004  void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
2006  bool Diagnose = false);
2008  void ActOnLastBitfield(SourceLocation DeclStart,
2009  SmallVectorImpl<Decl *> &AllIvarDecls);
2010  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
2011  Declarator &D, Expr *BitfieldWidth,
2012  tok::ObjCKeywordKind visibility);
2013 
2014  // This is used for both record definitions and ObjC interface declarations.
2015  void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl,
2016  ArrayRef<Decl *> Fields,
2017  SourceLocation LBrac, SourceLocation RBrac,
2018  AttributeList *AttrList);
2019 
2020  /// ActOnTagStartDefinition - Invoked when we have entered the
2021  /// scope of a tag's definition (e.g., for an enumeration, class,
2022  /// struct, or union).
2024 
2026 
2027  /// \brief Invoked when we enter a tag definition that we're skipping.
2029 
2031 
2032  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
2033  /// C++ record definition's base-specifiers clause and are starting its
2034  /// member declarations.
2036  SourceLocation FinalLoc,
2037  bool IsFinalSpelledSealed,
2038  SourceLocation LBraceLoc);
2039 
2040  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
2041  /// the definition of a tag (enumeration, class, struct, or union).
2043  SourceRange BraceRange);
2044 
2046 
2048 
2049  /// \brief Invoked when we must temporarily exit the objective-c container
2050  /// scope for parsing/looking-up C constructs.
2051  ///
2052  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
2055 
2056  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
2057  /// error parsing the definition of a tag.
2059 
2061  EnumConstantDecl *LastEnumConst,
2062  SourceLocation IdLoc,
2063  IdentifierInfo *Id,
2064  Expr *val);
2066  bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
2067  QualType EnumUnderlyingTy,
2068  bool EnumUnderlyingIsImplicit,
2069  const EnumDecl *Prev);
2070 
2071  /// Determine whether the body of an anonymous enumeration should be skipped.
2072  /// \param II The name of the first enumerator.
2074  SourceLocation IILoc);
2075 
2076  Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
2077  SourceLocation IdLoc, IdentifierInfo *Id,
2078  AttributeList *Attrs,
2079  SourceLocation EqualLoc, Expr *Val);
2080  void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
2081  Decl *EnumDecl,
2082  ArrayRef<Decl *> Elements,
2083  Scope *S, AttributeList *Attr);
2084 
2086 
2087  /// Set the current declaration context until it gets popped.
2088  void PushDeclContext(Scope *S, DeclContext *DC);
2089  void PopDeclContext();
2090 
2091  /// EnterDeclaratorContext - Used when we must lookup names in the context
2092  /// of a declarator's nested name specifier.
2094  void ExitDeclaratorContext(Scope *S);
2095 
2096  /// Push the parameters of D, which must be a function, into scope.
2098  void ActOnExitFunctionContext();
2099 
2101 
2102  /// getCurFunctionDecl - If inside of a function body, this returns a pointer
2103  /// to the function decl for the function being parsed. If we're currently
2104  /// in a 'block', this returns the containing context.
2106 
2107  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
2108  /// the method decl for the method being parsed. If we're currently
2109  /// in a 'block', this returns the containing context.
2111 
2112  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
2113  /// or C function we're in, otherwise return null. If we're currently
2114  /// in a 'block', this returns the containing context.
2116 
2117  /// Add this decl to the scope shadowed decl chains.
2118  void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
2119 
2120  /// \brief Make the given externally-produced declaration visible at the
2121  /// top level scope.
2122  ///
2123  /// \param D The externally-produced declaration to push.
2124  ///
2125  /// \param Name The name of the externally-produced declaration.
2127 
2128  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
2129  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
2130  /// true if 'D' belongs to the given declaration context.
2131  ///
2132  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
2133  /// enclosing namespace set of the context, rather than contained
2134  /// directly within it.
2135  bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
2136  bool AllowInlineNamespace = false);
2137 
2138  /// Finds the scope corresponding to the given decl context, if it
2139  /// happens to be an enclosing scope. Otherwise return NULL.
2141 
2142  /// Subroutines of ActOnDeclarator().
2144  TypeSourceInfo *TInfo);
2146 
2147  /// \brief Describes the kind of merge to perform for availability
2148  /// attributes (including "deprecated", "unavailable", and "availability").
2150  /// \brief Don't merge availability attributes at all.
2152  /// \brief Merge availability attributes for a redeclaration, which requires
2153  /// an exact match.
2155  /// \brief Merge availability attributes for an override, which requires
2156  /// an exact match or a weakening of constraints.
2158  /// \brief Merge availability attributes for an implementation of
2159  /// a protocol requirement.
2161  };
2162 
2163  /// Attribute merging methods. Return true if a new attribute was added.
2164  AvailabilityAttr *mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
2165  IdentifierInfo *Platform,
2166  bool Implicit,
2167  VersionTuple Introduced,
2168  VersionTuple Deprecated,
2169  VersionTuple Obsoleted,
2170  bool IsUnavailable,
2171  StringRef Message,
2172  bool IsStrict, StringRef Replacement,
2174  unsigned AttrSpellingListIndex);
2175  TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
2176  TypeVisibilityAttr::VisibilityType Vis,
2177  unsigned AttrSpellingListIndex);
2178  VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range,
2179  VisibilityAttr::VisibilityType Vis,
2180  unsigned AttrSpellingListIndex);
2181  DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
2182  unsigned AttrSpellingListIndex);
2183  DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
2184  unsigned AttrSpellingListIndex);
2185  MSInheritanceAttr *
2186  mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
2187  unsigned AttrSpellingListIndex,
2188  MSInheritanceAttr::Spelling SemanticSpelling);
2189  FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range,
2190  IdentifierInfo *Format, int FormatIdx,
2191  int FirstArg, unsigned AttrSpellingListIndex);
2192  SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
2193  unsigned AttrSpellingListIndex);
2194  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
2195  IdentifierInfo *Ident,
2196  unsigned AttrSpellingListIndex);
2197  MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
2198  unsigned AttrSpellingListIndex);
2199  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
2200  unsigned AttrSpellingListIndex);
2201  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, SourceRange Range,
2202  IdentifierInfo *Ident,
2203  unsigned AttrSpellingListIndex);
2204  CommonAttr *mergeCommonAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident,
2205  unsigned AttrSpellingListIndex);
2206 
2207  void mergeDeclAttributes(NamedDecl *New, Decl *Old,
2210  LookupResult &OldDecls);
2211  bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
2212  bool MergeTypeWithOld);
2214  Scope *S, bool MergeTypeWithOld);
2217  void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
2218  void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
2220 
2221  // AssignmentAction - This is used by all the assignment diagnostic functions
2222  // to represent what is actually causing the operation
2232  };
2233 
2234  /// C++ Overloading.
2236  /// This is a legitimate overload: the existing declarations are
2237  /// functions or function templates with different signatures.
2239 
2240  /// This is not an overload because the signature exactly matches
2241  /// an existing declaration.
2243 
2244  /// This is not an overload because the lookup results contain a
2245  /// non-function.
2247  };
2249  FunctionDecl *New,
2250  const LookupResult &OldDecls,
2251  NamedDecl *&OldDecl,
2252  bool IsForUsingDecl);
2253  bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl,
2254  bool ConsiderCudaAttrs = true);
2255 
2256  /// \brief Checks availability of the function depending on the current
2257  /// function context.Inside an unavailable function,unavailability is ignored.
2258  ///
2259  /// \returns true if \p FD is unavailable and current context is inside
2260  /// an available function, false otherwise.
2262 
2264  TryImplicitConversion(Expr *From, QualType ToType,
2265  bool SuppressUserConversions,
2266  bool AllowExplicit,
2267  bool InOverloadResolution,
2268  bool CStyle,
2269  bool AllowObjCWritebackConversion);
2270 
2271  bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
2272  bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
2273  bool IsComplexPromotion(QualType FromType, QualType ToType);
2274  bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
2275  bool InOverloadResolution,
2276  QualType& ConvertedType, bool &IncompatibleObjC);
2277  bool isObjCPointerConversion(QualType FromType, QualType ToType,
2278  QualType& ConvertedType, bool &IncompatibleObjC);
2279  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
2280  QualType &ConvertedType);
2281  bool IsBlockPointerConversion(QualType FromType, QualType ToType,
2282  QualType& ConvertedType);
2283  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
2284  const FunctionProtoType *NewType,
2285  unsigned *ArgPos = nullptr);
2287  QualType FromType, QualType ToType);
2288 
2291  bool CheckPointerConversion(Expr *From, QualType ToType,
2292  CastKind &Kind,
2293  CXXCastPath& BasePath,
2294  bool IgnoreBaseAccess,
2295  bool Diagnose = true);
2296  bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
2297  bool InOverloadResolution,
2298  QualType &ConvertedType);
2299  bool CheckMemberPointerConversion(Expr *From, QualType ToType,
2300  CastKind &Kind,
2301  CXXCastPath &BasePath,
2302  bool IgnoreBaseAccess);
2303  bool IsQualificationConversion(QualType FromType, QualType ToType,
2304  bool CStyle, bool &ObjCLifetimeConversion);
2305  bool IsNoReturnConversion(QualType FromType, QualType ToType,
2306  QualType &ResultTy);
2309 
2311  const VarDecl *NRVOCandidate,
2312  QualType ResultType,
2313  Expr *Value,
2314  bool AllowNRVO = true);
2315 
2317  ExprResult Init);
2319  SourceLocation EqualLoc,
2320  ExprResult Init,
2321  bool TopLevelOfInitList = false,
2322  bool AllowExplicit = false);
2324  NestedNameSpecifier *Qualifier,
2325  NamedDecl *FoundDecl,
2326  CXXMethodDecl *Method);
2327 
2330 
2331  /// Contexts in which a converted constant expression is required.
2332  enum CCEKind {
2333  CCEK_CaseValue, ///< Expression in a case label.
2334  CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
2335  CCEK_TemplateArg, ///< Value of a non-type template parameter.
2336  CCEK_NewExpr, ///< Constant expression in a noptr-new-declarator.
2337  CCEK_ConstexprIf ///< Condition in a constexpr if statement.
2338  };
2340  llvm::APSInt &Value, CCEKind CCE);
2342  APValue &Value, CCEKind CCE);
2343 
2344  /// \brief Abstract base class used to perform a contextual implicit
2345  /// conversion from an expression to any type passing a filter.
2347  public:
2348  bool Suppress;
2350 
2351  ContextualImplicitConverter(bool Suppress = false,
2352  bool SuppressConversion = false)
2353  : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
2354 
2355  /// \brief Determine whether the specified type is a valid destination type
2356  /// for this conversion.
2357  virtual bool match(QualType T) = 0;
2358 
2359  /// \brief Emits a diagnostic complaining that the expression does not have
2360  /// integral or enumeration type.
2361  virtual SemaDiagnosticBuilder
2362  diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) = 0;
2363 
2364  /// \brief Emits a diagnostic when the expression has incomplete class type.
2365  virtual SemaDiagnosticBuilder
2366  diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0;
2367 
2368  /// \brief Emits a diagnostic when the only matching conversion function
2369  /// is explicit.
2370  virtual SemaDiagnosticBuilder diagnoseExplicitConv(
2371  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2372 
2373  /// \brief Emits a note for the explicit conversion function.
2374  virtual SemaDiagnosticBuilder
2375  noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2376 
2377  /// \brief Emits a diagnostic when there are multiple possible conversion
2378  /// functions.
2379  virtual SemaDiagnosticBuilder
2380  diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) = 0;
2381 
2382  /// \brief Emits a note for one of the candidate conversions.
2383  virtual SemaDiagnosticBuilder
2384  noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2385 
2386  /// \brief Emits a diagnostic when we picked a conversion function
2387  /// (for cases when we are not allowed to pick a conversion function).
2388  virtual SemaDiagnosticBuilder diagnoseConversion(
2389  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2390 
2392  };
2393 
2395  bool AllowScopedEnumerations;
2396 
2397  public:
2398  ICEConvertDiagnoser(bool AllowScopedEnumerations,
2399  bool Suppress, bool SuppressConversion)
2400  : ContextualImplicitConverter(Suppress, SuppressConversion),
2401  AllowScopedEnumerations(AllowScopedEnumerations) {}
2402 
2403  /// Match an integral or (possibly scoped) enumeration type.
2404  bool match(QualType T) override;
2405 
2408  return diagnoseNotInt(S, Loc, T);
2409  }
2410 
2411  /// \brief Emits a diagnostic complaining that the expression does not have
2412  /// integral or enumeration type.
2413  virtual SemaDiagnosticBuilder
2414  diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0;
2415  };
2416 
2417  /// Perform a contextual implicit conversion.
2419  SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
2420 
2421 
2426  };
2428 
2429  // Note that LK_String is intentionally after the other literals, as
2430  // this is used for diagnostics logic.
2439  };
2441 
2443  NestedNameSpecifier *Qualifier,
2444  NamedDecl *FoundDecl,
2445  NamedDecl *Member);
2446 
2447  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
2448  // TODO: make this is a typesafe union.
2451 
2452  void AddOverloadCandidate(FunctionDecl *Function,
2453  DeclAccessPair FoundDecl,
2454  ArrayRef<Expr *> Args,
2455  OverloadCandidateSet& CandidateSet,
2456  bool SuppressUserConversions = false,
2457  bool PartialOverloading = false,
2458  bool AllowExplicit = false);
2459  void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
2460  ArrayRef<Expr *> Args,
2461  OverloadCandidateSet &CandidateSet,
2462  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
2463  bool SuppressUserConversions = false,
2464  bool PartialOverloading = false);
2465  void AddMethodCandidate(DeclAccessPair FoundDecl,
2466  QualType ObjectType,
2467  Expr::Classification ObjectClassification,
2468  ArrayRef<Expr *> Args,
2469  OverloadCandidateSet& CandidateSet,
2470  bool SuppressUserConversion = false);
2471  void AddMethodCandidate(CXXMethodDecl *Method,
2472  DeclAccessPair FoundDecl,
2473  CXXRecordDecl *ActingContext, QualType ObjectType,
2474  Expr::Classification ObjectClassification,
2475  ArrayRef<Expr *> Args,
2476  OverloadCandidateSet& CandidateSet,
2477  bool SuppressUserConversions = false,
2478  bool PartialOverloading = false);
2480  DeclAccessPair FoundDecl,
2481  CXXRecordDecl *ActingContext,
2482  TemplateArgumentListInfo *ExplicitTemplateArgs,
2483  QualType ObjectType,
2484  Expr::Classification ObjectClassification,
2485  ArrayRef<Expr *> Args,
2486  OverloadCandidateSet& CandidateSet,
2487  bool SuppressUserConversions = false,
2488  bool PartialOverloading = false);
2489  void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
2490  DeclAccessPair FoundDecl,
2491  TemplateArgumentListInfo *ExplicitTemplateArgs,
2492  ArrayRef<Expr *> Args,
2493  OverloadCandidateSet& CandidateSet,
2494  bool SuppressUserConversions = false,
2495  bool PartialOverloading = false);
2496  void AddConversionCandidate(CXXConversionDecl *Conversion,
2497  DeclAccessPair FoundDecl,
2498  CXXRecordDecl *ActingContext,
2499  Expr *From, QualType ToType,
2500  OverloadCandidateSet& CandidateSet,
2501  bool AllowObjCConversionOnExplicit);
2503  DeclAccessPair FoundDecl,
2504  CXXRecordDecl *ActingContext,
2505  Expr *From, QualType ToType,
2506  OverloadCandidateSet &CandidateSet,
2507  bool AllowObjCConversionOnExplicit);
2508  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
2509  DeclAccessPair FoundDecl,
2510  CXXRecordDecl *ActingContext,
2511  const FunctionProtoType *Proto,
2512  Expr *Object, ArrayRef<Expr *> Args,
2513  OverloadCandidateSet& CandidateSet);
2515  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2516  OverloadCandidateSet& CandidateSet,
2517  SourceRange OpRange = SourceRange());
2518  void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
2519  ArrayRef<Expr *> Args,
2520  OverloadCandidateSet& CandidateSet,
2521  bool IsAssignmentOperator = false,
2522  unsigned NumContextualBoolArguments = 0);
2524  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2525  OverloadCandidateSet& CandidateSet);
2527  SourceLocation Loc,
2528  ArrayRef<Expr *> Args,
2529  TemplateArgumentListInfo *ExplicitTemplateArgs,
2530  OverloadCandidateSet& CandidateSet,
2531  bool PartialOverloading = false);
2532 
2533  // Emit as a 'note' the specific overload candidate
2534  void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn,
2535  QualType DestType = QualType(),
2536  bool TakingAddress = false);
2537 
2538  // Emit as a series of 'note's all template and non-templates identified by
2539  // the expression Expr
2540  void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
2541  bool TakingAddress = false);
2542 
2543  /// Check the enable_if expressions on the given function. Returns the first
2544  /// failing attribute, or NULL if they were all successful.
2545  EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
2546  bool MissingImplicitThis = false);
2547 
2548  /// Returns whether the given function's address can be taken or not,
2549  /// optionally emitting a diagnostic if the address can't be taken.
2550  ///
2551  /// Returns false if taking the address of the function is illegal.
2552  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
2553  bool Complain = false,
2554  SourceLocation Loc = SourceLocation());
2555 
2556  // [PossiblyAFunctionType] --> [Return]
2557  // NonFunctionType --> NonFunctionType
2558  // R (A) --> R(A)
2559  // R (*)(A) --> R (A)
2560  // R (&)(A) --> R (A)
2561  // R (S::*)(A) --> R (A)
2562  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
2563 
2564  FunctionDecl *
2566  QualType TargetType,
2567  bool Complain,
2568  DeclAccessPair &Found,
2569  bool *pHadMultipleCandidates = nullptr);
2570 
2571  FunctionDecl *
2573  DeclAccessPair &FoundResult);
2574 
2576 
2577  FunctionDecl *
2579  bool Complain = false,
2580  DeclAccessPair *Found = nullptr);
2581 
2583  ExprResult &SrcExpr,
2584  bool DoFunctionPointerConverion = false,
2585  bool Complain = false,
2586  SourceRange OpRangeForComplaining = SourceRange(),
2587  QualType DestTypeForComplaining = QualType(),
2588  unsigned DiagIDForComplaining = 0);
2589 
2590 
2592  DeclAccessPair FoundDecl,
2593  FunctionDecl *Fn);
2595  DeclAccessPair FoundDecl,
2596  FunctionDecl *Fn);
2597 
2599  ArrayRef<Expr *> Args,
2600  OverloadCandidateSet &CandidateSet,
2601  bool PartialOverloading = false);
2602 
2603  // An enum used to represent the different possible results of building a
2604  // range-based for loop.
2609  };
2610 
2612  SourceLocation RangeLoc,
2613  const DeclarationNameInfo &NameInfo,
2614  LookupResult &MemberLookup,
2615  OverloadCandidateSet *CandidateSet,
2616  Expr *Range, ExprResult *CallExpr);
2617 
2619  UnresolvedLookupExpr *ULE,
2620  SourceLocation LParenLoc,
2621  MultiExprArg Args,
2622  SourceLocation RParenLoc,
2623  Expr *ExecConfig,
2624  bool AllowTypoCorrection=true,
2625  bool CalleesAddressIsTaken=false);
2626 
2628  MultiExprArg Args, SourceLocation RParenLoc,
2629  OverloadCandidateSet *CandidateSet,
2630  ExprResult *Result);
2631 
2633  UnaryOperatorKind Opc,
2634  const UnresolvedSetImpl &Fns,
2635  Expr *input);
2636 
2638  BinaryOperatorKind Opc,
2639  const UnresolvedSetImpl &Fns,
2640  Expr *LHS, Expr *RHS);
2641 
2643  SourceLocation RLoc,
2644  Expr *Base,Expr *Idx);
2645 
2646  ExprResult
2648  SourceLocation LParenLoc,
2649  MultiExprArg Args,
2650  SourceLocation RParenLoc);
2651  ExprResult
2653  MultiExprArg Args,
2654  SourceLocation RParenLoc);
2655 
2657  SourceLocation OpLoc,
2658  bool *NoArrowOperatorFound = nullptr);
2659 
2660  /// CheckCallReturnType - Checks that a call expression's return type is
2661  /// complete. Returns true on failure. The location passed in is the location
2662  /// that best represents the call.
2663  bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
2664  CallExpr *CE, FunctionDecl *FD);
2665 
2666  /// Helpers for dealing with blocks and functions.
2668  bool CheckParameterNames);
2672 
2673  /// \name Name lookup
2674  ///
2675  /// These routines provide name lookup that is used during semantic
2676  /// analysis to resolve the various kinds of names (identifiers,
2677  /// overloaded operator names, constructor names, etc.) into zero or
2678  /// more declarations within a particular scope. The major entry
2679  /// points are LookupName, which performs unqualified name lookup,
2680  /// and LookupQualifiedName, which performs qualified name lookup.
2681  ///
2682  /// All name lookup is performed based on some specific criteria,
2683  /// which specify what names will be visible to name lookup and how
2684  /// far name lookup should work. These criteria are important both
2685  /// for capturing language semantics (certain lookups will ignore
2686  /// certain names, for example) and for performance, since name
2687  /// lookup is often a bottleneck in the compilation of C++. Name
2688  /// lookup criteria is specified via the LookupCriteria enumeration.
2689  ///
2690  /// The results of name lookup can vary based on the kind of name
2691  /// lookup performed, the current language, and the translation
2692  /// unit. In C, for example, name lookup will either return nothing
2693  /// (no entity found) or a single declaration. In C++, name lookup
2694  /// can additionally refer to a set of overloaded functions or
2695  /// result in an ambiguity. All of the possible results of name
2696  /// lookup are captured by the LookupResult class, which provides
2697  /// the ability to distinguish among them.
2698  //@{
2699 
2700  /// @brief Describes the kind of name lookup to perform.
2702  /// Ordinary name lookup, which finds ordinary names (functions,
2703  /// variables, typedefs, etc.) in C and most kinds of names
2704  /// (functions, variables, members, types, etc.) in C++.
2706  /// Tag name lookup, which finds the names of enums, classes,
2707  /// structs, and unions.
2709  /// Label name lookup.
2711  /// Member name lookup, which finds the names of
2712  /// class/struct/union members.
2714  /// Look up of an operator name (e.g., operator+) for use with
2715  /// operator overloading. This lookup is similar to ordinary name
2716  /// lookup, but will ignore any declarations that are class members.
2718  /// Look up of a name that precedes the '::' scope resolution
2719  /// operator in C++. This lookup completely ignores operator, object,
2720  /// function, and enumerator names (C++ [basic.lookup.qual]p1).
2722  /// Look up a namespace name within a C++ using directive or
2723  /// namespace alias definition, ignoring non-namespace names (C++
2724  /// [basic.lookup.udir]p1).
2726  /// Look up all declarations in a scope with the given name,
2727  /// including resolved using declarations. This is appropriate
2728  /// for checking redeclarations for a using declaration.
2730  /// Look up an ordinary name that is going to be redeclared as a
2731  /// name with linkage. This lookup ignores any declarations that
2732  /// are outside of the current scope unless they have linkage. See
2733  /// C99 6.2.2p4-5 and C++ [basic.link]p6.
2735  /// Look up a friend of a local class. This lookup does not look
2736  /// outside the innermost non-class scope. See C++11 [class.friend]p11.
2738  /// Look up the name of an Objective-C protocol.
2740  /// Look up implicit 'self' parameter of an objective-c method.
2742  /// \brief Look up the name of an OpenMP user-defined reduction operation.
2744  /// \brief Look up any declaration with any name.
2746  };
2747 
2748  /// \brief Specifies whether (or how) name lookup is being performed for a
2749  /// redeclaration (vs. a reference).
2751  /// \brief The lookup is a reference to this name that is not for the
2752  /// purpose of redeclaring the name.
2754  /// \brief The lookup results will be used for redeclaration of a name,
2755  /// if an entity by that name already exists.
2757  };
2758 
2759  /// \brief The possible outcomes of name lookup for a literal operator.
2761  /// \brief The lookup resulted in an error.
2763  /// \brief The lookup found a single 'cooked' literal operator, which
2764  /// expects a normal literal to be built and passed to it.
2766  /// \brief The lookup found a single 'raw' literal operator, which expects
2767  /// a string literal containing the spelling of the literal token.
2769  /// \brief The lookup found an overload set of literal operator templates,
2770  /// which expect the characters of the spelling of the literal token to be
2771  /// passed as a non-type template argument pack.
2773  /// \brief The lookup found an overload set of literal operator templates,
2774  /// which expect the character type and characters of the spelling of the
2775  /// string literal token to be passed as template arguments.
2777  };
2778 
2779  SpecialMemberOverloadResult *LookupSpecialMember(CXXRecordDecl *D,
2781  bool ConstArg,
2782  bool VolatileArg,
2783  bool RValueThis,
2784  bool ConstThis,
2785  bool VolatileThis);
2786 
2787  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
2788  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
2790 
2791 private:
2792  bool CppLookupName(LookupResult &R, Scope *S);
2793 
2794  struct TypoExprState {
2795  std::unique_ptr<TypoCorrectionConsumer> Consumer;
2796  TypoDiagnosticGenerator DiagHandler;
2797  TypoRecoveryCallback RecoveryHandler;
2798  TypoExprState();
2799  TypoExprState(TypoExprState&& other) LLVM_NOEXCEPT;
2800  TypoExprState& operator=(TypoExprState&& other) LLVM_NOEXCEPT;
2801  };
2802 
2803  /// \brief The set of unhandled TypoExprs and their associated state.
2804  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
2805 
2806  /// \brief Creates a new TypoExpr AST node.
2807  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
2809  TypoRecoveryCallback TRC);
2810 
2811  // \brief The set of known/encountered (unique, canonicalized) NamespaceDecls.
2812  //
2813  // The boolean value will be true to indicate that the namespace was loaded
2814  // from an AST/PCH file, or false otherwise.
2815  llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
2816 
2817  /// \brief Whether we have already loaded known namespaces from an extenal
2818  /// source.
2819  bool LoadedExternalKnownNamespaces;
2820 
2821  /// \brief Helper for CorrectTypo and CorrectTypoDelayed used to create and
2822  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
2823  /// should be skipped entirely.
2824  std::unique_ptr<TypoCorrectionConsumer>
2825  makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
2826  Sema::LookupNameKind LookupKind, Scope *S,
2827  CXXScopeSpec *SS,
2828  std::unique_ptr<CorrectionCandidateCallback> CCC,
2829  DeclContext *MemberContext, bool EnteringContext,
2830  const ObjCObjectPointerType *OPT,
2831  bool ErrorRecovery);
2832 
2833 public:
2834  const TypoExprState &getTypoExprState(TypoExpr *TE) const;
2835 
2836  /// \brief Clears the state of the given TypoExpr.
2837  void clearDelayedTypo(TypoExpr *TE);
2838 
2839  /// \brief Look up a name, looking for a single declaration. Return
2840  /// null if the results were absent, ambiguous, or overloaded.
2841  ///
2842  /// It is preferable to use the elaborated form and explicitly handle
2843  /// ambiguity and overloaded.
2845  SourceLocation Loc,
2846  LookupNameKind NameKind,
2847  RedeclarationKind Redecl
2849  bool LookupName(LookupResult &R, Scope *S,
2850  bool AllowBuiltinCreation = false);
2851  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2852  bool InUnqualifiedLookup = false);
2853  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2854  CXXScopeSpec &SS);
2856  bool AllowBuiltinCreation = false,
2857  bool EnteringContext = false);
2859  RedeclarationKind Redecl
2860  = NotForRedeclaration);
2861  bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
2862 
2864  QualType T1, QualType T2,
2865  UnresolvedSetImpl &Functions);
2867  DeclAccessPair Operator,
2868  QualType T1, QualType T2);
2869 
2871  SourceLocation GnuLabelLoc = SourceLocation());
2872 
2876  unsigned Quals);
2877  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
2878  bool RValueThis, unsigned ThisQuals);
2880  unsigned Quals);
2881  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
2882  bool RValueThis, unsigned ThisQuals);
2884 
2885  bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id);
2887  ArrayRef<QualType> ArgTys,
2888  bool AllowRaw,
2889  bool AllowTemplate,
2890  bool AllowStringTemplate);
2891  bool isKnownName(StringRef name);
2892 
2893  void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
2894  ArrayRef<Expr *> Args, ADLResult &Functions);
2895 
2898  bool IncludeGlobalScope = true);
2900  VisibleDeclConsumer &Consumer,
2901  bool IncludeGlobalScope = true);
2902 
2904  CTK_NonError, // CorrectTypo used in a non error recovery situation.
2905  CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
2906  };
2907 
2909  Sema::LookupNameKind LookupKind,
2910  Scope *S, CXXScopeSpec *SS,
2911  std::unique_ptr<CorrectionCandidateCallback> CCC,
2912  CorrectTypoKind Mode,
2913  DeclContext *MemberContext = nullptr,
2914  bool EnteringContext = false,
2915  const ObjCObjectPointerType *OPT = nullptr,
2916  bool RecordFailure = true);
2917 
2919  Sema::LookupNameKind LookupKind, Scope *S,
2920  CXXScopeSpec *SS,
2921  std::unique_ptr<CorrectionCandidateCallback> CCC,
2924  DeclContext *MemberContext = nullptr,
2925  bool EnteringContext = false,
2926  const ObjCObjectPointerType *OPT = nullptr);
2927 
2928  /// \brief Process any TypoExprs in the given Expr and its children,
2929  /// generating diagnostics as appropriate and returning a new Expr if there
2930  /// were typos that were all successfully corrected and ExprError if one or
2931  /// more typos could not be corrected.
2932  ///
2933  /// \param E The Expr to check for TypoExprs.
2934  ///
2935  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
2936  /// initializer.
2937  ///
2938  /// \param Filter A function applied to a newly rebuilt Expr to determine if
2939  /// it is an acceptable/usable result from a single combination of typo
2940  /// corrections. As long as the filter returns ExprError, different
2941  /// combinations of corrections will be tried until all are exhausted.
2942  ExprResult
2943  CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl = nullptr,
2944  llvm::function_ref<ExprResult(Expr *)> Filter =
2945  [](Expr *E) -> ExprResult { return E; });
2946 
2947  ExprResult
2949  llvm::function_ref<ExprResult(Expr *)> Filter) {
2950  return CorrectDelayedTyposInExpr(E, nullptr, Filter);
2951  }
2952 
2953  ExprResult
2955  llvm::function_ref<ExprResult(Expr *)> Filter =
2956  [](Expr *E) -> ExprResult { return E; }) {
2957  return ER.isInvalid() ? ER : CorrectDelayedTyposInExpr(ER.get(), Filter);
2958  }
2959 
2960  ExprResult
2962  llvm::function_ref<ExprResult(Expr *)> Filter) {
2963  return CorrectDelayedTyposInExpr(ER, nullptr, Filter);
2964  }
2965 
2966  void diagnoseTypo(const TypoCorrection &Correction,
2967  const PartialDiagnostic &TypoDiag,
2968  bool ErrorRecovery = true);
2969 
2970  void diagnoseTypo(const TypoCorrection &Correction,
2971  const PartialDiagnostic &TypoDiag,
2972  const PartialDiagnostic &PrevNote,
2973  bool ErrorRecovery = true);
2974 
2975  void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
2976  ArrayRef<Expr *> Args,
2977  AssociatedNamespaceSet &AssociatedNamespaces,
2978  AssociatedClassSet &AssociatedClasses);
2979 
2981  bool ConsiderLinkage, bool AllowInlineNamespace);
2982 
2984  //@}
2985 
2987  SourceLocation IdLoc,
2988  bool TypoCorrection = false);
2990  Scope *S, bool ForRedeclaration,
2991  SourceLocation Loc);
2993  Scope *S);
2995 
2996  // More parsing and symbol table subroutines.
2997 
2998  void ProcessPragmaWeak(Scope *S, Decl *D);
2999  // Decl attributes - this routine is the top level dispatcher.
3000  void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
3001  void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL,
3002  bool IncludeCXX11Attributes = true);
3004  const AttributeList *AttrList);
3005 
3007 
3008  /// Determine if type T is a valid subject for a nonnull and similar
3009  /// attributes. By default, we look through references (the behavior used by
3010  /// nonnull), but if the second parameter is true, then we treat a reference
3011  /// type as valid.
3012  bool isValidPointerAttrType(QualType T, bool RefOkay = false);
3013 
3014  bool CheckRegparmAttr(const AttributeList &attr, unsigned &value);
3015  bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
3016  const FunctionDecl *FD = nullptr);
3017  bool CheckNoReturnAttr(const AttributeList &attr);
3019  unsigned ArgNum, StringRef &Str,
3020  SourceLocation *ArgLocation = nullptr);
3021  bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
3022  void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
3024  CXXRecordDecl *RD, SourceRange Range, bool BestCase,
3025  MSInheritanceAttr::Spelling SemanticSpelling);
3026 
3028 
3029  /// Adjust the calling convention of a method to be the ABI default if it
3030  /// wasn't specified explicitly. This handles method types formed from
3031  /// function type typedefs and typename template arguments.
3032  void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
3033  SourceLocation Loc);
3034 
3035  // Check if there is an explicit attribute, but only look through parens.
3036  // The intent is to look for an attribute on the current declarator, but not
3037  // one that came from a typedef.
3039 
3040  /// Get the outermost AttributedType node that sets a calling convention.
3041  /// Valid types should not have multiple attributes with different CCs.
3043 
3044  /// Check whether a nullability type specifier can be added to the given
3045  /// type.
3046  ///
3047  /// \param type The type to which the nullability specifier will be
3048  /// added. On success, this type will be updated appropriately.
3049  ///
3050  /// \param nullability The nullability specifier to add.
3051  ///
3052  /// \param nullabilityLoc The location of the nullability specifier.
3053  ///
3054  /// \param isContextSensitive Whether this nullability specifier was
3055  /// written as a context-sensitive keyword (in an Objective-C
3056  /// method) or an Objective-C property attribute, rather than as an
3057  /// underscored type specifier.
3058  ///
3059  /// \returns true if nullability cannot be applied, false otherwise.
3061  SourceLocation nullabilityLoc,
3062  bool isContextSensitive);
3063 
3064  /// \brief Stmt attributes - this routine is the top level dispatcher.
3066  SourceRange Range);
3067 
3069  ObjCMethodDecl *MethodDecl,
3070  bool IsProtocolMethodDecl);
3071 
3073  ObjCMethodDecl *Overridden,
3074  bool IsProtocolMethodDecl);
3075 
3076  /// WarnExactTypedMethods - This routine issues a warning if method
3077  /// implementation declaration matches exactly that of its declaration.
3079  ObjCMethodDecl *MethodDecl,
3080  bool IsProtocolMethodDecl);
3081 
3082  typedef llvm::SmallPtrSet<Selector, 8> SelectorSet;
3083  typedef llvm::DenseMap<Selector, ObjCMethodDecl*> ProtocolsMethodsMap;
3084 
3085  /// CheckImplementationIvars - This routine checks if the instance variables
3086  /// listed in the implelementation match those listed in the interface.
3088  ObjCIvarDecl **Fields, unsigned nIvars,
3089  SourceLocation Loc);
3090 
3091  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
3092  /// remains unimplemented in the class or category \@implementation.
3094  ObjCContainerDecl* IDecl,
3095  bool IncompleteImpl = false);
3096 
3097  /// DiagnoseUnimplementedProperties - This routine warns on those properties
3098  /// which must be implemented by this implementation.
3100  ObjCContainerDecl *CDecl,
3101  bool SynthesizeProperties);
3102 
3103  /// Diagnose any null-resettable synthesized setters.
3105 
3106  /// DefaultSynthesizeProperties - This routine default synthesizes all
3107  /// properties which must be synthesized in the class's \@implementation.
3109  ObjCInterfaceDecl *IDecl);
3111 
3112  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
3113  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
3114  /// declared in class 'IFace'.
3116  ObjCMethodDecl *Method, ObjCIvarDecl *IV);
3117 
3118  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
3119  /// backs the property is not used in the property's accessor.
3121  const ObjCImplementationDecl *ImplD);
3122 
3123  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
3124  /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
3125  /// It also returns ivar's property on success.
3127  const ObjCPropertyDecl *&PDecl) const;
3128 
3129  /// Called by ActOnProperty to handle \@property declarations in
3130  /// class extensions.
3132  SourceLocation AtLoc,
3133  SourceLocation LParenLoc,
3134  FieldDeclarator &FD,
3135  Selector GetterSel,
3136  Selector SetterSel,
3137  const bool isReadWrite,
3138  unsigned &Attributes,
3139  const unsigned AttributesAsWritten,
3140  QualType T,
3141  TypeSourceInfo *TSI,
3142  tok::ObjCKeywordKind MethodImplKind);
3143 
3144  /// Called by ActOnProperty and HandlePropertyInClassExtension to
3145  /// handle creating the ObjcPropertyDecl for a category or \@interface.
3147  ObjCContainerDecl *CDecl,
3148  SourceLocation AtLoc,
3149  SourceLocation LParenLoc,
3150  FieldDeclarator &FD,
3151  Selector GetterSel,
3152  Selector SetterSel,
3153  const bool isReadWrite,
3154  const unsigned Attributes,
3155  const unsigned AttributesAsWritten,
3156  QualType T,
3157  TypeSourceInfo *TSI,
3158  tok::ObjCKeywordKind MethodImplKind,
3159  DeclContext *lexicalDC = nullptr);
3160 
3161  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
3162  /// warning) when atomic property has one but not the other user-declared
3163  /// setter or getter.
3165  ObjCInterfaceDecl* IDecl);
3166 
3168 
3170  const ObjCImplementationDecl *ImplD,
3171  const ObjCInterfaceDecl *IFD);
3172 
3174 
3178  };
3179 
3180  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
3181  /// true, or false, accordingly.
3182  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
3183  const ObjCMethodDecl *PrevMethod,
3184  MethodMatchStrategy strategy = MMS_strict);
3185 
3186  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
3187  /// or protocol against those declared in their implementations.
3188  void MatchAllMethodDeclarations(const SelectorSet &InsMap,
3189  const SelectorSet &ClsMap,
3190  SelectorSet &InsMapSeen,
3191  SelectorSet &ClsMapSeen,
3192  ObjCImplDecl* IMPDecl,
3193  ObjCContainerDecl* IDecl,
3194  bool &IncompleteImpl,
3195  bool ImmediateClass,
3196  bool WarnCategoryMethodImpl=false);
3197 
3198  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
3199  /// category matches with those implemented in its primary class and
3200  /// warns each time an exact match is found.
3202 
3203  /// \brief Add the given method to the list of globally-known methods.
3205 
3206 private:
3207  /// AddMethodToGlobalPool - Add an instance or factory method to the global
3208  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
3209  void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
3210 
3211  /// LookupMethodInGlobalPool - Returns the instance or factory method and
3212  /// optionally warns if there are multiple signatures.
3213  ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
3214  bool receiverIdOrClass,
3215  bool instance);
3216 
3217 public:
3218  /// \brief - Returns instance or factory methods in global method pool for
3219  /// given selector. It checks the desired kind first, if none is found, and
3220  /// parameter checkTheOther is set, it then checks the other kind. If no such
3221  /// method or only one method is found, function returns false; otherwise, it
3222  /// returns true.
3223  bool
3226  bool InstanceFirst, bool CheckTheOther,
3227  const ObjCObjectType *TypeBound = nullptr);
3228 
3229  bool
3231  SourceRange R, bool receiverIdOrClass,
3233 
3234  void
3236  Selector Sel, SourceRange R,
3237  bool receiverIdOrClass);
3238 
3239 private:
3240  /// \brief - Returns a selector which best matches given argument list or
3241  /// nullptr if none could be found
3242  ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
3243  bool IsInstance,
3245 
3246 
3247  /// \brief Record the typo correction failure and return an empty correction.
3248  TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
3249  bool RecordFailure = true) {
3250  if (RecordFailure)
3251  TypoCorrectionFailures[Typo].insert(TypoLoc);
3252  return TypoCorrection();
3253  }
3254 
3255 public:
3256  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
3257  /// unit are added to a global pool. This allows us to efficiently associate
3258  /// a selector with a method declaraation for purposes of typechecking
3259  /// messages sent to "id" (where the class of the object is unknown).
3260  void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3261  AddMethodToGlobalPool(Method, impl, /*instance*/true);
3262  }
3263 
3264  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
3265  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3266  AddMethodToGlobalPool(Method, impl, /*instance*/false);
3267  }
3268 
3269  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
3270  /// pool.
3271  void AddAnyMethodToGlobalPool(Decl *D);
3272 
3273  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
3274  /// there are multiple signatures.
3276  bool receiverIdOrClass=false) {
3277  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3278  /*instance*/true);
3279  }
3280 
3281  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
3282  /// there are multiple signatures.
3284  bool receiverIdOrClass=false) {
3285  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3286  /*instance*/false);
3287  }
3288 
3290  QualType ObjectType=QualType());
3291  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
3292  /// implementation.
3294 
3295  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
3296  /// initialization.
3299 
3300  //===--------------------------------------------------------------------===//
3301  // Statement Parsing Callbacks: SemaStmt.cpp.
3302 public:
3303  class FullExprArg {
3304  public:
3305  FullExprArg() : E(nullptr) { }
3306  FullExprArg(Sema &actions) : E(nullptr) { }
3307 
3309  return E;
3310  }
3311 
3312  Expr *get() const { return E; }
3313 
3315  return E;
3316  }
3317 
3318  private:
3319  // FIXME: No need to make the entire Sema class a friend when it's just
3320  // Sema::MakeFullExpr that needs access to the constructor below.
3321  friend class Sema;
3322 
3323  explicit FullExprArg(Expr *expr) : E(expr) {}
3324 
3325  Expr *E;
3326  };
3327 
3329  return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
3330  }
3332  return FullExprArg(ActOnFinishFullExpr(Arg, CC).get());
3333  }
3335  ExprResult FE =
3336  ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
3337  /*DiscardedValue*/ true);
3338  return FullExprArg(FE.get());
3339  }
3340 
3343 
3345  bool HasLeadingEmptyMacro = false);
3346 
3347  void ActOnStartOfCompoundStmt();
3350  ArrayRef<Stmt *> Elts, bool isStmtExpr);
3351 
3352  /// \brief A RAII object to enter scope of a compound statement.
3354  public:
3357  }
3358 
3360  S.ActOnFinishOfCompoundStmt();
3361  }
3362 
3363  private:
3364  Sema &S;
3365  };
3366 
3367  /// An RAII helper that pops function a function scope on exit.
3370  bool Active;
3371  FunctionScopeRAII(Sema &S) : S(S), Active(true) {}
3373  if (Active)
3374  S.PopFunctionScopeInfo();
3375  }
3376  void disable() { Active = false; }
3377  };
3378 
3380  SourceLocation StartLoc,
3381  SourceLocation EndLoc);
3384  StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
3385  SourceLocation DotDotDotLoc, Expr *RHSVal,
3387  void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
3388 
3391  Stmt *SubStmt, Scope *CurScope);
3393  SourceLocation ColonLoc, Stmt *SubStmt);
3394 
3396  ArrayRef<const Attr*> Attrs,
3397  Stmt *SubStmt);
3398 
3399  class ConditionResult;
3400  StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr,
3401  Stmt *InitStmt,
3402  ConditionResult Cond, Stmt *ThenVal,
3403  SourceLocation ElseLoc, Stmt *ElseVal);
3404  StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
3405  Stmt *InitStmt,
3406  ConditionResult Cond, Stmt *ThenVal,
3407  SourceLocation ElseLoc, Stmt *ElseVal);
3409  Stmt *InitStmt,
3410  ConditionResult Cond);
3412  Stmt *Switch, Stmt *Body);
3413  StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond,
3414  Stmt *Body);
3416  SourceLocation WhileLoc, SourceLocation CondLParen,
3417  Expr *Cond, SourceLocation CondRParen);
3418 
3420  SourceLocation LParenLoc,
3421  Stmt *First,
3422  ConditionResult Second,
3423  FullExprArg Third,
3424  SourceLocation RParenLoc,
3425  Stmt *Body);
3427  Expr *collection);
3429  Stmt *First, Expr *collection,
3430  SourceLocation RParenLoc);
3431  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
3432 
3434  /// Initial building of a for-range statement.
3436  /// Instantiation or recovery rebuild of a for-range statement. Don't
3437  /// attempt any typo-correction.
3439  /// Determining whether a for-range statement could be built. Avoid any
3440  /// unnecessary or irreversible actions.
3442  };
3443 
3445  SourceLocation CoawaitLoc,
3446  Stmt *LoopVar,
3447  SourceLocation ColonLoc, Expr *Collection,
3448  SourceLocation RParenLoc,
3451  SourceLocation CoawaitLoc,
3453  Stmt *RangeDecl, Stmt *Begin, Stmt *End,
3454  Expr *Cond, Expr *Inc,
3455  Stmt *LoopVarDecl,
3456  SourceLocation RParenLoc,
3458  StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
3459 
3461  SourceLocation LabelLoc,
3462  LabelDecl *TheDecl);
3464  SourceLocation StarLoc,
3465  Expr *DestExp);
3466  StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
3467  StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
3468 
3469  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3470  CapturedRegionKind Kind, unsigned NumParams);
3471  typedef std::pair<StringRef, QualType> CapturedParamNameType;
3472  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3476  void ActOnCapturedRegionError();
3478  SourceLocation Loc,
3479  unsigned NumParams);
3480  VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E,
3481  bool AllowParamOrMoveConstructible);
3482  bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD,
3483  bool AllowParamOrMoveConstructible);
3484 
3485  StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
3486  Scope *CurScope);
3487  StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3488  StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3489 
3490  StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
3491  bool IsVolatile, unsigned NumOutputs,
3492  unsigned NumInputs, IdentifierInfo **Names,
3493  MultiExprArg Constraints, MultiExprArg Exprs,
3494  Expr *AsmString, MultiExprArg Clobbers,
3495  SourceLocation RParenLoc);
3496 
3498  SourceLocation TemplateKWLoc,
3499  UnqualifiedId &Id,
3500  llvm::InlineAsmIdentifierInfo &Info,
3501  bool IsUnevaluatedContext);
3502  bool LookupInlineAsmField(StringRef Base, StringRef Member,
3503  unsigned &Offset, SourceLocation AsmLoc);
3504  ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member,
3505  llvm::InlineAsmIdentifierInfo &Info,
3506  SourceLocation AsmLoc);
3508  ArrayRef<Token> AsmToks,
3509  StringRef AsmString,
3510  unsigned NumOutputs, unsigned NumInputs,
3511  ArrayRef<StringRef> Constraints,
3512  ArrayRef<StringRef> Clobbers,
3513  ArrayRef<Expr*> Exprs,
3514  SourceLocation EndLoc);
3515  LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
3516  SourceLocation Location,
3517  bool AlwaysCreate);
3518 
3519  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
3520  SourceLocation StartLoc,
3521  SourceLocation IdLoc, IdentifierInfo *Id,
3522  bool Invalid = false);
3523 
3525 
3527  Decl *Parm, Stmt *Body);
3528 
3530 
3532  MultiStmtArg Catch, Stmt *Finally);
3533 
3536  Scope *CurScope);
3538  Expr *operand);
3540  Expr *SynchExpr,
3541  Stmt *SynchBody);
3542 
3544 
3546  SourceLocation StartLoc,
3547  SourceLocation IdLoc,
3548  IdentifierInfo *Id);
3549 
3551 
3553  Decl *ExDecl, Stmt *HandlerBlock);
3554  StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
3555  ArrayRef<Stmt *> Handlers);
3556 
3557  StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
3558  SourceLocation TryLoc, Stmt *TryBlock,
3559  Stmt *Handler);
3561  Expr *FilterExpr,
3562  Stmt *Block);
3567 
3569 
3570  bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const;
3571 
3572  /// \brief If it's a file scoped decl that must warn if not used, keep track
3573  /// of it.
3575 
3576  /// DiagnoseUnusedExprResult - If the statement passed in is an expression
3577  /// whose result is unused, warn.
3578  void DiagnoseUnusedExprResult(const Stmt *S);
3580  void DiagnoseUnusedDecl(const NamedDecl *ND);
3581 
3582  /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
3583  /// statement as a \p Body, and it is located on the same line.
3584  ///
3585  /// This helps prevent bugs due to typos, such as:
3586  /// if (condition);
3587  /// do_stuff();
3589  const Stmt *Body,
3590  unsigned DiagID);
3591 
3592  /// Warn if a for/while loop statement \p S, which is followed by
3593  /// \p PossibleBody, has a suspicious null statement as a body.
3594  void DiagnoseEmptyLoopBody(const Stmt *S,
3595  const Stmt *PossibleBody);
3596 
3597  /// Warn if a value is moved to itself.
3598  void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
3599  SourceLocation OpLoc);
3600 
3601  /// \brief Warn if we're implicitly casting from a _Nullable pointer type to a
3602  /// _Nonnull one.
3604  SourceLocation Loc);
3605 
3607  return DelayedDiagnostics.push(pool);
3608  }
3610 
3614  }
3617  }
3618 
3620 
3622 
3624  NamedDecl *D, StringRef Message,
3625  SourceLocation Loc,
3626  const ObjCInterfaceDecl *UnknownObjCClass,
3627  const ObjCPropertyDecl *ObjCProperty,
3628  bool ObjCPropertyAccess);
3629 
3631  UnavailableAttr::ImplicitReason reason);
3632 
3633  //===--------------------------------------------------------------------===//
3634  // Expression Parsing Callbacks: SemaExpr.cpp.
3635 
3636  bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
3638  const ObjCInterfaceDecl *UnknownObjCClass=nullptr,
3639  bool ObjCPropertyAccess=false);
3642  std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
3644  ObjCMethodDecl *Getter,
3645  SourceLocation Loc);
3647  ArrayRef<Expr *> Args);
3648 
3650  Decl *LambdaContextDecl = nullptr,
3651  bool IsDecltype = false);
3655  bool IsDecltype = false);
3657 
3659 
3662 
3664 
3665  // Functions for marking a declaration referenced. These functions also
3666  // contain the relevant logic for marking if a reference to a function or
3667  // variable is an odr-use (in the C++11 sense). There are separate variants
3668  // for expressions referring to a decl; these exist because odr-use marking
3669  // needs to be delayed for some constant variables when we build one of the
3670  // named expressions.
3671  //
3672  // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
3673  // should usually be true. This only needs to be set to false if the lack of
3674  // odr-use cannot be determined from the current context (for instance,
3675  // because the name denotes a virtual function and was written without an
3676  // explicit nested-name-specifier).
3677  void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
3679  bool MightBeOdrUse = true);
3683 
3685  void CleanupVarDeclMarking();
3686 
3689  };
3690 
3691  /// \brief Try to capture the given variable.
3692  ///
3693  /// \param Var The variable to capture.
3694  ///
3695  /// \param Loc The location at which the capture occurs.
3696  ///
3697  /// \param Kind The kind of capture, which may be implicit (for either a
3698  /// block or a lambda), or explicit by-value or by-reference (for a lambda).
3699  ///
3700  /// \param EllipsisLoc The location of the ellipsis, if one is provided in
3701  /// an explicit lambda capture.
3702  ///
3703  /// \param BuildAndDiagnose Whether we are actually supposed to add the
3704  /// captures or diagnose errors. If false, this routine merely check whether
3705  /// the capture can occur without performing the capture itself or complaining
3706  /// if the variable cannot be captured.
3707  ///
3708  /// \param CaptureType Will be set to the type of the field used to capture
3709  /// this variable in the innermost block or lambda. Only valid when the
3710  /// variable can be captured.
3711  ///
3712  /// \param DeclRefType Will be set to the type of a reference to the capture
3713  /// from within the current scope. Only valid when the variable can be
3714  /// captured.
3715  ///
3716  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
3717  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
3718  /// This is useful when enclosing lambdas must speculatively capture
3719  /// variables that may or may not be used in certain specializations of
3720  /// a nested generic lambda.
3721  ///
3722  /// \returns true if an error occurred (i.e., the variable cannot be
3723  /// captured) and false if the capture succeeded.
3725  SourceLocation EllipsisLoc, bool BuildAndDiagnose,
3726  QualType &CaptureType,
3727  QualType &DeclRefType,
3728  const unsigned *const FunctionScopeIndexToStopAt);
3729 
3730  /// \brief Try to capture the given variable.
3731  bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc,
3733  SourceLocation EllipsisLoc = SourceLocation());
3734 
3735  /// \brief Checks if the variable must be captured.
3737 
3738  /// \brief Given a variable, determine the type that a reference to that
3739  /// variable will have in the given scope.
3741 
3744  bool SkipLocalVariables = false);
3745 
3746  /// \brief Try to recover by turning the given expression into a
3747  /// call. Returns true if recovery was attempted or an error was
3748  /// emitted; this may also leave the ExprResult invalid.
3750  bool ForceComplain = false,
3751  bool (*IsPlausibleResult)(QualType) = nullptr);
3752 
3753  /// \brief Figure out if an expression could be turned into a call.
3754  bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
3755  UnresolvedSetImpl &NonTemplateOverloads);
3756 
3757  /// \brief Conditionally issue a diagnostic based on the current
3758  /// evaluation context.
3759  ///
3760  /// \param Statement If Statement is non-null, delay reporting the
3761  /// diagnostic until the function body is parsed, and then do a basic
3762  /// reachability analysis to determine if the statement is reachable.
3763  /// If it is unreachable, the diagnostic will not be emitted.
3764  bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
3765  const PartialDiagnostic &PD);
3766 
3767  // Primary Expressions.
3768  SourceRange getExprRange(Expr *E) const;
3769 
3771  Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
3772  UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
3773  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr,
3774  bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
3775 
3776  void DecomposeUnqualifiedId(const UnqualifiedId &Id,
3778  DeclarationNameInfo &NameInfo,
3779  const TemplateArgumentListInfo *&TemplateArgs);
3780 
3781  bool
3783  std::unique_ptr<CorrectionCandidateCallback> CCC,
3784  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
3785  ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
3786 
3788  IdentifierInfo *II,
3789  bool AllowBuiltinCreation=false);
3790 
3792  SourceLocation TemplateKWLoc,
3793  const DeclarationNameInfo &NameInfo,
3794  bool isAddressOfOperand,
3795  const TemplateArgumentListInfo *TemplateArgs);
3796 
3798  ExprValueKind VK,
3799  SourceLocation Loc,
3800  const CXXScopeSpec *SS = nullptr);
3801  ExprResult
3803  const DeclarationNameInfo &NameInfo,
3804  const CXXScopeSpec *SS = nullptr,
3805  NamedDecl *FoundD = nullptr,
3806  const TemplateArgumentListInfo *TemplateArgs = nullptr);
3807  ExprResult
3809  const CXXScopeSpec &SS,
3810  SourceLocation nameLoc,
3811  IndirectFieldDecl *indirectField,
3812  DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
3813  Expr *baseObjectExpr = nullptr,
3814  SourceLocation opLoc = SourceLocation());
3815 
3817  SourceLocation TemplateKWLoc,
3818  LookupResult &R,
3819  const TemplateArgumentListInfo *TemplateArgs,
3820  const Scope *S);
3822  SourceLocation TemplateKWLoc,
3823  LookupResult &R,
3824  const TemplateArgumentListInfo *TemplateArgs,
3825  bool IsDefiniteInstance,
3826  const Scope *S);
3828  const LookupResult &R,
3829  bool HasTrailingLParen);
3830 
3831  ExprResult
3833  const DeclarationNameInfo &NameInfo,
3834  bool IsAddressOfOperand, const Scope *S,
3835  TypeSourceInfo **RecoveryTSI = nullptr);
3836 
3838  SourceLocation TemplateKWLoc,
3839  const DeclarationNameInfo &NameInfo,
3840  const TemplateArgumentListInfo *TemplateArgs);
3841 
3843  LookupResult &R,
3844  bool NeedsADL,
3845  bool AcceptInvalidDecl = false);
3847  const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
3848  NamedDecl *FoundD = nullptr,
3849  const TemplateArgumentListInfo *TemplateArgs = nullptr,
3850  bool AcceptInvalidDecl = false);
3851 
3853  DeclarationNameInfo &SuffixInfo,
3854  ArrayRef<Expr *> Args,
3855  SourceLocation LitEndLoc,
3856  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
3857 
3861  ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val);
3862 
3863  bool CheckLoopHintExpr(Expr *E, SourceLocation Loc);
3864 
3865  ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
3867  Scope *UDLScope = nullptr);
3870  SourceLocation R,
3871  MultiExprArg Val);
3872 
3873  /// ActOnStringLiteral - The specified tokens were lexed as pasted string
3874  /// fragments (e.g. "foo" "bar" L"baz").
3876  Scope *UDLScope = nullptr);
3877 
3879  SourceLocation DefaultLoc,
3880  SourceLocation RParenLoc,
3881  Expr *ControllingExpr,
3882  ArrayRef<ParsedType> ArgTypes,
3883  ArrayRef<Expr *> ArgExprs);
3885  SourceLocation DefaultLoc,
3886  SourceLocation RParenLoc,
3887  Expr *ControllingExpr,
3889  ArrayRef<Expr *> Exprs);
3890 
3891  // Binary/Unary Operators. 'Tok' is the token for the operator.
3893  Expr *InputExpr);
3895  UnaryOperatorKind Opc, Expr *Input);
3897  tok::TokenKind Op, Expr *Input);
3898 
3900 
3902  SourceLocation OpLoc,
3903  UnaryExprOrTypeTrait ExprKind,
3904  SourceRange R);
3906  UnaryExprOrTypeTrait ExprKind);
3907  ExprResult
3909  UnaryExprOrTypeTrait ExprKind,
3910  bool IsType, void *TyOrEx,
3911  SourceRange ArgRange);
3912 
3914  bool CheckVecStepExpr(Expr *E);
3915 
3918  SourceRange ExprRange,
3919  UnaryExprOrTypeTrait ExprKind);
3921  SourceLocation OpLoc,
3923  SourceLocation NameLoc,
3924  SourceLocation RParenLoc);
3927 
3929  Expr *Idx, SourceLocation RLoc);
3931  Expr *Idx, SourceLocation RLoc);
3933  Expr *LowerBound, SourceLocation ColonLoc,
3934  Expr *Length, SourceLocation RBLoc);
3935 
3936  // This struct is for use by ActOnMemberAccess to allow
3937  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
3938  // changing the access operator from a '.' to a '->' (to see if that is the
3939  // change needed to fix an error about an unknown member, e.g. when the class
3940  // defines a custom operator->).
3945  };
3946 
3948  Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
3949  CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
3950  NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
3951  const TemplateArgumentListInfo *TemplateArgs,
3952  const Scope *S,
3953  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
3954 
3955  ExprResult
3957  bool IsArrow, const CXXScopeSpec &SS,
3958  SourceLocation TemplateKWLoc,
3959  NamedDecl *FirstQualifierInScope, LookupResult &R,
3960  const TemplateArgumentListInfo *TemplateArgs,
3961  const Scope *S,
3962  bool SuppressQualifierCheck = false,
3963  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
3964 
3966 
3967  bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
3968  const CXXScopeSpec &SS,
3969  const LookupResult &R);
3970 
3972  bool IsArrow, SourceLocation OpLoc,
3973  const CXXScopeSpec &SS,
3974  SourceLocation TemplateKWLoc,
3975  NamedDecl *FirstQualifierInScope,
3976  const DeclarationNameInfo &NameInfo,
3977  const TemplateArgumentListInfo *TemplateArgs);
3978 
3980  SourceLocation OpLoc,
3981  tok::TokenKind OpKind,
3982  CXXScopeSpec &SS,
3983  SourceLocation TemplateKWLoc,
3984  UnqualifiedId &Member,
3985  Decl *ObjCImpDecl);
3986 
3987  void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
3988  bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
3989  FunctionDecl *FDecl,
3990  const FunctionProtoType *Proto,
3991  ArrayRef<Expr *> Args,
3992  SourceLocation RParenLoc,
3993  bool ExecConfig = false);
3995  ParmVarDecl *Param,
3996  const Expr *ArgExpr);
3997 
3998  /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
3999  /// This provides the location of the left/right parens and a list of comma
4000  /// locations.
4002  MultiExprArg ArgExprs, SourceLocation RParenLoc,
4003  Expr *ExecConfig = nullptr,
4004  bool IsExecConfig = false);
4006  SourceLocation LParenLoc,
4007  ArrayRef<Expr *> Arg,
4008  SourceLocation RParenLoc,
4009  Expr *Config = nullptr,
4010  bool IsExecConfig = false);
4011 
4013  MultiExprArg ExecConfig,
4014  SourceLocation GGGLoc);
4015 
4017  Declarator &D, ParsedType &Ty,
4018  SourceLocation RParenLoc, Expr *CastExpr);
4020  TypeSourceInfo *Ty,
4021  SourceLocation RParenLoc,
4022  Expr *Op);
4024 
4025  /// \brief Build an altivec or OpenCL literal.
4027  SourceLocation RParenLoc, Expr *E,
4028  TypeSourceInfo *TInfo);
4029 
4031 
4033  ParsedType Ty,
4034  SourceLocation RParenLoc,
4035  Expr *InitExpr);
4036 
4038  TypeSourceInfo *TInfo,
4039  SourceLocation RParenLoc,
4040  Expr *LiteralExpr);
4041 
4043  MultiExprArg InitArgList,
4044  SourceLocation RBraceLoc);
4045 
4047  SourceLocation Loc,
4048  bool GNUSyntax,
4049  ExprResult Init);
4050 
4051 private:
4052  static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
4053 
4054 public:
4056  tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
4058  BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
4060  Expr *LHSExpr, Expr *RHSExpr);
4061 
4062  void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
4063 
4064  /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
4065  /// in the case of a the GNU conditional expr extension.
4068  Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
4069 
4070  /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
4072  LabelDecl *TheDecl);
4073 
4074  void ActOnStartStmtExpr();
4075  ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
4076  SourceLocation RPLoc); // "({..})"
4077  void ActOnStmtExprError();
4078 
4079  // __builtin_offsetof(type, identifier(.identifier|[expr])*)
4082  bool isBrackets; // true if [expr], false if .ident
4083  union {
4086  } U;
4087  };
4088 
4089  /// __builtin_offsetof(type, a.b[123][456].c)
4091  TypeSourceInfo *TInfo,
4092  ArrayRef<OffsetOfComponent> Components,
4093  SourceLocation RParenLoc);
4095  SourceLocation BuiltinLoc,
4097  ParsedType ParsedArgTy,
4098  ArrayRef<OffsetOfComponent> Components,
4099  SourceLocation RParenLoc);
4100 
4101  // __builtin_choose_expr(constExpr, expr1, expr2)
4103  Expr *CondExpr, Expr *LHSExpr,
4104  Expr *RHSExpr, SourceLocation RPLoc);
4105 
4106  // __builtin_va_arg(expr, type)
4107  ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty,
4108  SourceLocation RPLoc);
4110  TypeSourceInfo *TInfo, SourceLocation RPLoc);
4111 
4112  // __null
4114 
4115  bool CheckCaseExpression(Expr *E);
4116 
4117  /// \brief Describes the result of an "if-exists" condition check.
4119  /// \brief The symbol exists.
4121 
4122  /// \brief The symbol does not exist.
4124 
4125  /// \brief The name is a dependent name, so the results will differ
4126  /// from one instantiation to the next.
4128 
4129  /// \brief An error occurred.
4131  };
4132 
4135  const DeclarationNameInfo &TargetNameInfo);
4136 
4139  bool IsIfExists, CXXScopeSpec &SS,
4140  UnqualifiedId &Name);
4141 
4143  bool IsIfExists,
4144  NestedNameSpecifierLoc QualifierLoc,
4145  DeclarationNameInfo NameInfo,
4146  Stmt *Nested);
4148  bool IsIfExists,
4150  Stmt *Nested);
4151 
4152  //===------------------------- "Block" Extension ------------------------===//
4153 
4154  /// ActOnBlockStart - This callback is invoked when a block literal is
4155  /// started.
4156  void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
4157 
4158  /// ActOnBlockArguments - This callback allows processing of block arguments.
4159  /// If there are no arguments, this is still invoked.
4160  void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
4161  Scope *CurScope);
4162 
4163  /// ActOnBlockError - If there is an error parsing a block, this callback
4164  /// is invoked to pop the information about the block from the action impl.
4165  void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
4166 
4167  /// ActOnBlockStmtExpr - This is called when the body of a block statement
4168  /// literal was successfully completed. ^(int x){...}
4170  Scope *CurScope);
4171 
4172  //===---------------------------- Clang Extensions ----------------------===//
4173 
4174  /// __builtin_convertvector(...)
4176  SourceLocation BuiltinLoc,
4177  SourceLocation RParenLoc);
4178 
4179  //===---------------------------- OpenCL Features -----------------------===//
4180 
4181  /// __builtin_astype(...)
4182  ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
4183  SourceLocation BuiltinLoc,
4184  SourceLocation RParenLoc);
4185 
4186  //===---------------------------- C++ Features --------------------------===//
4187 
4188  // Act on C++ namespaces
4190  SourceLocation NamespaceLoc,
4191  SourceLocation IdentLoc,
4192  IdentifierInfo *Ident,
4193  SourceLocation LBrace,
4194  AttributeList *AttrList,
4196  void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
4197 
4198  NamespaceDecl *getStdNamespace() const;
4200 
4201  CXXRecordDecl *getStdBadAlloc() const;
4202 
4203  /// \brief Tests whether Ty is an instance of std::initializer_list and, if
4204  /// it is and Element is not NULL, assigns the element type to Element.
4205  bool isStdInitializerList(QualType Ty, QualType *Element);
4206 
4207  /// \brief Looks for the std::initializer_list template and instantiates it
4208  /// with Element, or emits an error if it's not found.
4209  ///
4210  /// \returns The instantiated template, or null on error.
4212 
4213  /// \brief Determine whether Ctor is an initializer-list constructor, as
4214  /// defined in [dcl.init.list]p2.
4215  bool isInitListConstructor(const CXXConstructorDecl *Ctor);
4216 
4217  Decl *ActOnUsingDirective(Scope *CurScope,
4218  SourceLocation UsingLoc,
4219  SourceLocation NamespcLoc,
4220  CXXScopeSpec &SS,
4221  SourceLocation IdentLoc,
4222  IdentifierInfo *NamespcName,
4223  AttributeList *AttrList);
4224 
4226 
4227  Decl *ActOnNamespaceAliasDef(Scope *CurScope,
4228  SourceLocation NamespaceLoc,
4229  SourceLocation AliasLoc,
4230  IdentifierInfo *Alias,
4231  CXXScopeSpec &SS,
4232  SourceLocation IdentLoc,
4233  IdentifierInfo *Ident);
4234 
4235  void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
4236  bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target,
4237  const LookupResult &PreviousDecls,
4238  UsingShadowDecl *&PrevShadow);
4240  NamedDecl *Target,
4241  UsingShadowDecl *PrevDecl);
4242 
4244  bool HasTypenameKeyword,
4245  const CXXScopeSpec &SS,
4246  SourceLocation NameLoc,
4247  const LookupResult &Previous);
4249  const CXXScopeSpec &SS,
4250  const DeclarationNameInfo &NameInfo,
4251  SourceLocation NameLoc);
4252 
4254  SourceLocation UsingLoc,
4255  CXXScopeSpec &SS,
4256  DeclarationNameInfo NameInfo,
4257  AttributeList *AttrList,
4258  bool IsInstantiation,
4259  bool HasTypenameKeyword,
4260  SourceLocation TypenameLoc);
4261 
4263 
4264  /// Given a derived-class using shadow declaration for a constructor and the
4265  /// correspnding base class constructor, find or create the implicit
4266  /// synthesized derived class constructor to use for this initialization.
4269  ConstructorUsingShadowDecl *DerivedShadow);
4270 
4271  Decl *ActOnUsingDeclaration(Scope *CurScope,
4272  AccessSpecifier AS,
4273  bool HasUsingKeyword,
4274  SourceLocation UsingLoc,
4275  CXXScopeSpec &SS,
4277  AttributeList *AttrList,
4278  bool HasTypenameKeyword,
4279  SourceLocation TypenameLoc);
4280  Decl *ActOnAliasDeclaration(Scope *CurScope,
4281  AccessSpecifier AS,
4282  MultiTemplateParamsArg TemplateParams,
4283  SourceLocation UsingLoc,
4285  AttributeList *AttrList,
4286  TypeResult Type,
4287  Decl *DeclFromDeclSpec);
4288 
4289  /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4290  /// including handling of its default argument expressions.
4291  ///
4292  /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4293  ExprResult
4294  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4295  NamedDecl *FoundDecl,
4296  CXXConstructorDecl *Constructor, MultiExprArg Exprs,
4297  bool HadMultipleCandidates, bool IsListInitialization,
4298  bool IsStdInitListInitialization,
4299  bool RequiresZeroInit, unsigned ConstructKind,
4300  SourceRange ParenRange);
4301 
4302  /// Build a CXXConstructExpr whose constructor has already been resolved if
4303  /// it denotes an inherited constructor.
4304  ExprResult
4305  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4306  CXXConstructorDecl *Constructor, bool Elidable,
4307  MultiExprArg Exprs,
4308  bool HadMultipleCandidates, bool IsListInitialization,
4309  bool IsStdInitListInitialization,
4310  bool RequiresZeroInit, unsigned ConstructKind,
4311  SourceRange ParenRange);
4312 
4313  // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4314  // the constructor can be elidable?
4315  ExprResult
4316  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4317  NamedDecl *FoundDecl,
4318  CXXConstructorDecl *Constructor, bool Elidable,
4319  MultiExprArg Exprs, bool HadMultipleCandidates,
4320  bool IsListInitialization,
4321  bool IsStdInitListInitialization, bool RequiresZeroInit,
4322  unsigned ConstructKind, SourceRange ParenRange);
4323 
4325 
4326  /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
4327  /// the default expr if needed.
4329  FunctionDecl *FD,
4330  ParmVarDecl *Param);
4331 
4332  /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4333  /// constructed variable.
4334  void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
4335 
4336  /// \brief Helper class that collects exception specifications for
4337  /// implicitly-declared special member functions.
4339  // Pointer to allow copying
4340  Sema *Self;
4341  // We order exception specifications thus:
4342  // noexcept is the most restrictive, but is only used in C++11.
4343  // throw() comes next.
4344  // Then a throw(collected exceptions)
4345  // Finally no specification, which is expressed as noexcept(false).
4346  // throw(...) is used instead if any called function uses it.
4347  ExceptionSpecificationType ComputedEST;
4348  llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
4349  SmallVector<QualType, 4> Exceptions;
4350 
4351  void ClearExceptions() {
4352  ExceptionsSeen.clear();
4353  Exceptions.clear();
4354  }
4355 
4356  public:
4358  : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4359  if (!Self.getLangOpts().CPlusPlus11)
4360  ComputedEST = EST_DynamicNone;
4361  }
4362 
4363  /// \brief Get the computed exception specification type.
4365  assert(ComputedEST != EST_ComputedNoexcept &&
4366  "noexcept(expr) should not be a possible result");
4367  return ComputedEST;
4368  }
4369 
4370  /// \brief The number of exceptions in the exception specification.
4371  unsigned size() const { return Exceptions.size(); }
4372 
4373  /// \brief The set of exceptions in the exception specification.
4374  const QualType *data() const { return Exceptions.data(); }
4375 
4376  /// \brief Integrate another called method into the collected data.
4377  void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
4378 
4379  /// \brief Integrate an invoked expression into the collected data.
4380  void CalledExpr(Expr *E);
4381 
4382  /// \brief Overwrite an EPI's exception specification with this
4383  /// computed exception specification.
4386  ESI.Type = getExceptionSpecType();
4387  if (ESI.Type == EST_Dynamic) {
4388  ESI.Exceptions = Exceptions;
4389  } else if (ESI.Type == EST_None) {
4390  /// C++11 [except.spec]p14:
4391  /// The exception-specification is noexcept(false) if the set of
4392  /// potential exceptions of the special member function contains "any"
4393  ESI.Type = EST_ComputedNoexcept;
4394  ESI.NoexceptExpr = Self->ActOnCXXBoolLiteral(SourceLocation(),
4395  tok::kw_false).get();
4396  }
4397  return ESI;
4398  }
4399  };
4400 
4401  /// \brief Determine what sort of exception specification a defaulted
4402  /// copy constructor of a class will have.
4403  ImplicitExceptionSpecification
4405  CXXMethodDecl *MD);
4406 
4407  /// \brief Determine what sort of exception specification a defaulted
4408  /// default constructor of a class will have, and whether the parameter
4409  /// will be const.
4410  ImplicitExceptionSpecification
4412 
4413  /// \brief Determine what sort of exception specification a defautled
4414  /// copy assignment operator of a class will have, and whether the
4415  /// parameter will be const.
4416  ImplicitExceptionSpecification
4418 
4419  /// \brief Determine what sort of exception specification a defaulted move
4420  /// constructor of a class will have.
4421  ImplicitExceptionSpecification
4423 
4424  /// \brief Determine what sort of exception specification a defaulted move
4425  /// assignment operator of a class will have.
4426  ImplicitExceptionSpecification
4428 
4429  /// \brief Determine what sort of exception specification a defaulted
4430  /// destructor of a class will have.
4431  ImplicitExceptionSpecification
4433 
4434  /// \brief Determine what sort of exception specification an inheriting
4435  /// constructor of a class will have.
4436  ImplicitExceptionSpecification
4438  CXXConstructorDecl *CD);
4439 
4440  /// \brief Evaluate the implicit exception specification for a defaulted
4441  /// special member function.
4443 
4444  /// \brief Check the given exception-specification and update the
4445  /// exception specification information with the results.
4446  void checkExceptionSpecification(bool IsTopLevel,
4448  ArrayRef<ParsedType> DynamicExceptions,
4449  ArrayRef<SourceRange> DynamicExceptionRanges,
4450  Expr *NoexceptExpr,
4451  SmallVectorImpl<QualType> &Exceptions,
4453 
4454  /// \brief Determine if we're in a case where we need to (incorrectly) eagerly
4455  /// parse an exception specification to work around a libstdc++ bug.
4457 
4458  /// \brief Add an exception-specification to the given member function
4459  /// (or member function template). The exception-specification was parsed
4460  /// after the method itself was declared.
4463  SourceRange SpecificationRange,
4464  ArrayRef<ParsedType> DynamicExceptions,
4465  ArrayRef<SourceRange> DynamicExceptionRanges,
4466  Expr *NoexceptExpr);
4467 
4468  class InheritedConstructorInfo;
4469 
4470  /// \brief Determine if a special member function should have a deleted
4471  /// definition when it is defaulted.
4473  InheritedConstructorInfo *ICI = nullptr,
4474  bool Diagnose = false);
4475 
4476  /// \brief Declare the implicit default constructor for the given class.
4477  ///
4478  /// \param ClassDecl The class declaration into which the implicit
4479  /// default constructor will be added.
4480  ///
4481  /// \returns The implicitly-declared default constructor.
4483  CXXRecordDecl *ClassDecl);
4484 
4485  /// DefineImplicitDefaultConstructor - Checks for feasibility of
4486  /// defining this constructor as the default constructor.
4487  void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
4488  CXXConstructorDecl *Constructor);
4489 
4490  /// \brief Declare the implicit destructor for the given class.
4491  ///
4492  /// \param ClassDecl The class declaration into which the implicit
4493  /// destructor will be added.
4494  ///
4495  /// \returns The implicitly-declared destructor.
4497 
4498  /// DefineImplicitDestructor - Checks for feasibility of
4499  /// defining this destructor as the default destructor.
4500  void DefineImplicitDestructor(SourceLocation CurrentLocation,
4501  CXXDestructorDecl *Destructor);
4502 
4503  /// \brief Build an exception spec for destructors that don't have one.
4504  ///
4505  /// C++11 says that user-defined destructors with no exception spec get one
4506  /// that looks as if the destructor was implicitly declared.
4508  CXXDestructorDecl *Destructor);
4509 
4510  /// \brief Define the specified inheriting constructor.
4512  CXXConstructorDecl *Constructor);
4513 
4514  /// \brief Declare the implicit copy constructor for the given class.
4515  ///
4516  /// \param ClassDecl The class declaration into which the implicit
4517  /// copy constructor will be added.
4518  ///
4519  /// \returns The implicitly-declared copy constructor.
4521 
4522  /// DefineImplicitCopyConstructor - Checks for feasibility of
4523  /// defining this constructor as the copy constructor.
4524  void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
4525  CXXConstructorDecl *Constructor);
4526 
4527  /// \brief Declare the implicit move constructor for the given class.
4528  ///
4529  /// \param ClassDecl The Class declaration into which the implicit
4530  /// move constructor will be added.
4531  ///
4532  /// \returns The implicitly-declared move constructor, or NULL if it wasn't
4533  /// declared.
4535 
4536  /// DefineImplicitMoveConstructor - Checks for feasibility of
4537  /// defining this constructor as the move constructor.
4538  void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
4539  CXXConstructorDecl *Constructor);
4540 
4541  /// \brief Declare the implicit copy assignment operator for the given class.
4542  ///
4543  /// \param ClassDecl The class declaration into which the implicit
4544  /// copy assignment operator will be added.
4545  ///
4546  /// \returns The implicitly-declared copy assignment operator.
4548 
4549  /// \brief Defines an implicitly-declared copy assignment operator.
4550  void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
4551  CXXMethodDecl *MethodDecl);
4552 
4553  /// \brief Declare the implicit move assignment operator for the given class.
4554  ///
4555  /// \param ClassDecl The Class declaration into which the implicit
4556  /// move assignment operator will be added.
4557  ///
4558  /// \returns The implicitly-declared move assignment operator, or NULL if it
4559  /// wasn't declared.
4561 
4562  /// \brief Defines an implicitly-declared move assignment operator.
4563  void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
4564  CXXMethodDecl *MethodDecl);
4565 
4566  /// \brief Force the declaration of any implicitly-declared members of this
4567  /// class.
4569 
4570  /// \brief Check a completed declaration of an implicit special member.
4572 
4573  /// \brief Determine whether the given function is an implicitly-deleted
4574  /// special member function.
4576 
4577  /// \brief Check whether 'this' shows up in the type of a static member
4578  /// function after the (naturally empty) cv-qualifier-seq would be.
4579  ///
4580  /// \returns true if an error occurred.
4582 
4583  /// \brief Whether this' shows up in the exception specification of a static
4584  /// member function.
4586 
4587  /// \brief Check whether 'this' shows up in the attributes of the given
4588  /// static member function.
4589  ///
4590  /// \returns true if an error occurred.
4592 
4593  /// MaybeBindToTemporary - If the passed in expression has a record type with
4594  /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
4595  /// it simply returns the passed in expression.
4597 
4598  bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
4599  MultiExprArg ArgsPtr,
4600  SourceLocation Loc,
4601  SmallVectorImpl<Expr*> &ConvertedArgs,
4602  bool AllowExplicit = false,
4603  bool IsListInitialization = false);
4604 
4606  SourceLocation NameLoc,
4607  IdentifierInfo &Name);
4608 
4610  IdentifierInfo &II, SourceLocation NameLoc,
4611  Scope *S, CXXScopeSpec &SS,
4612  ParsedType ObjectType,
4613  bool EnteringContext);
4614 
4615  ParsedType getDestructorType(const DeclSpec& DS, ParsedType ObjectType);
4616 
4617  // Checks that reinterpret casts don't have undefined behavior.
4618  void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
4619  bool IsDereference, SourceRange Range);
4620 
4621  /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
4624  SourceLocation LAngleBracketLoc,
4625  Declarator &D,
4626  SourceLocation RAngleBracketLoc,
4627  SourceLocation LParenLoc,
4628  Expr *E,
4629  SourceLocation RParenLoc);
4630 
4633  TypeSourceInfo *Ty,
4634  Expr *E,
4635  SourceRange AngleBrackets,
4636  SourceRange Parens);
4637 
4638  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4639  SourceLocation TypeidLoc,
4640  TypeSourceInfo *Operand,
4641  SourceLocation RParenLoc);
4642  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4643  SourceLocation TypeidLoc,
4644  Expr *Operand,
4645  SourceLocation RParenLoc);
4646 
4647  /// ActOnCXXTypeid - Parse typeid( something ).
4649  SourceLocation LParenLoc, bool isType,
4650  void *TyOrExpr,
4651  SourceLocation RParenLoc);
4652 
4653  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4654  SourceLocation TypeidLoc,
4655  TypeSourceInfo *Operand,
4656  SourceLocation RParenLoc);
4657  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4658  SourceLocation TypeidLoc,
4659  Expr *Operand,
4660  SourceLocation RParenLoc);
4661 
4662  /// ActOnCXXUuidof - Parse __uuidof( something ).
4664  SourceLocation LParenLoc, bool isType,
4665  void *TyOrExpr,
4666  SourceLocation RParenLoc);
4667 
4668  /// \brief Handle a C++1z fold-expression: ( expr op ... op expr ).
4670  tok::TokenKind Operator,
4671  SourceLocation EllipsisLoc, Expr *RHS,
4672  SourceLocation RParenLoc);
4674  BinaryOperatorKind Operator,
4675  SourceLocation EllipsisLoc, Expr *RHS,
4676  SourceLocation RParenLoc);
4678  BinaryOperatorKind Operator);
4679 
4680  //// ActOnCXXThis - Parse 'this' pointer.
4682 
4683  /// \brief Try to retrieve the type of the 'this' pointer.
4684  ///
4685  /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
4687 
4688  /// \brief When non-NULL, the C++ 'this' expression is allowed despite the
4689  /// current context not being a non-static member function. In such cases,
4690  /// this provides the type used for 'this'.
4692 
4693  /// \brief RAII object used to temporarily allow the C++ 'this' expression
4694  /// to be used, with the given qualifiers on the current class type.
4696  Sema &S;
4697  QualType OldCXXThisTypeOverride;
4698  bool Enabled;
4699 
4700  public:
4701  /// \brief Introduce a new scope where 'this' may be allowed (when enabled),
4702  /// using the given declaration (which is either a class template or a
4703  /// class) along with the given qualifiers.
4704  /// along with the qualifiers placed on '*this'.
4705  CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals,
4706  bool Enabled = true);
4707 
4708  ~CXXThisScopeRAII();
4709  };
4710 
4711  /// \brief Make sure the value of 'this' is actually available in the current
4712  /// context, if it is a potentially evaluated context.
4713  ///
4714  /// \param Loc The location at which the capture of 'this' occurs.
4715  ///
4716  /// \param Explicit Whether 'this' is explicitly captured in a lambda
4717  /// capture list.
4718  ///
4719  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
4720  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
4721  /// This is useful when enclosing lambdas must speculatively capture
4722  /// 'this' that may or may not be used in certain specializations of
4723  /// a nested generic lambda (depending on whether the name resolves to
4724  /// a non-static member function or a static function).
4725  /// \return returns 'true' if failed, 'false' if success.
4726  bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
4727  bool BuildAndDiagnose = true,
4728  const unsigned *const FunctionScopeIndexToStopAt = nullptr,
4729  bool ByCopy = false);
4730 
4731  /// \brief Determine whether the given type is the type of *this that is used
4732  /// outside of the body of a member function for a type that is currently
4733  /// being defined.
4735 
4736  /// ActOnCXXBoolLiteral - Parse {true,false} literals.
4738 
4739 
4740  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
4742 
4743  ExprResult
4745  SourceLocation AtLoc, SourceLocation RParen);
4746 
4747  /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
4749 
4750  //// ActOnCXXThrow - Parse throw expressions.
4753  bool IsThrownVarInScope);
4754  bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
4755 
4756  /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
4757  /// Can be interpreted either as function-style casting ("int(x)")
4758  /// or class type construction ("ClassType(x,y,z)")
4759  /// or creation of a value-initialized type ("int()").
4761  SourceLocation LParenLoc,
4762  MultiExprArg Exprs,
4763  SourceLocation RParenLoc);
4764 
4766  SourceLocation LParenLoc,
4767  MultiExprArg Exprs,
4768  SourceLocation RParenLoc);
4769 
4770  /// ActOnCXXNew - Parsed a C++ 'new' expression.
4771  ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
4772  SourceLocation PlacementLParen,
4773  MultiExprArg PlacementArgs,
4774  SourceLocation PlacementRParen,
4775  SourceRange TypeIdParens, Declarator &D,
4776  Expr *Initializer);
4777  ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal,
4778  SourceLocation PlacementLParen,
4779  MultiExprArg PlacementArgs,
4780  SourceLocation PlacementRParen,
4781  SourceRange TypeIdParens,
4782  QualType AllocType,
4783  TypeSourceInfo *AllocTypeInfo,
4784  Expr *ArraySize,
4785  SourceRange DirectInitRange,
4786  Expr *Initializer,
4787  bool TypeMayContainAuto = true);
4788 
4789  bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
4790  SourceRange R);
4791  bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
4792  bool UseGlobal, QualType AllocType, bool IsArray,
4793  MultiExprArg PlaceArgs,
4794  FunctionDecl *&OperatorNew,
4795  FunctionDecl *&OperatorDelete);
4796  bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
4798  DeclContext *Ctx,
4799  bool AllowMissing, FunctionDecl *&Operator,
4800  bool Diagnose = true);
4801  void DeclareGlobalNewDelete();
4803  QualType Param1,
4804  QualType Param2 = QualType());
4805 
4807  DeclarationName Name, FunctionDecl* &Operator,
4808  bool Diagnose = true);
4810  bool CanProvideSize,
4811  DeclarationName Name);
4812 
4813  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
4815  bool UseGlobal, bool ArrayForm,
4816  Expr *Operand);
4818  bool IsDelete, bool CallCanBeVirtual,
4819  bool WarnOnNonAbstractTypes,
4820  SourceLocation DtorLoc);
4821 
4823  Expr *Operand, SourceLocation RParen);
4825  SourceLocation RParen);
4826 
4827  /// \brief Parsed one of the type trait support pseudo-functions.
4829  ArrayRef<ParsedType> Args,
4830  SourceLocation RParenLoc);
4833  SourceLocation RParenLoc);
4834 
4835  /// ActOnArrayTypeTrait - Parsed one of the bianry type trait support
4836  /// pseudo-functions.
4838  SourceLocation KWLoc,
4839  ParsedType LhsTy,
4840  Expr *DimExpr,
4841  SourceLocation RParen);
4842 
4844  SourceLocation KWLoc,
4845  TypeSourceInfo *TSInfo,
4846  Expr *DimExpr,
4847  SourceLocation RParen);
4848 
4849  /// ActOnExpressionTrait - Parsed one of the unary type trait support
4850  /// pseudo-functions.
4852  SourceLocation KWLoc,
4853  Expr *Queried,
4854  SourceLocation RParen);
4855 
4857  SourceLocation KWLoc,
4858  Expr *Queried,
4859  SourceLocation RParen);
4860 
4862  Expr *Base,
4863  SourceLocation OpLoc,
4864  tok::TokenKind OpKind,
4865  ParsedType &ObjectType,
4866  bool &MayBePseudoDestructor);
4867 
4869  SourceLocation OpLoc,
4870  tok::TokenKind OpKind,
4871  const CXXScopeSpec &SS,
4872  TypeSourceInfo *ScopeType,
4873  SourceLocation CCLoc,
4874  SourceLocation TildeLoc,
4875  PseudoDestructorTypeStorage DestroyedType);
4876 
4878  SourceLocation OpLoc,
4879  tok::TokenKind OpKind,
4880  CXXScopeSpec &SS,
4881  UnqualifiedId &FirstTypeName,
4882  SourceLocation CCLoc,
4883  SourceLocation TildeLoc,
4884  UnqualifiedId &SecondTypeName);
4885 
4887  SourceLocation OpLoc,
4888  tok::TokenKind OpKind,
4889  SourceLocation TildeLoc,
4890  const DeclSpec& DS);
4891 
4892  /// MaybeCreateExprWithCleanups - If the current full-expression
4893  /// requires any cleanups, surround it with a ExprWithCleanups node.
4894  /// Otherwise, just returns the passed-in expression.
4898 
4901  bool BoundToLvalueReference);
4902 
4904  return ActOnFinishFullExpr(Expr, Expr ? Expr->getExprLoc()
4905  : SourceLocation());
4906  }
4908  bool DiscardedValue = false,
4909  bool IsConstexpr = false,
4910  bool IsLambdaInitCaptureInitializer = false);
4912 
4913  // Marks SS invalid if it represents an incomplete type.
4915 
4918  bool EnteringContext = false);
4919  bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
4921 
4922  /// \brief The parser has parsed a global nested-name-specifier '::'.
4923  ///
4924  /// \param CCLoc The location of the '::'.
4925  ///
4926  /// \param SS The nested-name-specifier, which will be updated in-place
4927  /// to reflect the parsed nested-name-specifier.
4928  ///
4929  /// \returns true if an error occurred, false otherwise.
4931 
4932  /// \brief The parser has parsed a '__super' nested-name-specifier.
4933  ///
4934  /// \param SuperLoc The location of the '__super' keyword.
4935  ///
4936  /// \param ColonColonLoc The location of the '::'.
4937  ///
4938  /// \param SS The nested-name-specifier, which will be updated in-place
4939  /// to reflect the parsed nested-name-specifier.
4940  ///
4941  /// \returns true if an error occurred, false otherwise.
4943  SourceLocation ColonColonLoc, CXXScopeSpec &SS);
4944 
4946  bool *CanCorrect = nullptr);
4948 
4950  SourceLocation IdLoc,
4951  IdentifierInfo &II,
4952  ParsedType ObjectType);
4953 
4955  IdentifierInfo &Identifier,
4957  SourceLocation CCLoc,
4958  QualType ObjectType,
4959  bool EnteringContext,
4960  CXXScopeSpec &SS,
4961  NamedDecl *ScopeLookupResult,
4962  bool ErrorRecoveryLookup,
4963  bool *IsCorrectedToColon = nullptr);
4964 
4965  /// \brief The parser has parsed a nested-name-specifier 'identifier::'.
4966  ///
4967  /// \param S The scope in which this nested-name-specifier occurs.
4968  ///
4969  /// \param Identifier The identifier preceding the '::'.
4970  ///
4971  /// \param IdentifierLoc The location of the identifier.
4972  ///
4973  /// \param CCLoc The location of the '::'.
4974  ///
4975  /// \param ObjectType The type of the object, if we're parsing
4976  /// nested-name-specifier in a member access expression.
4977  ///
4978  /// \param EnteringContext Whether we're entering the context nominated by
4979  /// this nested-name-specifier.
4980  ///
4981  /// \param SS The nested-name-specifier, which is both an input
4982  /// parameter (the nested-name-specifier before this type) and an
4983  /// output parameter (containing the full nested-name-specifier,
4984  /// including this new type).
4985  ///
4986  /// \param ErrorRecoveryLookup If true, then this method is called to improve
4987  /// error recovery. In this case do not emit error message.
4988  ///
4989  /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
4990  /// are allowed. The bool value pointed by this parameter is set to 'true'
4991  /// if the identifier is treated as if it was followed by ':', not '::'.
4992  ///
4993  /// \returns true if an error occurred, false otherwise.
4995  IdentifierInfo &Identifier,
4997  SourceLocation CCLoc,
4998  ParsedType ObjectType,
4999  bool EnteringContext,
5000  CXXScopeSpec &SS,
5001  bool ErrorRecoveryLookup = false,
5002  bool *IsCorrectedToColon = nullptr);
5003 
5005 
5007  const DeclSpec &DS,
5008  SourceLocation ColonColonLoc);
5009 
5011  IdentifierInfo &Identifier,
5014  ParsedType ObjectType,
5015  bool EnteringContext);
5016 
5017  /// \brief The parser has parsed a nested-name-specifier
5018  /// 'template[opt] template-name < template-args >::'.
5019  ///
5020  /// \param S The scope in which this nested-name-specifier occurs.
5021  ///
5022  /// \param SS The nested-name-specifier, which is both an input
5023  /// parameter (the nested-name-specifier before this type) and an
5024  /// output parameter (containing the full nested-name-specifier,
5025  /// including this new type).
5026  ///
5027  /// \param TemplateKWLoc the location of the 'template' keyword, if any.
5028  /// \param TemplateName the template name.
5029  /// \param TemplateNameLoc The location of the template name.
5030  /// \param LAngleLoc The location of the opening angle bracket ('<').
5031  /// \param TemplateArgs The template arguments.
5032  /// \param RAngleLoc The location of the closing angle bracket ('>').
5033  /// \param CCLoc The location of the '::'.
5034  ///
5035  /// \param EnteringContext Whether we're entering the context of the
5036  /// nested-name-specifier.
5037  ///
5038  ///
5039  /// \returns true if an error occurred, false otherwise.
5041  CXXScopeSpec &SS,
5042  SourceLocation TemplateKWLoc,
5044  SourceLocation TemplateNameLoc,
5045  SourceLocation LAngleLoc,
5046  ASTTemplateArgsPtr TemplateArgs,
5047  SourceLocation RAngleLoc,
5048  SourceLocation CCLoc,
5049  bool EnteringContext);
5050 
5051  /// \brief Given a C++ nested-name-specifier, produce an annotation value
5052  /// that the parser can use later to reconstruct the given
5053  /// nested-name-specifier.
5054  ///
5055  /// \param SS A nested-name-specifier.
5056  ///
5057  /// \returns A pointer containing all of the information in the
5058  /// nested-name-specifier \p SS.
5060 
5061  /// \brief Given an annotation pointer for a nested-name-specifier, restore
5062  /// the nested-name-specifier structure.
5063  ///
5064  /// \param Annotation The annotation pointer, produced by
5065  /// \c SaveNestedNameSpecifierAnnotation().
5066  ///
5067  /// \param AnnotationRange The source range corresponding to the annotation.
5068  ///
5069  /// \param SS The nested-name-specifier that will be updated with the contents
5070  /// of the annotation pointer.
5071  void RestoreNestedNameSpecifierAnnotation(void *Annotation,
5072  SourceRange AnnotationRange,
5073  CXXScopeSpec &SS);
5074 
5075  bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
5076 
5077  /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
5078  /// scope or nested-name-specifier) is parsed, part of a declarator-id.
5079  /// After this method is called, according to [C++ 3.4.3p3], names should be
5080  /// looked up in the declarator-id's scope, until the declarator is parsed and
5081  /// ActOnCXXExitDeclaratorScope is called.
5082  /// The 'SS' should be a non-empty valid CXXScopeSpec.
5084 
5085  /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
5086  /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
5087  /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
5088  /// Used to indicate that names should revert to being looked up in the
5089  /// defining scope.
5090  void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
5091 
5092  /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
5093  /// initializer for the declaration 'Dcl'.
5094  /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
5095  /// static data member of class X, names should be looked up in the scope of
5096  /// class X.
5098 
5099  /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
5100  /// initializer for the declaration 'Dcl'.
5101  void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
5102 
5103  /// \brief Create a new lambda closure type.
5105  TypeSourceInfo *Info,
5106  bool KnownDependent,
5107  LambdaCaptureDefault CaptureDefault);
5108 
5109  /// \brief Start the definition of a lambda expression.
5111  SourceRange IntroducerRange,
5112  TypeSourceInfo *MethodType,
5113  SourceLocation EndLoc,
5114  ArrayRef<ParmVarDecl *> Params);
5115 
5116  /// \brief Endow the lambda scope info with the relevant properties.
5118  CXXMethodDecl *CallOperator,
5119  SourceRange IntroducerRange,
5120  LambdaCaptureDefault CaptureDefault,
5121  SourceLocation CaptureDefaultLoc,
5122  bool ExplicitParams,
5123  bool ExplicitResultType,
5124  bool Mutable);
5125 
5126  /// \brief Perform initialization analysis of the init-capture and perform
5127  /// any implicit conversions such as an lvalue-to-rvalue conversion if
5128  /// not being used to initialize a reference.
5130  SourceLocation Loc, bool ByRef, IdentifierInfo *Id,
5131  LambdaCaptureInitKind InitKind, Expr *&Init) {
5133  Loc, ByRef, Id, InitKind != LambdaCaptureInitKind::CopyInit, Init));
5134  }
5136  IdentifierInfo *Id,
5137  bool DirectInit, Expr *&Init);
5138 
5139  /// \brief Create a dummy variable within the declcontext of the lambda's
5140  /// call operator, for name lookup purposes for a lambda init capture.
5141  ///
5142  /// CodeGen handles emission of lambda captures, ignoring these dummy
5143  /// variables appropriately.
5145  QualType InitCaptureType,
5146  IdentifierInfo *Id,
5147  unsigned InitStyle, Expr *Init);
5148 
5149  /// \brief Build the implicit field for an init-capture.
5151 
5152  /// \brief Note that we have finished the explicit captures for the
5153  /// given lambda.
5155 
5156  /// \brief Introduce the lambda parameters into scope.
5157  void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope);
5158 
5159  /// \brief Deduce a block or lambda's return type based on the return
5160  /// statements present in the body.
5162 
5163  /// ActOnStartOfLambdaDefinition - This is called just before we start
5164  /// parsing the body of a lambda; it analyzes the explicit captures and
5165  /// arguments, and sets up various data-structures for the body of the
5166  /// lambda.
5168  Declarator &ParamInfo, Scope *CurScope);
5169 
5170  /// ActOnLambdaError - If there is an error parsing a lambda, this callback
5171  /// is invoked to pop the information about the lambda.
5172  void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
5173  bool IsInstantiation = false);
5174 
5175  /// ActOnLambdaExpr - This is called when the body of a lambda expression
5176  /// was successfully completed.
5178  Scope *CurScope);
5179 
5180  /// \brief Complete a lambda-expression having processed and attached the
5181  /// lambda body.
5183  sema::LambdaScopeInfo *LSI);
5184 
5185  /// \brief Define the "body" of the conversion from a lambda object to a
5186  /// function pointer.
5187  ///
5188  /// This routine doesn't actually define a sensible body; rather, it fills
5189  /// in the initialization expression needed to copy the lambda object into
5190  /// the block, and IR generation actually generates the real body of the
5191  /// block pointer conversion.
5193  SourceLocation CurrentLoc, CXXConversionDecl *Conv);
5194 
5195  /// \brief Define the "body" of the conversion from a lambda object to a
5196  /// block pointer.
5197  ///
5198  /// This routine doesn't actually define a sensible body; rather, it fills
5199  /// in the initialization expression needed to copy the lambda object into
5200  /// the block, and IR generation actually generates the real body of the
5201  /// block pointer conversion.
5203  CXXConversionDecl *Conv);
5204 
5206  SourceLocation ConvLocation,
5207  CXXConversionDecl *Conv,
5208  Expr *Src);
5209 
5210  // ParseObjCStringLiteral - Parse Objective-C string literals.
5212  ArrayRef<Expr *> Strings);
5213 
5215 
5216  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
5217  /// numeric literal expression. Type of the expression will be "NSNumber *"
5218  /// or "id" if NSNumber is unavailable.
5221  bool Value);
5223 
5224  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
5225  /// '@' prefixed parenthesized expression. The type of the expression will
5226  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
5227  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
5228  /// "const char *" or C structure with attribute 'objc_boxable'.
5230 
5232  Expr *IndexExpr,
5233  ObjCMethodDecl *getterMethod,
5234  ObjCMethodDecl *setterMethod);
5235 
5238 
5240  TypeSourceInfo *EncodedTypeInfo,
5241  SourceLocation RParenLoc);
5243  CXXConversionDecl *Method,
5244  bool HadMultipleCandidates);
5245 
5247  SourceLocation EncodeLoc,
5248  SourceLocation LParenLoc,
5249  ParsedType Ty,
5250  SourceLocation RParenLoc);
5251 
5252  /// ParseObjCSelectorExpression - Build selector expression for \@selector
5254  SourceLocation AtLoc,
5255  SourceLocation SelLoc,
5256  SourceLocation LParenLoc,
5257  SourceLocation RParenLoc,
5258  bool WarnMultipleSelectors);
5259 
5260  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
5262  SourceLocation AtLoc,
5263  SourceLocation ProtoLoc,
5264  SourceLocation LParenLoc,
5265  SourceLocation ProtoIdLoc,
5266  SourceLocation RParenLoc);
5267 
5268  //===--------------------------------------------------------------------===//
5269  // C++ Declarations
5270  //
5272  SourceLocation ExternLoc,
5273  Expr *LangStr,
5274  SourceLocation LBraceLoc);
5276  Decl *LinkageSpec,
5277  SourceLocation RBraceLoc);
5278 
5279 
5280  //===--------------------------------------------------------------------===//
5281  // C++ Classes
5282  //
5283  bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
5284  const CXXScopeSpec *SS = nullptr);
5285  bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS);
5286 
5288  SourceLocation ASLoc,
5290  AttributeList *Attrs = nullptr);
5291 
5293  Declarator &D,
5294  MultiTemplateParamsArg TemplateParameterLists,
5295  Expr *BitfieldWidth, const VirtSpecifiers &VS,
5296  InClassInitStyle InitStyle);
5297 
5300  SourceLocation EqualLoc,
5301  Expr *Init);
5302 
5303  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5304  Scope *S,
5305  CXXScopeSpec &SS,
5306  IdentifierInfo *MemberOrBase,
5307  ParsedType TemplateTypeTy,
5308  const DeclSpec &DS,
5309  SourceLocation IdLoc,
5310  SourceLocation LParenLoc,
5311  ArrayRef<Expr *> Args,
5312  SourceLocation RParenLoc,
5313  SourceLocation EllipsisLoc);
5314 
5315  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5316  Scope *S,
5317  CXXScopeSpec &SS,
5318  IdentifierInfo *MemberOrBase,
5319  ParsedType TemplateTypeTy,
5320  const DeclSpec &DS,
5321  SourceLocation IdLoc,
5322  Expr *InitList,
5323  SourceLocation EllipsisLoc);
5324 
5325  MemInitResult BuildMemInitializer(Decl *ConstructorD,
5326  Scope *S,
5327  CXXScopeSpec &SS,
5328  IdentifierInfo *MemberOrBase,
5329  ParsedType TemplateTypeTy,
5330  const DeclSpec &DS,
5331  SourceLocation IdLoc,
5332  Expr *Init,
5333  SourceLocation EllipsisLoc);
5334 
5336  Expr *Init,
5337  SourceLocation IdLoc);
5338 
5340  TypeSourceInfo *BaseTInfo,
5341  Expr *Init,
5342  CXXRecordDecl *ClassDecl,
5343  SourceLocation EllipsisLoc);
5344 
5346  Expr *Init,
5347  CXXRecordDecl *ClassDecl);
5348 
5349  bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
5350  CXXCtorInitializer *Initializer);
5351 
5352  bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
5353  ArrayRef<CXXCtorInitializer *> Initializers = None);
5354 
5355  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
5356 
5357 
5358  /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
5359  /// mark all the non-trivial destructors of its members and bases as
5360  /// referenced.
5362  CXXRecordDecl *Record);
5363 
5364  /// \brief The list of classes whose vtables have been used within
5365  /// this translation unit, and the source locations at which the
5366  /// first use occurred.
5367  typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
5368 
5369  /// \brief The list of vtables that are required but have not yet been
5370  /// materialized.
5372 
5373  /// \brief The set of classes whose vtables have been used within
5374  /// this translation unit, and a bit that will be true if the vtable is
5375  /// required to be emitted (otherwise, it should be emitted only if needed
5376  /// by code generation).
5377  llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
5378 
5379  /// \brief Load any externally-stored vtable uses.
5380  void LoadExternalVTableUses();
5381 
5382  /// \brief Note that the vtable for the given class was used at the
5383  /// given location.
5384  void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
5385  bool DefinitionRequired = false);
5386 
5387  /// \brief Mark the exception specifications of all virtual member functions
5388  /// in the given class as needed.
5390  const CXXRecordDecl *RD);
5391 
5392  /// MarkVirtualMembersReferenced - Will mark all members of the given
5393  /// CXXRecordDecl referenced.
5395  const CXXRecordDecl *RD);
5396 
5397  /// \brief Define all of the vtables that have been used in this
5398  /// translation unit and reference any virtual members used by those
5399  /// vtables.
5400  ///
5401  /// \returns true if any work was done, false otherwise.
5402  bool DefineUsedVTables();
5403 
5405 
5406  void ActOnMemInitializers(Decl *ConstructorDecl,
5409  bool AnyErrors);
5410 
5411  /// \brief Check class-level dllimport/dllexport attribute. The caller must
5412  /// ensure that referenceDLLExportedClassMethods is called some point later
5413  /// when all outer classes of Class are complete.
5415 
5417 
5419  CXXRecordDecl *Class, Attr *ClassAttr,
5420  ClassTemplateSpecializationDecl *BaseTemplateSpec,
5421  SourceLocation BaseLoc);
5422 
5423  void CheckCompletedCXXClass(CXXRecordDecl *Record);
5425  Decl *TagDecl,
5426  SourceLocation LBrac,
5427  SourceLocation RBrac,
5428  AttributeList *AttrList);
5431 
5433  unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template);
5436  void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
5441  CachedTokens &Toks);
5444 
5446  Expr *AssertExpr,
5447  Expr *AssertMessageExpr,
5448  SourceLocation RParenLoc);
5450  Expr *AssertExpr,
5451  StringLiteral *AssertMessageExpr,
5452  SourceLocation RParenLoc,
5453  bool Failed);
5454 
5456  SourceLocation FriendLoc,
5457  TypeSourceInfo *TSInfo);
5458  Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
5459  MultiTemplateParamsArg TemplateParams);
5461  MultiTemplateParamsArg TemplateParams);
5462 
5464  StorageClass& SC);
5465  void CheckConstructor(CXXConstructorDecl *Constructor);
5467  StorageClass& SC);
5468  bool CheckDestructor(CXXDestructorDecl *Destructor);
5470  StorageClass& SC);
5472 
5475  const FunctionProtoType *T);
5477 
5478  //===--------------------------------------------------------------------===//
5479  // C++ Derived Classes
5480  //
5481 
5482  /// ActOnBaseSpecifier - Parsed a base specifier
5484  SourceRange SpecifierRange,
5485  bool Virtual, AccessSpecifier Access,
5486  TypeSourceInfo *TInfo,
5487  SourceLocation EllipsisLoc);
5488 
5489  BaseResult ActOnBaseSpecifier(Decl *classdecl,
5490  SourceRange SpecifierRange,
5491  ParsedAttributes &Attrs,
5492  bool Virtual, AccessSpecifier Access,
5493  ParsedType basetype,
5494  SourceLocation BaseLoc,
5495  SourceLocation EllipsisLoc);
5496 
5497  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
5499  void ActOnBaseSpecifiers(Decl *ClassDecl,
5501 
5502  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base);
5503  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
5504  CXXBasePaths &Paths);
5505 
5506  // FIXME: I don't like this name.
5507  void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
5508 
5510  SourceLocation Loc, SourceRange Range,
5511  CXXCastPath *BasePath = nullptr,
5512  bool IgnoreAccess = false);
5514  unsigned InaccessibleBaseID,
5515  unsigned AmbigiousBaseConvID,
5516  SourceLocation Loc, SourceRange Range,
5517  DeclarationName Name,
5518  CXXCastPath *BasePath,
5519  bool IgnoreAccess = false);
5520 
5521  std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
5522 
5524  const CXXMethodDecl *Old);
5525 
5526  /// CheckOverridingFunctionReturnType - Checks whether the return types are
5527  /// covariant, according to C++ [class.virtual]p5.
5529  const CXXMethodDecl *Old);
5530 
5531  /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
5532  /// spec is a subset of base spec.
5534  const CXXMethodDecl *Old);
5535 
5536  bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
5537 
5538  /// CheckOverrideControl - Check C++11 override control semantics.
5540 
5541  /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
5542  /// not used in the declaration of an overriding method.
5544 
5545  /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
5546  /// overrides a virtual member function marked 'final', according to
5547  /// C++11 [class.virtual]p4.
5549  const CXXMethodDecl *Old);
5550 
5551 
5552  //===--------------------------------------------------------------------===//
5553  // C++ Access Control
5554  //
5555 
5561  };
5562 
5563  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
5564  NamedDecl *PrevMemberDecl,
5565  AccessSpecifier LexicalAS);
5566 
5568  DeclAccessPair FoundDecl);
5570  DeclAccessPair FoundDecl);
5572  SourceRange PlacementRange,
5573  CXXRecordDecl *NamingClass,
5574  DeclAccessPair FoundDecl,
5575  bool Diagnose = true);
5577  CXXConstructorDecl *D,
5578  DeclAccessPair FoundDecl,
5579  const InitializedEntity &Entity,
5580  bool IsCopyBindingRefToTemp = false);
5582  CXXConstructorDecl *D,
5583  DeclAccessPair FoundDecl,
5584  const InitializedEntity &Entity,
5585  const PartialDiagnostic &PDiag);
5587  CXXDestructorDecl *Dtor,
5588  const PartialDiagnostic &PDiag,
5589  QualType objectType = QualType());
5592  CXXRecordDecl *NamingClass,
5593  DeclAccessPair Found);
5595  Expr *ObjectExpr,
5596  Expr *ArgExpr,
5597  DeclAccessPair FoundDecl);
5599  DeclAccessPair FoundDecl);
5601  QualType Base, QualType Derived,
5602  const CXXBasePath &Path,
5603  unsigned DiagID,
5604  bool ForceCheck = false,
5605  bool ForceUnprivileged = false);
5606  void CheckLookupAccess(const LookupResult &R);
5609  AccessSpecifier access,
5610  QualType objectType);
5611 
5613  const MultiLevelTemplateArgumentList &TemplateArgs);
5614  void PerformDependentDiagnostics(const DeclContext *Pattern,
5615  const MultiLevelTemplateArgumentList &TemplateArgs);
5616 
5618 
5619  /// \brief When true, access checking violations are treated as SFINAE
5620  /// failures rather than hard errors.
5622 
5632  };
5633 
5634  bool isAbstractType(SourceLocation Loc, QualType T);
5636  TypeDiagnoser &Diagnoser);
5637  template <typename... Ts>
5638  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
5639  const Ts &...Args) {
5640  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
5641  return RequireNonAbstractType(Loc, T, Diagnoser);
5642  }
5643 
5644  void DiagnoseAbstractType(const CXXRecordDecl *RD);
5645 
5646  //===--------------------------------------------------------------------===//
5647  // C++ Overloaded Operators [C++ 13.5]
5648  //
5649 
5651 
5653 
5654  //===--------------------------------------------------------------------===//
5655  // C++ Templates [C++ 14]
5656  //
5658  bool AllowFunctionTemplates = true);
5660  bool AllowFunctionTemplates = true);
5661 
5663  QualType ObjectType, bool EnteringContext,
5664  bool &MemberOfUnknownSpecialization);
5665 
5667  CXXScopeSpec &SS,
5668  bool hasTemplateKeyword,
5669  UnqualifiedId &Name,
5670  ParsedType ObjectType,
5671  bool EnteringContext,
5672  TemplateTy &Template,
5673  bool &MemberOfUnknownSpecialization);
5674 
5676  SourceLocation IILoc,
5677  Scope *S,
5678  const CXXScopeSpec *SS,
5679  TemplateTy &SuggestedTemplate,
5680  TemplateNameKind &SuggestedKind);
5681 
5684 
5685  Decl *ActOnTypeParameter(Scope *S, bool Typename,
5686  SourceLocation EllipsisLoc,
5687  SourceLocation KeyLoc,
5688  IdentifierInfo *ParamName,
5689  SourceLocation ParamNameLoc,
5690  unsigned Depth, unsigned Position,
5691  SourceLocation EqualLoc,
5692  ParsedType DefaultArg);
5693 
5696  unsigned Depth,
5697  unsigned Position,
5698  SourceLocation EqualLoc,
5699  Expr *DefaultArg);
5701  SourceLocation TmpLoc,
5702  TemplateParameterList *Params,
5703  SourceLocation EllipsisLoc,
5704  IdentifierInfo *ParamName,
5705  SourceLocation ParamNameLoc,
5706  unsigned Depth,
5707  unsigned Position,
5708  SourceLocation EqualLoc,
5709  ParsedTemplateArgument DefaultArg);
5710 
5713  SourceLocation ExportLoc,
5714  SourceLocation TemplateLoc,
5715  SourceLocation LAngleLoc,
5716  ArrayRef<Decl *> Params,
5717  SourceLocation RAngleLoc,
5718  Expr *RequiresClause);
5719 
5720  /// \brief The context in which we are checking a template parameter list.
5730  };
5731 
5733  TemplateParameterList *OldParams,
5736  SourceLocation DeclStartLoc, SourceLocation DeclLoc,
5737  const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
5739  bool IsFriend, bool &IsExplicitSpecialization, bool &Invalid);
5740 
5741  DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
5742  SourceLocation KWLoc, CXXScopeSpec &SS,
5743  IdentifierInfo *Name, SourceLocation NameLoc,
5745  TemplateParameterList *TemplateParams,
5746  AccessSpecifier AS,
5747  SourceLocation ModulePrivateLoc,
5748  SourceLocation FriendLoc,
5749  unsigned NumOuterTemplateParamLists,
5750  TemplateParameterList **OuterTemplateParamLists,
5751  SkipBodyInfo *SkipBody = nullptr);
5752 
5755 
5757 
5759  SourceLocation TemplateLoc,
5760  TemplateArgumentListInfo &TemplateArgs);
5761 
5762  TypeResult
5763  ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5764  TemplateTy Template, SourceLocation TemplateLoc,
5765  SourceLocation LAngleLoc,
5766  ASTTemplateArgsPtr TemplateArgs,
5767  SourceLocation RAngleLoc,
5768  bool IsCtorOrDtorName = false);
5769 
5770  /// \brief Parsed an elaborated-type-specifier that refers to a template-id,
5771  /// such as \c class T::template apply<U>.
5773  TypeSpecifierType TagSpec,
5774  SourceLocation TagLoc,
5775  CXXScopeSpec &SS,
5776  SourceLocation TemplateKWLoc,
5777  TemplateTy TemplateD,
5778  SourceLocation TemplateLoc,
5779  SourceLocation LAngleLoc,
5780  ASTTemplateArgsPtr TemplateArgsIn,
5781  SourceLocation RAngleLoc);
5782 
5784  Scope *S, Declarator &D, TypeSourceInfo *DI,
5785  SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
5786  StorageClass SC, bool IsPartialSpecialization);
5787 
5789  SourceLocation TemplateLoc,
5790  SourceLocation TemplateNameLoc,
5791  const TemplateArgumentListInfo &TemplateArgs);
5792 
5794  const DeclarationNameInfo &NameInfo,
5795  VarTemplateDecl *Template,
5796  SourceLocation TemplateLoc,
5797  const TemplateArgumentListInfo *TemplateArgs);
5798 
5800  SourceLocation TemplateKWLoc,
5801  LookupResult &R,
5802  bool RequiresADL,
5803  const TemplateArgumentListInfo *TemplateArgs);
5804 
5806  SourceLocation TemplateKWLoc,
5807  const DeclarationNameInfo &NameInfo,
5808  const TemplateArgumentListInfo *TemplateArgs);
5809 
5811  CXXScopeSpec &SS,
5812  SourceLocation TemplateKWLoc,
5813  UnqualifiedId &Name,
5814  ParsedType ObjectType,
5815  bool EnteringContext,
5816  TemplateTy &Template);
5817 
5818  DeclResult
5819  ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
5820  SourceLocation KWLoc,
5821  SourceLocation ModulePrivateLoc,
5822  TemplateIdAnnotation &TemplateId,
5824  MultiTemplateParamsArg TemplateParameterLists,
5825  SkipBodyInfo *SkipBody = nullptr);
5826 
5828  MultiTemplateParamsArg TemplateParameterLists,
5829  Declarator &D);
5830 
5831  bool
5834  NamedDecl *PrevDecl,
5836  SourceLocation PrevPtOfInstantiation,
5837  bool &SuppressNew);
5838 
5840  const TemplateArgumentListInfo &ExplicitTemplateArgs,
5842 
5844  TemplateArgumentListInfo *ExplicitTemplateArgs,
5847 
5848  DeclResult
5850  SourceLocation ExternLoc,
5851  SourceLocation TemplateLoc,
5852  unsigned TagSpec,
5853  SourceLocation KWLoc,
5854  const CXXScopeSpec &SS,
5855  TemplateTy Template,
5856  SourceLocation TemplateNameLoc,
5857  SourceLocation LAngleLoc,
5858  ASTTemplateArgsPtr TemplateArgs,
5859  SourceLocation RAngleLoc,
5860  AttributeList *Attr);
5861 
5862  DeclResult
5864  SourceLocation ExternLoc,
5865  SourceLocation TemplateLoc,
5866  unsigned TagSpec,
5867  SourceLocation KWLoc,
5868  CXXScopeSpec &SS,
5869  IdentifierInfo *Name,
5870  SourceLocation NameLoc,
5871  AttributeList *Attr);
5872 
5874  SourceLocation ExternLoc,
5875  SourceLocation TemplateLoc,
5876  Declarator &D);
5877 
5880  SourceLocation TemplateLoc,
5881  SourceLocation RAngleLoc,
5882  Decl *Param,
5884  &Converted,
5885  bool &HasDefaultArg);
5886 
5887  /// \brief Specifies the context in which a particular template
5888  /// argument is being checked.
5890  /// \brief The template argument was specified in the code or was
5891  /// instantiated with some deduced template arguments.
5893 
5894  /// \brief The template argument was deduced via template argument
5895  /// deduction.
5897 
5898  /// \brief The template argument was deduced from an array bound
5899  /// via template argument deduction.
5901  };
5902 
5903  bool CheckTemplateArgument(NamedDecl *Param,
5904  TemplateArgumentLoc &Arg,
5905  NamedDecl *Template,
5906  SourceLocation TemplateLoc,
5907  SourceLocation RAngleLoc,
5908  unsigned ArgumentPackIndex,
5911 
5912  /// \brief Check that the given template arguments can be be provided to
5913  /// the given template, converting the arguments along the way.
5914  ///
5915  /// \param Template The template to which the template arguments are being
5916  /// provided.
5917  ///
5918  /// \param TemplateLoc The location of the template name in the source.
5919  ///
5920  /// \param TemplateArgs The list of template arguments. If the template is
5921  /// a template template parameter, this function may extend the set of
5922  /// template arguments to also include substituted, defaulted template
5923  /// arguments.
5924  ///
5925  /// \param PartialTemplateArgs True if the list of template arguments is
5926  /// intentionally partial, e.g., because we're checking just the initial
5927  /// set of template arguments.
5928  ///
5929  /// \param Converted Will receive the converted, canonicalized template
5930  /// arguments.
5931  ///
5932  /// \returns true if an error occurred, false otherwise.
5933  bool CheckTemplateArgumentList(TemplateDecl *Template,
5934  SourceLocation TemplateLoc,
5935  TemplateArgumentListInfo &TemplateArgs,
5936  bool PartialTemplateArgs,
5938 
5940  TemplateArgumentLoc &Arg,
5942 
5944  TypeSourceInfo *Arg);
5946  QualType InstantiatedParamType, Expr *Arg,
5947  TemplateArgument &Converted,
5950  TemplateArgumentLoc &Arg,
5951  unsigned ArgumentPackIndex);
5952 
5953  ExprResult
5955  QualType ParamType,
5956  SourceLocation Loc);
5957  ExprResult
5959  SourceLocation Loc);
5960 
5961  /// \brief Enumeration describing how template parameter lists are compared
5962  /// for equality.
5964  /// \brief We are matching the template parameter lists of two templates
5965  /// that might be redeclarations.
5966  ///
5967  /// \code
5968  /// template<typename T> struct X;
5969  /// template<typename T> struct X;
5970  /// \endcode
5972 
5973  /// \brief We are matching the template parameter lists of two template
5974  /// template parameters as part of matching the template parameter lists
5975  /// of two templates that might be redeclarations.
5976  ///
5977  /// \code
5978  /// template<template<int I> class TT> struct X;
5979  /// template<template<int Value> class Other> struct X;
5980  /// \endcode
5982 
5983  /// \brief We are matching the template parameter lists of a template
5984  /// template argument against the template parameter lists of a template
5985  /// template parameter.
5986  ///
5987  /// \code
5988  /// template<template<int Value> class Metafun> struct X;
5989  /// template<int Value> struct integer_c;
5990  /// X<integer_c> xic;
5991  /// \endcode
5993  };
5994 
5996  TemplateParameterList *Old,
5997  bool Complain,
5999  SourceLocation TemplateArgLoc
6000  = SourceLocation());
6001 
6002  bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
6003 
6004  /// \brief Called when the parser has parsed a C++ typename
6005  /// specifier, e.g., "typename T::type".
6006  ///
6007  /// \param S The scope in which this typename type occurs.
6008  /// \param TypenameLoc the location of the 'typename' keyword
6009  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6010  /// \param II the identifier we're retrieving (e.g., 'type' in the example).
6011  /// \param IdLoc the location of the identifier.
6012  TypeResult
6013  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
6014  const CXXScopeSpec &SS, const IdentifierInfo &II,
6015  SourceLocation IdLoc);
6016 
6017  /// \brief Called when the parser has parsed a C++ typename
6018  /// specifier that ends in a template-id, e.g.,
6019  /// "typename MetaFun::template apply<T1, T2>".
6020  ///
6021  /// \param S The scope in which this typename type occurs.
6022  /// \param TypenameLoc the location of the 'typename' keyword
6023  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6024  /// \param TemplateLoc the location of the 'template' keyword, if any.
6025  /// \param TemplateName The template name.
6026  /// \param TemplateNameLoc The location of the template name.
6027  /// \param LAngleLoc The location of the opening angle bracket ('<').
6028  /// \param TemplateArgs The template arguments.
6029  /// \param RAngleLoc The location of the closing angle bracket ('>').
6030  TypeResult
6031  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
6032  const CXXScopeSpec &SS,
6033  SourceLocation TemplateLoc,
6035  SourceLocation TemplateNameLoc,
6036  SourceLocation LAngleLoc,
6037  ASTTemplateArgsPtr TemplateArgs,
6038  SourceLocation RAngleLoc);
6039 
6041  SourceLocation KeywordLoc,
6042  NestedNameSpecifierLoc QualifierLoc,
6043  const IdentifierInfo &II,
6044  SourceLocation IILoc);
6045 
6047  SourceLocation Loc,
6048  DeclarationName Name);
6050 
6053  TemplateParameterList *Params);
6054 
6055  std::string
6057  const TemplateArgumentList &Args);
6058 
6059  std::string
6061  const TemplateArgument *Args,
6062  unsigned NumArgs);
6063 
6064  //===--------------------------------------------------------------------===//
6065  // C++ Variadic Templates (C++0x [temp.variadic])
6066  //===--------------------------------------------------------------------===//
6067 
6068  /// Determine whether an unexpanded parameter pack might be permitted in this
6069  /// location. Useful for error recovery.
6071 
6072  /// \brief The context in which an unexpanded parameter pack is
6073  /// being diagnosed.
6074  ///
6075  /// Note that the values of this enumeration line up with the first
6076  /// argument to the \c err_unexpanded_parameter_pack diagnostic.
6078  /// \brief An arbitrary expression.
6080 
6081  /// \brief The base type of a class type.
6083 
6084  /// \brief The type of an arbitrary declaration.
6086 
6087  /// \brief The type of a data member.
6089 
6090  /// \brief The size of a bit-field.
6092 
6093  /// \brief The expression in a static assertion.
6095 
6096  /// \brief The fixed underlying type of an enumeration.
6098 
6099  /// \brief The enumerator value.
6101 
6102  /// \brief A using declaration.
6104 
6105  /// \brief A friend declaration.
6107 
6108  /// \brief A declaration qualifier.
6110 
6111  /// \brief An initializer.
6113 
6114  /// \brief A default argument.
6116 
6117  /// \brief The type of a non-type template parameter.
6119 
6120  /// \brief The type of an exception.
6122 
6123  /// \brief Partial specialization.
6125 
6126  /// \brief Microsoft __if_exists.
6128 
6129  /// \brief Microsoft __if_not_exists.
6131 
6132  /// \brief Lambda expression.
6134 
6135  /// \brief Block expression,
6137  };
6138 
6139  /// \brief Diagnose unexpanded parameter packs.
6140  ///
6141  /// \param Loc The location at which we should emit the diagnostic.
6142  ///
6143  /// \param UPPC The context in which we are diagnosing unexpanded
6144  /// parameter packs.
6145  ///
6146  /// \param Unexpanded the set of unexpanded parameter packs.
6147  ///
6148  /// \returns true if an error occurred, false otherwise.
6152 
6153  /// \brief If the given type contains an unexpanded parameter pack,
6154  /// diagnose the error.
6155  ///
6156  /// \param Loc The source location where a diagnostc should be emitted.
6157  ///
6158  /// \param T The type that is being checked for unexpanded parameter
6159  /// packs.
6160  ///
6161  /// \returns true if an error occurred, false otherwise.
6164 
6165  /// \brief If the given expression contains an unexpanded parameter
6166  /// pack, diagnose the error.
6167  ///
6168  /// \param E The expression that is being checked for unexpanded
6169  /// parameter packs.
6170  ///
6171  /// \returns true if an error occurred, false otherwise.
6174 
6175  /// \brief If the given nested-name-specifier contains an unexpanded
6176  /// parameter pack, diagnose the error.
6177  ///
6178  /// \param SS The nested-name-specifier that is being checked for
6179  /// unexpanded parameter packs.
6180  ///
6181  /// \returns true if an error occurred, false otherwise.
6184 
6185  /// \brief If the given name contains an unexpanded parameter pack,
6186  /// diagnose the error.
6187  ///
6188  /// \param NameInfo The name (with source location information) that
6189  /// is being checked for unexpanded parameter packs.
6190  ///
6191  /// \returns true if an error occurred, false otherwise.
6194 
6195  /// \brief If the given template name contains an unexpanded parameter pack,
6196  /// diagnose the error.
6197  ///
6198  /// \param Loc The location of the template name.
6199  ///
6200  /// \param Template The template name that is being checked for unexpanded
6201  /// parameter packs.
6202  ///
6203  /// \returns true if an error occurred, false otherwise.
6205  TemplateName Template,
6207 
6208  /// \brief If the given template argument contains an unexpanded parameter
6209  /// pack, diagnose the error.
6210  ///
6211  /// \param Arg The template argument that is being checked for unexpanded
6212  /// parameter packs.
6213  ///
6214  /// \returns true if an error occurred, false otherwise.
6217 
6218  /// \brief Collect the set of unexpanded parameter packs within the given
6219  /// template argument.
6220  ///
6221  /// \param Arg The template argument that will be traversed to find
6222  /// unexpanded parameter packs.
6225 
6226  /// \brief Collect the set of unexpanded parameter packs within the given
6227  /// template argument.
6228  ///
6229  /// \param Arg The template argument that will be traversed to find
6230  /// unexpanded parameter packs.
6233 
6234  /// \brief Collect the set of unexpanded parameter packs within the given
6235  /// type.
6236  ///
6237  /// \param T The type that will be traversed to find
6238  /// unexpanded parameter packs.
6241 
6242  /// \brief Collect the set of unexpanded parameter packs within the given
6243  /// type.
6244  ///
6245  /// \param TL The type that will be traversed to find
6246  /// unexpanded parameter packs.
6249 
6250  /// \brief Collect the set of unexpanded parameter packs within the given
6251  /// nested-name-specifier.
6252  ///
6253  /// \param SS The nested-name-specifier that will be traversed to find
6254  /// unexpanded parameter packs.
6257 
6258  /// \brief Collect the set of unexpanded parameter packs within the given
6259  /// name.
6260  ///
6261  /// \param NameInfo The name that will be traversed to find
6262  /// unexpanded parameter packs.
6265 
6266  /// \brief Invoked when parsing a template argument followed by an
6267  /// ellipsis, which creates a pack expansion.
6268  ///
6269  /// \param Arg The template argument preceding the ellipsis, which
6270  /// may already be invalid.
6271  ///
6272  /// \param EllipsisLoc The location of the ellipsis.
6274  SourceLocation EllipsisLoc);
6275 
6276  /// \brief Invoked when parsing a type followed by an ellipsis, which
6277  /// creates a pack expansion.
6278  ///
6279  /// \param Type The type preceding the ellipsis, which will become
6280  /// the pattern of the pack expansion.
6281  ///
6282  /// \param EllipsisLoc The location of the ellipsis.
6284 
6285  /// \brief Construct a pack expansion type from the pattern of the pack
6286  /// expansion.
6288  SourceLocation EllipsisLoc,
6289  Optional<unsigned> NumExpansions);
6290 
6291  /// \brief Construct a pack expansion type from the pattern of the pack
6292  /// expansion.
6294  SourceRange PatternRange,
6295  SourceLocation EllipsisLoc,
6296  Optional<unsigned> NumExpansions);
6297 
6298  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6299  /// creates a pack expansion.
6300  ///
6301  /// \param Pattern The expression preceding the ellipsis, which will become
6302  /// the pattern of the pack expansion.
6303  ///
6304  /// \param EllipsisLoc The location of the ellipsis.
6305  ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
6306 
6307  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6308  /// creates a pack expansion.
6309  ///
6310  /// \param Pattern The expression preceding the ellipsis, which will become
6311  /// the pattern of the pack expansion.
6312  ///
6313  /// \param EllipsisLoc The location of the ellipsis.
6314  ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
6315  Optional<unsigned> NumExpansions);
6316 
6317  /// \brief Determine whether we could expand a pack expansion with the
6318  /// given set of parameter packs into separate arguments by repeatedly
6319  /// transforming the pattern.
6320  ///
6321  /// \param EllipsisLoc The location of the ellipsis that identifies the
6322  /// pack expansion.
6323  ///
6324  /// \param PatternRange The source range that covers the entire pattern of
6325  /// the pack expansion.
6326  ///
6327  /// \param Unexpanded The set of unexpanded parameter packs within the
6328  /// pattern.
6329  ///
6330  /// \param ShouldExpand Will be set to \c true if the transformer should
6331  /// expand the corresponding pack expansions into separate arguments. When
6332  /// set, \c NumExpansions must also be set.
6333  ///
6334  /// \param RetainExpansion Whether the caller should add an unexpanded
6335  /// pack expansion after all of the expanded arguments. This is used
6336  /// when extending explicitly-specified template argument packs per
6337  /// C++0x [temp.arg.explicit]p9.
6338  ///
6339  /// \param NumExpansions The number of separate arguments that will be in
6340  /// the expanded form of the corresponding pack expansion. This is both an
6341  /// input and an output parameter, which can be set by the caller if the
6342  /// number of expansions is known a priori (e.g., due to a prior substitution)
6343  /// and will be set by the callee when the number of expansions is known.
6344  /// The callee must set this value when \c ShouldExpand is \c true; it may
6345  /// set this value in other cases.
6346  ///
6347  /// \returns true if an error occurred (e.g., because the parameter packs
6348  /// are to be instantiated with arguments of different lengths), false
6349  /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
6350  /// must be set.
6352  SourceRange PatternRange,
6354  const MultiLevelTemplateArgumentList &TemplateArgs,
6355  bool &ShouldExpand,
6356  bool &RetainExpansion,
6357  Optional<unsigned> &NumExpansions);
6358 
6359  /// \brief Determine the number of arguments in the given pack expansion
6360  /// type.
6361  ///
6362  /// This routine assumes that the number of arguments in the expansion is
6363  /// consistent across all of the unexpanded parameter packs in its pattern.
6364  ///
6365  /// Returns an empty Optional if the type can't be expanded.
6367  const MultiLevelTemplateArgumentList &TemplateArgs);
6368 
6369  /// \brief Determine whether the given declarator contains any unexpanded
6370  /// parameter packs.
6371  ///
6372  /// This routine is used by the parser to disambiguate function declarators
6373  /// with an ellipsis prior to the ')', e.g.,
6374  ///
6375  /// \code
6376  /// void f(T...);
6377  /// \endcode
6378  ///
6379  /// To determine whether we have an (unnamed) function parameter pack or
6380  /// a variadic function.
6381  ///
6382  /// \returns true if the declarator contains any unexpanded parameter packs,
6383  /// false otherwise.
6385 
6386  /// \brief Returns the pattern of the pack expansion for a template argument.
6387  ///
6388  /// \param OrigLoc The template argument to expand.
6389  ///
6390  /// \param Ellipsis Will be set to the location of the ellipsis.
6391  ///
6392  /// \param NumExpansions Will be set to the number of expansions that will
6393  /// be generated from this pack expansion, if known a priori.
6395  TemplateArgumentLoc OrigLoc,
6396  SourceLocation &Ellipsis,
6397  Optional<unsigned> &NumExpansions) const;
6398 
6399  //===--------------------------------------------------------------------===//
6400  // C++ Template Argument Deduction (C++ [temp.deduct])
6401  //===--------------------------------------------------------------------===//
6402 
6404 
6405  /// \brief Describes the result of template argument deduction.
6406  ///
6407  /// The TemplateDeductionResult enumeration describes the result of
6408  /// template argument deduction, as returned from
6409  /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
6410  /// structure provides additional information about the results of
6411  /// template argument deduction, e.g., the deduced template argument
6412  /// list (if successful) or the specific template parameters or
6413  /// deduced arguments that were involved in the failure.
6415  /// \brief Template argument deduction was successful.
6417  /// \brief The declaration was invalid; do nothing.
6419  /// \brief Template argument deduction exceeded the maximum template
6420  /// instantiation depth (which has already been diagnosed).
6422  /// \brief Template argument deduction did not deduce a value
6423  /// for every template parameter.
6425  /// \brief Template argument deduction produced inconsistent
6426  /// deduced values for the given template parameter.
6428  /// \brief Template argument deduction failed due to inconsistent
6429  /// cv-qualifiers on a template parameter type that would
6430  /// otherwise be deduced, e.g., we tried to deduce T in "const T"
6431  /// but were given a non-const "X".
6433  /// \brief Substitution of the deduced template argument values
6434  /// resulted in an error.
6436  /// \brief After substituting deduced template arguments, a dependent
6437  /// parameter type did not match the corresponding argument.
6439  /// \brief A non-depnedent component of the parameter did not match the
6440  /// corresponding component of the argument.
6442  /// \brief When performing template argument deduction for a function
6443  /// template, there were too many call arguments.
6445  /// \brief When performing template argument deduction for a function
6446  /// template, there were too few call arguments.
6448  /// \brief The explicitly-specified template arguments were not valid
6449  /// template arguments for the given template.
6451  /// \brief The arguments included an overloaded function name that could
6452  /// not be resolved to a suitable function.
6454  /// \brief Deduction failed; that's all we know.
6456  };
6457 
6460  const TemplateArgumentList &TemplateArgs,
6462 
6465  const TemplateArgumentList &TemplateArgs,
6467 
6469  FunctionTemplateDecl *FunctionTemplate,
6470  TemplateArgumentListInfo &ExplicitTemplateArgs,
6474 
6475  /// brief A function argument from which we performed template argument
6476  // deduction for a call.
6478  OriginalCallArg(QualType OriginalParamType,
6479  unsigned ArgIdx,
6480  QualType OriginalArgType)
6481  : OriginalParamType(OriginalParamType), ArgIdx(ArgIdx),
6482  OriginalArgType(OriginalArgType) { }
6483 
6485  unsigned ArgIdx;
6487  };
6488 
6492  unsigned NumExplicitlySpecified,
6493  FunctionDecl *&Specialization,
6495  SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
6496  bool PartialOverloading = false);
6497 
6500  TemplateArgumentListInfo *ExplicitTemplateArgs,
6501  ArrayRef<Expr *> Args,
6502  FunctionDecl *&Specialization,
6504  bool PartialOverloading = false);
6505 
6508  TemplateArgumentListInfo *ExplicitTemplateArgs,
6509  QualType ArgFunctionType,
6510  FunctionDecl *&Specialization,
6512  bool InOverloadResolution = false);
6513 
6516  QualType ToType,
6517  CXXConversionDecl *&Specialization,
6519 
6522  TemplateArgumentListInfo *ExplicitTemplateArgs,
6523  FunctionDecl *&Specialization,
6525  bool InOverloadResolution = false);
6526 
6527  /// \brief Substitute Replacement for \p auto in \p TypeWithAuto
6529  /// \brief Substitute Replacement for auto in TypeWithAuto
6532 
6533  /// \brief Result type of DeduceAutoType.
6538  };
6539 
6541  QualType &Result);
6543  QualType &Result);
6544  void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
6546  bool Diagnose = true);
6547 
6550  SourceRange Range, bool DirectInit,
6551  Expr *Init);
6552 
6554 
6556  SourceLocation ReturnLoc,
6557  Expr *&RetExpr, AutoType *AT);
6558 
6560  FunctionTemplateDecl *FT2,
6561  SourceLocation Loc,
6563  unsigned NumCallArguments1,
6564  unsigned NumCallArguments2);
6567  TemplateSpecCandidateSet &FailedCandidates,
6568  SourceLocation Loc,
6569  const PartialDiagnostic &NoneDiag,
6570  const PartialDiagnostic &AmbigDiag,
6571  const PartialDiagnostic &CandidateDiag,
6572  bool Complain = true, QualType TargetType = QualType());
6573 
6578  SourceLocation Loc);
6579 
6583 
6584  void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
6585  bool OnlyDeduced,
6586  unsigned Depth,
6587  llvm::SmallBitVector &Used);
6589  const FunctionTemplateDecl *FunctionTemplate,
6590  llvm::SmallBitVector &Deduced) {
6591  return MarkDeducedTemplateParameters(Context, FunctionTemplate, Deduced);
6592  }
6593  static void MarkDeducedTemplateParameters(ASTContext &Ctx,
6594  const FunctionTemplateDecl *FunctionTemplate,
6595  llvm::SmallBitVector &Deduced);
6596 
6597  //===--------------------------------------------------------------------===//
6598  // C++ Template Instantiation
6599  //
6600 
6603  const TemplateArgumentList *Innermost = nullptr,
6604  bool RelativeToPrimary = false,
6605  const FunctionDecl *Pattern = nullptr);
6606 
6607  /// \brief A template instantiation that is currently in progress.
6609  /// \brief The kind of template instantiation we are performing
6611  /// We are instantiating a template declaration. The entity is
6612  /// the declaration we're instantiating (e.g., a CXXRecordDecl).
6614 
6615  /// We are instantiating a default argument for a template
6616  /// parameter. The Entity is the template, and
6617  /// TemplateArgs/NumTemplateArguments provides the template
6618  /// arguments as specified.
6619  /// FIXME: Use a TemplateArgumentList
6621 
6622  /// We are instantiating a default argument for a function.
6623  /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
6624  /// provides the template arguments as specified.
6626 
6627  /// We are substituting explicit template arguments provided for
6628  /// a function template. The entity is a FunctionTemplateDecl.
6630 
6631  /// We are substituting template argument determined as part of
6632  /// template argument deduction for either a class template
6633  /// partial specialization or a function template. The
6634  /// Entity is either a ClassTemplatePartialSpecializationDecl or
6635  /// a FunctionTemplateDecl.
6637 
6638  /// We are substituting prior template arguments into a new
6639  /// template parameter. The template parameter itself is either a
6640  /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
6642 
6643  /// We are checking the validity of a default template argument that
6644  /// has been used when naming a template-id.
6646 
6647  /// We are instantiating the exception specification for a function
6648  /// template which was deferred until it was needed.
6649  ExceptionSpecInstantiation
6650  } Kind;
6651 
6652  /// \brief The point of instantiation within the source code.
6654 
6655  /// \brief The template (or partial specialization) in which we are
6656  /// performing the instantiation, for substitutions of prior template
6657  /// arguments.
6659 
6660  /// \brief The entity that is being instantiated.
6662 
6663  /// \brief The list of template arguments we are substituting, if they
6664  /// are not part of the entity.
6666 
6667  /// \brief The number of template arguments in TemplateArgs.
6669 
6671  return {TemplateArgs, NumTemplateArgs};
6672  }
6673 
6674  /// \brief The template deduction info object associated with the
6675  /// substitution or checking of explicit or deduced template arguments.
6677 
6678  /// \brief The source range that covers the construct that cause
6679  /// the instantiation, e.g., the template-id that causes a class
6680  /// template instantiation.
6682 
6684  : Kind(TemplateInstantiation), Template(nullptr), Entity(nullptr),
6685  TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
6686 
6687  /// \brief Determines whether this template is an actual instantiation
6688  /// that should be counted toward the maximum instantiation depth.
6689  bool isInstantiationRecord() const;
6690 
6692  const ActiveTemplateInstantiation &Y) {
6693  if (X.Kind != Y.Kind)
6694  return false;
6695 
6696  if (X.Entity != Y.Entity)
6697  return false;
6698 
6699  switch (X.Kind) {
6700  case TemplateInstantiation:
6701  case ExceptionSpecInstantiation:
6702  return true;
6703 
6704  case PriorTemplateArgumentSubstitution:
6705  case DefaultTemplateArgumentChecking:
6706  return X.Template == Y.Template && X.TemplateArgs == Y.TemplateArgs;
6707 
6708  case DefaultTemplateArgumentInstantiation:
6709  case ExplicitTemplateArgumentSubstitution:
6710  case DeducedTemplateArgumentSubstitution:
6711  case DefaultFunctionArgumentInstantiation:
6712  return X.TemplateArgs == Y.TemplateArgs;
6713 
6714  }
6715 
6716  llvm_unreachable("Invalid InstantiationKind!");
6717  }
6718 
6720  const ActiveTemplateInstantiation &Y) {
6721  return !(X == Y);
6722  }
6723  };
6724 
6725  /// \brief List of active template instantiations.
6726  ///
6727  /// This vector is treated as a stack. As one template instantiation
6728  /// requires another template instantiation, additional
6729  /// instantiations are pushed onto the stack up to a
6730  /// user-configurable limit LangOptions::InstantiationDepth.
6733 
6734  /// \brief Extra modules inspected when performing a lookup during a template
6735  /// instantiation. Computed lazily.
6737 
6738  /// \brief Cache of additional modules that should be used for name lookup
6739  /// within the current template instantiation. Computed lazily; use
6740  /// getLookupModules() to get a complete set.
6742 
6743  /// \brief Get the set of additional modules that should be checked during
6744  /// name lookup. A module and its imports become visible when instanting a
6745  /// template defined within it.
6747 
6748  /// \brief Map from the most recent declaration of a namespace to the most
6749  /// recent visible declaration of that namespace.
6750  llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
6751 
6752  /// \brief Whether we are in a SFINAE context that is not associated with
6753  /// template instantiation.
6754  ///
6755  /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
6756  /// of a template instantiation or template argument deduction.
6758 
6759  /// \brief The number of ActiveTemplateInstantiation entries in
6760  /// \c ActiveTemplateInstantiations that are not actual instantiations and,
6761  /// therefore, should not be counted as part of the instantiation depth.
6763 
6764  /// \brief The last template from which a template instantiation
6765  /// error or warning was produced.
6766  ///
6767  /// This value is used to suppress printing of redundant template
6768  /// instantiation backtraces when there are multiple errors in the
6769  /// same instantiation. FIXME: Does this belong in Sema? It's tough
6770  /// to implement it anywhere else.
6772 
6773  /// \brief The current index into pack expansion arguments that will be
6774  /// used for substitution of parameter packs.
6775  ///
6776  /// The pack expansion index will be -1 to indicate that parameter packs
6777  /// should be instantiated as themselves. Otherwise, the index specifies
6778  /// which argument within the parameter pack will be used for substitution.
6780 
6781  /// \brief RAII object used to change the argument pack substitution index
6782  /// within a \c Sema object.
6783  ///
6784  /// See \c ArgumentPackSubstitutionIndex for more information.
6786  Sema &Self;
6787  int OldSubstitutionIndex;
6788 
6789  public:
6790  ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
6791  : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
6792  Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
6793  }
6794 
6796  Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
6797  }
6798  };
6799 
6801 
6802  /// \brief For each declaration that involved template argument deduction, the
6803  /// set of diagnostics that were suppressed during that template argument
6804  /// deduction.
6805  ///
6806  /// FIXME: Serialize this structure to the AST file.
6807  typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
6810 
6811  /// \brief A stack object to be created when performing template
6812  /// instantiation.
6813  ///
6814  /// Construction of an object of type \c InstantiatingTemplate
6815  /// pushes the current instantiation onto the stack of active
6816  /// instantiations. If the size of this stack exceeds the maximum
6817  /// number of recursive template instantiations, construction
6818  /// produces an error and evaluates true.
6819  ///
6820  /// Destruction of this object will pop the named instantiation off
6821  /// the stack.
6823  /// \brief Note that we are instantiating a class template,
6824  /// function template, variable template, alias template,
6825  /// or a member thereof.
6826  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6827  Decl *Entity,
6828  SourceRange InstantiationRange = SourceRange());
6829 
6831  /// \brief Note that we are instantiating an exception specification
6832  /// of a function template.
6833  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6835  SourceRange InstantiationRange = SourceRange());
6836 
6837  /// \brief Note that we are instantiating a default argument in a
6838  /// template-id.
6839  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6840  TemplateDecl *Template,
6841  ArrayRef<TemplateArgument> TemplateArgs,
6842  SourceRange InstantiationRange = SourceRange());
6843 
6844  /// \brief Note that we are instantiating a default argument in a
6845  /// template-id.
6846  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6847  FunctionTemplateDecl *FunctionTemplate,
6848  ArrayRef<TemplateArgument> TemplateArgs,
6850  sema::TemplateDeductionInfo &DeductionInfo,
6851  SourceRange InstantiationRange = SourceRange());
6852 
6853  /// \brief Note that we are instantiating as part of template
6854  /// argument deduction for a class template partial
6855  /// specialization.
6856  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6858  ArrayRef<TemplateArgument> TemplateArgs,
6859  sema::TemplateDeductionInfo &DeductionInfo,
6860  SourceRange InstantiationRange = SourceRange());
6861 
6862  /// \brief Note that we are instantiating as part of template
6863  /// argument deduction for a variable template partial
6864  /// specialization.
6865  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6867  ArrayRef<TemplateArgument> TemplateArgs,
6868  sema::TemplateDeductionInfo &DeductionInfo,
6869  SourceRange InstantiationRange = SourceRange());
6870 
6871  /// \brief Note that we are instantiating a default argument for a function
6872  /// parameter.
6873  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6874  ParmVarDecl *Param,
6875  ArrayRef<TemplateArgument> TemplateArgs,
6876  SourceRange InstantiationRange = SourceRange());
6877 
6878  /// \brief Note that we are substituting prior template arguments into a
6879  /// non-type parameter.
6880  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6881  NamedDecl *Template,
6882  NonTypeTemplateParmDecl *Param,
6883  ArrayRef<TemplateArgument> TemplateArgs,
6884  SourceRange InstantiationRange);
6885 
6886  /// \brief Note that we are substituting prior template arguments into a
6887  /// template template parameter.
6888  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6889  NamedDecl *Template,
6890  TemplateTemplateParmDecl *Param,
6891  ArrayRef<TemplateArgument> TemplateArgs,
6892  SourceRange InstantiationRange);
6893 
6894  /// \brief Note that we are checking the default template argument
6895  /// against the template parameter for a given template-id.
6896  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
6897  TemplateDecl *Template,
6898  NamedDecl *Param,
6899  ArrayRef<TemplateArgument> TemplateArgs,
6900  SourceRange InstantiationRange);
6901 
6902 
6903  /// \brief Note that we have finished instantiating this template.
6904  void Clear();
6905 
6906  ~InstantiatingTemplate() { Clear(); }
6907 
6908  /// \brief Determines whether we have exceeded the maximum
6909  /// recursive template instantiations.
6910  bool isInvalid() const { return Invalid; }
6911 
6912  private:
6913  Sema &SemaRef;
6914  bool Invalid;
6915  bool SavedInNonInstantiationSFINAEContext;
6916  bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
6917  SourceRange InstantiationRange);
6918 
6921  SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
6922  Decl *Entity, NamedDecl *Template = nullptr,
6923  ArrayRef<TemplateArgument> TemplateArgs = None,
6924  sema::TemplateDeductionInfo *DeductionInfo = nullptr);
6925 
6927 
6929  operator=(const InstantiatingTemplate&) = delete;
6930  };
6931 
6932  void PrintInstantiationStack();
6933 
6934  /// \brief Determines whether we are currently in a context where
6935  /// template argument substitution failures are not considered
6936  /// errors.
6937  ///
6938  /// \returns An empty \c Optional if we're not in a SFINAE context.
6939  /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
6940  /// template-deduction context object, which can be used to capture
6941  /// diagnostics that will be suppressed.
6943 
6944  /// \brief Determines whether we are currently in a context that
6945  /// is not evaluated as per C++ [expr] p5.
6946  bool isUnevaluatedContext() const {
6947  assert(!ExprEvalContexts.empty() &&
6948  "Must be in an expression evaluation context");
6949  return ExprEvalContexts.back().isUnevaluated();
6950  }
6951 
6952  /// \brief RAII class used to determine whether SFINAE has
6953  /// trapped any errors that occur during template argument
6954  /// deduction.
6955  class SFINAETrap {
6956  Sema &SemaRef;
6957  unsigned PrevSFINAEErrors;
6958  bool PrevInNonInstantiationSFINAEContext;
6959  bool PrevAccessCheckingSFINAE;
6960 
6961  public:
6962  explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
6963  : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
6964  PrevInNonInstantiationSFINAEContext(
6966  PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE)
6967  {
6968  if (!SemaRef.isSFINAEContext())
6969  SemaRef.InNonInstantiationSFINAEContext = true;
6971  }
6972 
6974  SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
6976  = PrevInNonInstantiationSFINAEContext;
6977  SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
6978  }
6979 
6980  /// \brief Determine whether any SFINAE errors have been trapped.
6981  bool hasErrorOccurred() const {
6982  return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
6983  }
6984  };
6985 
6986  /// \brief RAII class used to indicate that we are performing provisional
6987  /// semantic analysis to determine the validity of a construct, so
6988  /// typo-correction and diagnostics in the immediate context (not within
6989  /// implicitly-instantiated templates) should be suppressed.
6991  Sema &SemaRef;
6992  // FIXME: Using a SFINAETrap for this is a hack.
6993  SFINAETrap Trap;
6994  bool PrevDisableTypoCorrection;
6995  public:
6996  explicit TentativeAnalysisScope(Sema &SemaRef)
6997  : SemaRef(SemaRef), Trap(SemaRef, true),
6998  PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
6999  SemaRef.DisableTypoCorrection = true;
7000  }
7002  SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
7003  }
7004  };
7005 
7006  /// \brief The current instantiation scope used to store local
7007  /// variables.
7009 
7010  /// \brief Tracks whether we are in a context where typo correction is
7011  /// disabled.
7013 
7014  /// \brief The number of typos corrected by CorrectTypo.
7015  unsigned TyposCorrected;
7016 
7017  typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
7018  typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
7019 
7020  /// \brief A cache containing identifiers for which typo correction failed and
7021  /// their locations, so that repeated attempts to correct an identifier in a
7022  /// given location are ignored if typo correction already failed for it.
7024 
7025  /// \brief Worker object for performing CFG-based warnings.
7028 
7029  /// \brief An entity for which implicit template instantiation is required.
7030  ///
7031  /// The source location associated with the declaration is the first place in
7032  /// the source code where the declaration was "used". It is not necessarily
7033  /// the point of instantiation (which will be either before or after the
7034  /// namespace-scope declaration that triggered this implicit instantiation),
7035  /// However, it is the location that diagnostics should generally refer to,
7036  /// because users will need to know what code triggered the instantiation.
7037  typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
7038 
7039  /// \brief The queue of implicit template instantiations that are required
7040  /// but have not yet been performed.
7041  std::deque<PendingImplicitInstantiation> PendingInstantiations;
7042 
7044  public:
7046  : S(S), Enabled(Enabled) {
7047  if (!Enabled) return;
7048 
7049  SavedPendingInstantiations.swap(S.PendingInstantiations);
7050  SavedVTableUses.swap(S.VTableUses);
7051  }
7052 
7054  if (!Enabled) return;
7055 
7056  // Restore the set of pending vtables.
7057  assert(S.VTableUses.empty() &&
7058  "VTableUses should be empty before it is discarded.");
7059  S.VTableUses.swap(SavedVTableUses);
7060 
7061  // Restore the set of pending implicit instantiations.
7062  assert(S.PendingInstantiations.empty() &&
7063  "PendingInstantiations should be empty before it is discarded.");
7064  S.PendingInstantiations.swap(SavedPendingInstantiations);
7065  }
7066 
7067  private:
7068  Sema &S;
7069  SmallVector<VTableUse, 16> SavedVTableUses;
7070  std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
7071  bool Enabled;
7072  };
7073 
7074  /// \brief The queue of implicit template instantiations that are required
7075  /// and must be performed within the current local scope.
7076  ///
7077  /// This queue is only used for member functions of local classes in
7078  /// templates, which must be instantiated in the same scope as their
7079  /// enclosing function, so that they can reference function-local
7080  /// types, static variables, enumerators, etc.
7081  std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
7082 
7084  public:
7086  SavedPendingLocalImplicitInstantiations.swap(
7088  }
7089 
7091  assert(S.PendingLocalImplicitInstantiations.empty() &&
7092  "there shouldn't be any pending local implicit instantiations");
7093  SavedPendingLocalImplicitInstantiations.swap(
7094  S.PendingLocalImplicitInstantiations);
7095  }
7096 
7097  private:
7098  Sema &S;
7099  std::deque<PendingImplicitInstantiation>
7100  SavedPendingLocalImplicitInstantiations;
7101  };
7102 
7103  /// A helper class for building up ExtParameterInfos.
7106  bool HasInteresting = false;
7107 
7108  public:
7109  /// Set the ExtParameterInfo for the parameter at the given index,
7110  ///
7111  void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
7112  assert(Infos.size() <= index);
7113  Infos.resize(index);
7114  Infos.push_back(info);
7115 
7116  if (!HasInteresting)
7117  HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
7118  }
7119 
7120  /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
7121  /// ExtParameterInfo array we've built up.
7123  getPointerOrNull(unsigned numParams) {
7124  if (!HasInteresting) return nullptr;
7125  Infos.resize(numParams);
7126  return Infos.data();
7127  }
7128  };
7129 
7130  void PerformPendingInstantiations(bool LocalOnly = false);
7131 
7133  const MultiLevelTemplateArgumentList &TemplateArgs,
7134  SourceLocation Loc, DeclarationName Entity);
7135 
7137  const MultiLevelTemplateArgumentList &TemplateArgs,
7138  SourceLocation Loc, DeclarationName Entity);
7139 
7141  const MultiLevelTemplateArgumentList &TemplateArgs,
7142  SourceLocation Loc, DeclarationName Entity);
7143 
7145  const MultiLevelTemplateArgumentList &TemplateArgs,
7146  SourceLocation Loc,
7147  DeclarationName Entity,
7148  CXXRecordDecl *ThisContext,
7149  unsigned ThisTypeQuals);
7150  void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
7151  const MultiLevelTemplateArgumentList &Args);
7153  const MultiLevelTemplateArgumentList &TemplateArgs,
7154  int indexAdjustment,
7155  Optional<unsigned> NumExpansions,
7156  bool ExpectParameterPack);
7158  const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
7159  const MultiLevelTemplateArgumentList &TemplateArgs,
7160  SmallVectorImpl<QualType> &ParamTypes,
7161  SmallVectorImpl<ParmVarDecl *> *OutParams,
7162  ExtParameterInfoBuilder &ParamInfos);
7164  const MultiLevelTemplateArgumentList &TemplateArgs);
7165 
7166  /// \brief Substitute the given template arguments into a list of
7167  /// expressions, expanding pack expansions if required.
7168  ///
7169  /// \param Exprs The list of expressions to substitute into.
7170  ///
7171  /// \param IsCall Whether this is some form of call, in which case
7172  /// default arguments will be dropped.
7173  ///
7174  /// \param TemplateArgs The set of template arguments to substitute.
7175  ///
7176  /// \param Outputs Will receive all of the substituted arguments.
7177  ///
7178  /// \returns true if an error occurred, false otherwise.
7179  bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
7180  const MultiLevelTemplateArgumentList &TemplateArgs,
7181  SmallVectorImpl<Expr *> &Outputs);
7182 
7184  const MultiLevelTemplateArgumentList &TemplateArgs);
7185 
7186  Decl *SubstDecl(Decl *D, DeclContext *Owner,
7187  const MultiLevelTemplateArgumentList &TemplateArgs);
7188 
7190  const MultiLevelTemplateArgumentList &TemplateArgs,
7191  bool CXXDirectInit);
7192 
7193  bool
7194  SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
7195  CXXRecordDecl *Pattern,
7196  const MultiLevelTemplateArgumentList &TemplateArgs);
7197 
7198  bool
7199  InstantiateClass(SourceLocation PointOfInstantiation,
7200  CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
7201  const MultiLevelTemplateArgumentList &TemplateArgs,
7203  bool Complain = true);
7204 
7205  bool InstantiateEnum(SourceLocation PointOfInstantiation,
7206  EnumDecl *Instantiation, EnumDecl *Pattern,
7207  const MultiLevelTemplateArgumentList &TemplateArgs,
7209 
7211  SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
7212  FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
7213 
7215  const Attr *TmplAttr;
7218 
7220  Decl *D)
7221  : TmplAttr(A), Scope(S), NewDecl(D)
7222  { }
7223  };
7225 
7226  void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
7227  const Decl *Pattern, Decl *Inst,
7228  LateInstantiatedAttrVec *LateAttrs = nullptr,
7229  LocalInstantiationScope *OuterMostScope = nullptr);
7230 
7231  bool
7233  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7235  bool Complain = true);
7236 
7237  void InstantiateClassMembers(SourceLocation PointOfInstantiation,
7238  CXXRecordDecl *Instantiation,
7239  const MultiLevelTemplateArgumentList &TemplateArgs,
7241 
7243  SourceLocation PointOfInstantiation,
7244  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7246 
7249  const MultiLevelTemplateArgumentList &TemplateArgs);
7250 
7253  const MultiLevelTemplateArgumentList &TemplateArgs);
7254  TemplateName
7256  SourceLocation Loc,
7257  const MultiLevelTemplateArgumentList &TemplateArgs);
7258  bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
7260  const MultiLevelTemplateArgumentList &TemplateArgs);
7261 
7262  void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
7263  FunctionDecl *Function);
7264  void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
7265  FunctionDecl *Function,
7266  bool Recursive = false,
7267  bool DefinitionRequired = false,
7268  bool AtEndOfTU = false);
7270  VarTemplateDecl *VarTemplate, VarDecl *FromVar,
7271  const TemplateArgumentList &TemplateArgList,
7272  const TemplateArgumentListInfo &TemplateArgsInfo,
7274  SourceLocation PointOfInstantiation, void *InsertPos,
7275  LateInstantiatedAttrVec *LateAttrs = nullptr,
7276  LocalInstantiationScope *StartingScope = nullptr);
7278  VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
7279  const MultiLevelTemplateArgumentList &TemplateArgs);
7280  void
7281  BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar,
7282  const MultiLevelTemplateArgumentList &TemplateArgs,
7283  LateInstantiatedAttrVec *LateAttrs,
7284  DeclContext *Owner,
7285  LocalInstantiationScope *StartingScope,
7286  bool InstantiatingVarTemplate = false);
7288  VarDecl *Var, VarDecl *OldVar,
7289  const MultiLevelTemplateArgumentList &TemplateArgs);
7290  void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
7291  VarDecl *Var, bool Recursive = false,
7292  bool DefinitionRequired = false,
7293  bool AtEndOfTU = false);
7295  SourceLocation PointOfInstantiation,
7296  VarDecl *Var,
7297  bool Recursive = false,
7298  bool DefinitionRequired = false);
7299 
7301  const CXXConstructorDecl *Tmpl,
7302  const MultiLevelTemplateArgumentList &TemplateArgs);
7303 
7305  const MultiLevelTemplateArgumentList &TemplateArgs);
7307  const MultiLevelTemplateArgumentList &TemplateArgs);
7308 
7309  // Objective-C declarations.
7311  OCK_None = -1,
7318  };
7320 
7322  ObjCTypeParamVariance variance,
7323  SourceLocation varianceLoc,
7324  unsigned index,
7325  IdentifierInfo *paramName,
7326  SourceLocation paramLoc,
7327  SourceLocation colonLoc,
7328  ParsedType typeBound);
7329 
7331  ArrayRef<Decl *> typeParams,
7332  SourceLocation rAngleLoc);
7333  void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
7334 
7336  SourceLocation AtInterfaceLoc,
7337  IdentifierInfo *ClassName,
7338  SourceLocation ClassLoc,
7339  ObjCTypeParamList *typeParamList,
7340  IdentifierInfo *SuperName,
7341  SourceLocation SuperLoc,
7342  ArrayRef<ParsedType> SuperTypeArgs,
7343  SourceRange SuperTypeArgsRange,
7344  Decl * const *ProtoRefs,
7345  unsigned NumProtoRefs,
7346  const SourceLocation *ProtoLocs,
7347  SourceLocation EndProtoLoc,
7348  AttributeList *AttrList);
7349 
7351  SourceLocation AtInterfaceLoc,
7352  ObjCInterfaceDecl *IDecl,
7353  IdentifierInfo *ClassName,
7354  SourceLocation ClassLoc,
7355  IdentifierInfo *SuperName,
7356  SourceLocation SuperLoc,
7357  ArrayRef<ParsedType> SuperTypeArgs,
7358  SourceRange SuperTypeArgsRange);
7359 
7361  IdentifierInfo *SuperName,
7362  SourceLocation SuperLoc);
7363 
7365  SourceLocation AtCompatibilityAliasLoc,
7366  IdentifierInfo *AliasName, SourceLocation AliasLocation,
7367  IdentifierInfo *ClassName, SourceLocation ClassLocation);
7368 
7370  IdentifierInfo *PName,
7371  SourceLocation &PLoc, SourceLocation PrevLoc,
7372  const ObjCList<ObjCProtocolDecl> &PList);
7373 
7375  SourceLocation AtProtoInterfaceLoc,
7376  IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
7377  Decl * const *ProtoRefNames, unsigned NumProtoRefs,
7378  const SourceLocation *ProtoLocs,
7379  SourceLocation EndProtoLoc,
7380  AttributeList *AttrList);
7381 
7383  IdentifierInfo *ClassName,
7384  SourceLocation ClassLoc,
7385  ObjCTypeParamList *typeParamList,
7386  IdentifierInfo *CategoryName,
7387  SourceLocation CategoryLoc,
7388  Decl * const *ProtoRefs,
7389  unsigned NumProtoRefs,
7390  const SourceLocation *ProtoLocs,
7391  SourceLocation EndProtoLoc);
7392 
7394  SourceLocation AtClassImplLoc,
7395  IdentifierInfo *ClassName, SourceLocation ClassLoc,
7396  IdentifierInfo *SuperClassname,
7397  SourceLocation SuperClassLoc);
7398 
7400  IdentifierInfo *ClassName,
7401  SourceLocation ClassLoc,
7402  IdentifierInfo *CatName,
7403  SourceLocation CatLoc);
7404 
7406  ArrayRef<Decl *> Decls);
7407 
7409  IdentifierInfo **IdentList,
7410  SourceLocation *IdentLocs,
7411  ArrayRef<ObjCTypeParamList *> TypeParamLists,
7412  unsigned NumElts);
7413 
7415  ArrayRef<IdentifierLocPair> IdentList,
7416  AttributeList *attrList);
7417 
7418  void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
7419  ArrayRef<IdentifierLocPair> ProtocolId,
7420  SmallVectorImpl<Decl *> &Protocols);
7421 
7423  SourceLocation ProtocolLoc,
7424  IdentifierInfo *TypeArgId,
7425  SourceLocation TypeArgLoc,
7426  bool SelectProtocolFirst = false);
7427 
7428  /// Given a list of identifiers (and their locations), resolve the
7429  /// names to either Objective-C protocol qualifiers or type
7430  /// arguments, as appropriate.
7432  Scope *S,
7433  ParsedType baseType,
7434  SourceLocation lAngleLoc,
7435  ArrayRef<IdentifierInfo *> identifiers,
7436  ArrayRef<SourceLocation> identifierLocs,
7437  SourceLocation rAngleLoc,
7438  SourceLocation &typeArgsLAngleLoc,
7439  SmallVectorImpl<ParsedType> &typeArgs,
7440  SourceLocation &typeArgsRAngleLoc,
7441  SourceLocation &protocolLAngleLoc,
7442  SmallVectorImpl<Decl *> &protocols,
7443  SourceLocation &protocolRAngleLoc,
7444  bool warnOnIncompleteProtocols);
7445 
7446  /// Build a an Objective-C protocol-qualified 'id' type where no
7447  /// base type was specified.
7449  SourceLocation lAngleLoc,
7450  ArrayRef<Decl *> protocols,
7451  ArrayRef<SourceLocation> protocolLocs,
7452  SourceLocation rAngleLoc);
7453 
7454  /// Build a specialized and/or protocol-qualified Objective-C type.
7456  Scope *S,
7457  SourceLocation Loc,
7458  ParsedType BaseType,
7459  SourceLocation TypeArgsLAngleLoc,
7460  ArrayRef<ParsedType> TypeArgs,
7461  SourceLocation TypeArgsRAngleLoc,
7462  SourceLocation ProtocolLAngleLoc,
7463  ArrayRef<Decl *> Protocols,
7464  ArrayRef<SourceLocation> ProtocolLocs,
7465  SourceLocation ProtocolRAngleLoc);
7466 
7467  /// Build an Objective-C object pointer type.
7469  SourceLocation Loc,
7470  SourceLocation TypeArgsLAngleLoc,
7471  ArrayRef<TypeSourceInfo *> TypeArgs,
7472  SourceLocation TypeArgsRAngleLoc,
7473  SourceLocation ProtocolLAngleLoc,
7474  ArrayRef<ObjCProtocolDecl *> Protocols,
7475  ArrayRef<SourceLocation> ProtocolLocs,
7476  SourceLocation ProtocolRAngleLoc,
7477  bool FailOnError = false);
7478 
7479  /// Check the application of the Objective-C '__kindof' qualifier to
7480  /// the given type.
7482 
7483  /// Ensure attributes are consistent with type.
7484  /// \param [in, out] Attributes The attributes to check; they will
7485  /// be modified to be consistent with \p PropertyTy.
7486  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
7487  SourceLocation Loc,
7488  unsigned &Attributes,
7489  bool propertyInPrimaryClass);
7490 
7491  /// Process the specified property declaration and create decls for the
7492  /// setters and getters as needed.
7493  /// \param property The property declaration being processed
7494  void ProcessPropertyDecl(ObjCPropertyDecl *property);
7495 
7496 
7498  ObjCPropertyDecl *SuperProperty,
7499  const IdentifierInfo *Name,
7500  bool OverridingProtocolProperty);
7501 
7504 
7505  Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
7506  ArrayRef<Decl *> allMethods = None,
7507  ArrayRef<DeclGroupPtrTy> allTUVars = None);
7508 
7510  SourceLocation LParenLoc,
7511  FieldDeclarator &FD, ObjCDeclSpec &ODS,
7512  Selector GetterSel, Selector SetterSel,
7513  tok::ObjCKeywordKind MethodImplKind,
7514  DeclContext *lexicalDC = nullptr);
7515 
7517  SourceLocation AtLoc,
7518  SourceLocation PropertyLoc,
7519  bool ImplKind,
7520  IdentifierInfo *PropertyId,
7521  IdentifierInfo *PropertyIvar,
7522  SourceLocation PropertyIvarLoc,
7523  ObjCPropertyQueryKind QueryKind);
7524 
7532  };
7533 
7534  struct ObjCArgInfo {
7537  // The Type is null if no type was specified, and the DeclSpec is invalid
7538  // in this case.
7541 
7542  /// ArgAttrs - Attribute list for this argument.
7544  };
7545 
7547  Scope *S,
7548  SourceLocation BeginLoc, // location of the + or -.
7549  SourceLocation EndLoc, // location of the ; or {.
7550  tok::TokenKind MethodType,
7551  ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
7552  ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
7553  // optional arguments. The number of types/arguments is obtained
7554  // from the Sel.getNumArgs().
7555  ObjCArgInfo *ArgInfo,
7556  DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, // c-style args
7557  AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind,
7558  bool isVariadic, bool MethodDefinition);
7559 
7561  const ObjCObjectPointerType *OPT,
7562  bool IsInstance);
7564  bool IsInstance);
7565 
7566  bool CheckARCMethodDecl(ObjCMethodDecl *method);
7568 
7569  ExprResult
7571  Expr *BaseExpr,
7572  SourceLocation OpLoc,
7573  DeclarationName MemberName,
7574  SourceLocation MemberLoc,
7575  SourceLocation SuperLoc, QualType SuperType,
7576  bool Super);
7577 
7578  ExprResult
7580  IdentifierInfo &propertyName,
7581  SourceLocation receiverNameLoc,
7582  SourceLocation propertyNameLoc);
7583 
7585 
7586  /// \brief Describes the kind of message expression indicated by a message
7587  /// send that starts with an identifier.
7589  /// \brief The message is sent to 'super'.
7591  /// \brief The message is an instance message.
7593  /// \brief The message is a class message, and the identifier is a type
7594  /// name.
7596  };
7597 
7599  IdentifierInfo *Name,
7600  SourceLocation NameLoc,
7601  bool IsSuper,
7602  bool HasTrailingDot,
7603  ParsedType &ReceiverType);
7604 
7606  Selector Sel,
7607  SourceLocation LBracLoc,
7608  ArrayRef<SourceLocation> SelectorLocs,
7609  SourceLocation RBracLoc,
7610  MultiExprArg Args);
7611 
7612  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
7613  QualType ReceiverType,
7614  SourceLocation SuperLoc,
7615  Selector Sel,
7616  ObjCMethodDecl *Method,
7617  SourceLocation LBracLoc,
7618  ArrayRef<SourceLocation> SelectorLocs,
7619  SourceLocation RBracLoc,
7620  MultiExprArg Args,
7621  bool isImplicit = false);
7622 
7624  bool isSuperReceiver,
7625  SourceLocation Loc,
7626  Selector Sel,
7627  ObjCMethodDecl *Method,
7628  MultiExprArg Args);
7629 
7631  ParsedType Receiver,
7632  Selector Sel,
7633  SourceLocation LBracLoc,
7634  ArrayRef<SourceLocation> SelectorLocs,
7635  SourceLocation RBracLoc,
7636  MultiExprArg Args);
7637 
7639  QualType ReceiverType,
7640  SourceLocation SuperLoc,
7641  Selector Sel,
7642  ObjCMethodDecl *Method,
7643  SourceLocation LBracLoc,
7644  ArrayRef<SourceLocation> SelectorLocs,
7645  SourceLocation RBracLoc,
7646  MultiExprArg Args,
7647  bool isImplicit = false);
7648 
7650  QualType ReceiverType,
7651  SourceLocation Loc,
7652  Selector Sel,
7653  ObjCMethodDecl *Method,
7654  MultiExprArg Args);
7655 
7657  Expr *Receiver,
7658  Selector Sel,
7659  SourceLocation LBracLoc,
7660  ArrayRef<SourceLocation> SelectorLocs,
7661  SourceLocation RBracLoc,
7662  MultiExprArg Args);
7663 
7665  ObjCBridgeCastKind Kind,
7666  SourceLocation BridgeKeywordLoc,
7667  TypeSourceInfo *TSInfo,
7668  Expr *SubExpr);
7669 
7671  SourceLocation LParenLoc,
7672  ObjCBridgeCastKind Kind,
7673  SourceLocation BridgeKeywordLoc,
7674  ParsedType Type,
7675  SourceLocation RParenLoc,
7676  Expr *SubExpr);
7677 
7678  void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr);
7679 
7681 
7683  CastKind &Kind);
7684 
7686  QualType DestType, QualType SrcType,
7687  ObjCInterfaceDecl *&RelatedClass,
7688  ObjCMethodDecl *&ClassMethod,
7689  ObjCMethodDecl *&InstanceMethod,
7690  TypedefNameDecl *&TDNDecl,
7691  bool CfToNs, bool Diagnose = true);
7692 
7694  QualType DestType, QualType SrcType,
7695  Expr *&SrcExpr, bool Diagnose = true);
7696 
7697  bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr,
7698  bool Diagnose = true);
7699 
7700  bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
7701 
7702  /// \brief Check whether the given new method is a valid override of the
7703  /// given overridden method, and set any properties that should be inherited.
7704  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
7705  const ObjCMethodDecl *Overridden);
7706 
7707  /// \brief Describes the compatibility of a result type with its method.
7712  };
7713 
7714  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
7715  ObjCInterfaceDecl *CurrentClass,
7717 
7719  POAK_Native, // #pragma options align=native
7720  POAK_Natural, // #pragma options align=natural
7721  POAK_Packed, // #pragma options align=packed
7722  POAK_Power, // #pragma options align=power
7723  POAK_Mac68k, // #pragma options align=mac68k
7724  POAK_Reset // #pragma options align=reset
7725  };
7726 
7727  /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
7729  SourceLocation PragmaLoc);
7730 
7731  /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
7733  StringRef SlotLabel, Expr *Alignment);
7734 
7735  /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
7737 
7738  /// ActOnPragmaMSComment - Called on well formed
7739  /// \#pragma comment(kind, "arg").
7741  StringRef Arg);
7742 
7743  /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
7744  /// pointers_to_members(representation method[, general purpose
7745  /// representation]).
7748  SourceLocation PragmaLoc);
7749 
7750  /// \brief Called on well formed \#pragma vtordisp().
7752  SourceLocation PragmaLoc,
7753  MSVtorDispAttr::Mode Value);
7754 
7760  };
7761 
7762  bool UnifySection(StringRef SectionName,
7763  int SectionFlags,
7764  DeclaratorDecl *TheDecl);
7765  bool UnifySection(StringRef SectionName,
7766  int SectionFlags,
7767  SourceLocation PragmaSectionLocation);
7768 
7769  /// \brief Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
7770  void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
7772  llvm::StringRef StackSlotLabel,
7773  StringLiteral *SegmentName,
7774  llvm::StringRef PragmaName);
7775 
7776  /// \brief Called on well formed \#pragma section().
7777  void ActOnPragmaMSSection(SourceLocation PragmaLocation,
7778  int SectionFlags, StringLiteral *SegmentName);
7779 
7780  /// \brief Called on well-formed \#pragma init_seg().
7781  void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
7782  StringLiteral *SegmentName);
7783 
7784  /// \brief Called on #pragma clang __debug dump II
7786 
7787  /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
7788  void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
7789  StringRef Value);
7790 
7791  /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
7792  void ActOnPragmaUnused(const Token &Identifier,
7793  Scope *curScope,
7794  SourceLocation PragmaLoc);
7795 
7796  /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
7797  void ActOnPragmaVisibility(const IdentifierInfo* VisType,
7798  SourceLocation PragmaLoc);
7799 
7801  SourceLocation Loc);
7802  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);
7803 
7804  /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
7805  void ActOnPragmaWeakID(IdentifierInfo* WeakName,
7806  SourceLocation PragmaLoc,
7807  SourceLocation WeakNameLoc);
7808 
7809  /// ActOnPragmaRedefineExtname - Called on well formed
7810  /// \#pragma redefine_extname oldname newname.
7812  IdentifierInfo* AliasName,
7813  SourceLocation PragmaLoc,
7814  SourceLocation WeakNameLoc,
7815  SourceLocation AliasNameLoc);
7816 
7817  /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
7818  void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
7819  IdentifierInfo* AliasName,
7820  SourceLocation PragmaLoc,
7821  SourceLocation WeakNameLoc,
7822  SourceLocation AliasNameLoc);
7823 
7824  /// ActOnPragmaFPContract - Called on well formed
7825  /// \#pragma {STDC,OPENCL} FP_CONTRACT
7827 
7828  /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
7829  /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
7831 
7832  /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
7834 
7835  /// FreePackedContext - Deallocate and null out PackContext.
7836  void FreePackedContext();
7837 
7838  /// PushNamespaceVisibilityAttr - Note that we've entered a
7839  /// namespace with a visibility attribute.
7840  void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
7841  SourceLocation Loc);
7842 
7843  /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
7844  /// add an appropriate visibility attribute.
7846 
7847  /// PopPragmaVisibility - Pop the top element of the visibility stack; used
7848  /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
7849  void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
7850 
7851  /// FreeVisContext - Deallocate and null out VisContext.
7852  void FreeVisContext();
7853 
7854  /// AddCFAuditedAttribute - Check whether we're currently within
7855  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
7856  /// the appropriate attribute.
7857  void AddCFAuditedAttribute(Decl *D);
7858 
7859  /// \brief Called on well formed \#pragma clang optimize.
7860  void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
7861 
7862  /// \brief Get the location for the currently active "\#pragma clang optimize
7863  /// off". If this location is invalid, then the state of the pragma is "on".
7866  }
7867 
7868  /// \brief Only called on function definitions; if there is a pragma in scope
7869  /// with the effect of a range-based optnone, consider marking the function
7870  /// with attribute optnone.
7872 
7873  /// \brief Adds the 'optnone' attribute to the function declaration if there
7874  /// are no conflicts; Loc represents the location causing the 'optnone'
7875  /// attribute to be added (usually because of a pragma).
7877 
7878  /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
7879  void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
7880  unsigned SpellingListIndex, bool IsPackExpansion);
7881  void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T,
7882  unsigned SpellingListIndex, bool IsPackExpansion);
7883 
7884  /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
7885  /// declaration.
7886  void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE,
7887  unsigned SpellingListIndex);
7888 
7889  /// AddAlignValueAttr - Adds an align_value attribute to a particular
7890  /// declaration.
7891  void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E,
7892  unsigned SpellingListIndex);
7893 
7894  /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
7895  /// declaration.
7896  void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads,
7897  Expr *MinBlocks, unsigned SpellingListIndex);
7898 
7899  /// AddModeAttr - Adds a mode attribute to a particular declaration.
7900  void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name,
7901  unsigned SpellingListIndex, bool InInstantiation = false);
7902 
7903  void AddParameterABIAttr(SourceRange AttrRange, Decl *D,
7904  ParameterABI ABI, unsigned SpellingListIndex);
7905 
7906  void AddNSConsumedAttr(SourceRange AttrRange, Decl *D,
7907  unsigned SpellingListIndex, bool isNSConsumed,
7909 
7910  //===--------------------------------------------------------------------===//
7911  // C++ Coroutines TS
7912  //
7916 
7920 
7921  void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body);
7922 
7923  //===--------------------------------------------------------------------===//
7924  // OpenMP directives and clauses.
7925  //
7926 private:
7927  void *VarDataSharingAttributesStack;
7928  /// Set to true inside '#pragma omp declare target' region.
7929  bool IsInOpenMPDeclareTargetContext = false;
7930  /// \brief Initialization of data-sharing attributes stack.
7931  void InitDataSharingAttributesStack();
7932  void DestroyDataSharingAttributesStack();
7933  ExprResult
7934  VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
7935  bool StrictlyPositive = true);
7936  /// Returns OpenMP nesting level for current directive.
7937  unsigned getOpenMPNestingLevel() const;
7938 
7939 public:
7940  /// \brief Return true if the provided declaration \a VD should be captured by
7941  /// reference.
7942  /// \param Level Relative level of nested OpenMP construct for that the check
7943  /// is performed.
7944  bool IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level);
7945 
7946  /// \brief Check if the specified variable is used in one of the private
7947  /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
7948  /// constructs.
7951  ExprObjectKind OK, SourceLocation Loc);
7952 
7953  /// \brief Check if the specified variable is used in 'private' clause.
7954  /// \param Level Relative level of nested OpenMP construct for that the check
7955  /// is performed.
7956  bool isOpenMPPrivateDecl(ValueDecl *D, unsigned Level);
7957 
7958  /// \brief Check if the specified variable is captured by 'target' directive.
7959  /// \param Level Relative level of nested OpenMP construct for that the check
7960  /// is performed.
7961  bool isOpenMPTargetCapturedDecl(ValueDecl *D, unsigned Level);
7962 
7964  Expr *Op);
7965  /// \brief Called on start of new data sharing attribute block.
7967  const DeclarationNameInfo &DirName, Scope *CurScope,
7968  SourceLocation Loc);
7969  /// \brief Start analysis of clauses.
7971  /// \brief End analysis of clauses.
7972  void EndOpenMPClause();
7973  /// \brief Called on end of data sharing attribute block.
7974  void EndOpenMPDSABlock(Stmt *CurDirective);
7975 
7976  /// \brief Check if the current region is an OpenMP loop region and if it is,
7977  /// mark loop control variable, used in \p Init for loop initialization, as
7978  /// private by default.
7979  /// \param Init First part of the for loop.
7981 
7982  // OpenMP directives and clauses.
7983  /// \brief Called on correct id-expression from the '#pragma omp
7984  /// threadprivate'.
7986  CXXScopeSpec &ScopeSpec,
7987  const DeclarationNameInfo &Id);
7988  /// \brief Called on well-formed '#pragma omp threadprivate'.
7990  SourceLocation Loc,
7991  ArrayRef<Expr *> VarList);
7992  /// \brief Builds a new OpenMPThreadPrivateDecl and checks its correctness.
7994  SourceLocation Loc,
7995  ArrayRef<Expr *> VarList);
7996  /// \brief Check if the specified type is allowed to be used in 'omp declare
7997  /// reduction' construct.
8000  /// \brief Called on start of '#pragma omp declare reduction'.
8002  Scope *S, DeclContext *DC, DeclarationName Name,
8003  ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
8004  AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
8005  /// \brief Initialize declare reduction construct initializer.
8007  /// \brief Finish current declare reduction construct initializer.
8008  void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner);
8009  /// \brief Initialize declare reduction construct initializer.
8011  /// \brief Finish current declare reduction construct initializer.
8012  void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer);
8013  /// \brief Called at the end of '#pragma omp declare reduction'.
8015  Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
8016 
8017  /// Called on the start of target region i.e. '#pragma omp declare target'.
8019  /// Called at the end of target region i.e. '#pragme omp end declare target'.
8021  /// Called on correct id-expression from the '#pragma omp declare target'.
8022  void ActOnOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec,
8023  const DeclarationNameInfo &Id,
8024  OMPDeclareTargetDeclAttr::MapTypeTy MT,
8025  NamedDeclSetType &SameDirectiveDecls);
8026  /// Check declaration inside target region.
8028  /// Return true inside OpenMP target region.
8030  return IsInOpenMPDeclareTargetContext;
8031  }
8032 
8033  /// \brief Initialization of captured region for OpenMP region.
8034  void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
8035  /// \brief End of OpenMP region.
8036  ///
8037  /// \param S Statement associated with the current OpenMP region.
8038  /// \param Clauses List of clauses for the current OpenMP region.
8039  ///
8040  /// \returns Statement for finished OpenMP region.
8043  OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
8044  OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
8045  Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
8046  /// \brief Called on well-formed '\#pragma omp parallel' after parsing
8047  /// of the associated statement.
8049  Stmt *AStmt,
8050  SourceLocation StartLoc,
8051  SourceLocation EndLoc);
8052  /// \brief Called on well-formed '\#pragma omp simd' after parsing
8053  /// of the associated statement.
8055  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8056  SourceLocation EndLoc,
8057  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8058  /// \brief Called on well-formed '\#pragma omp for' after parsing
8059  /// of the associated statement.
8061  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8062  SourceLocation EndLoc,
8063  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8064  /// \brief Called on well-formed '\#pragma omp for simd' after parsing
8065  /// of the associated statement.
8067  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8068  SourceLocation EndLoc,
8069  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8070  /// \brief Called on well-formed '\#pragma omp sections' after parsing
8071  /// of the associated statement.
8073  Stmt *AStmt, SourceLocation StartLoc,
8074  SourceLocation EndLoc);
8075  /// \brief Called on well-formed '\#pragma omp section' after parsing of the
8076  /// associated statement.
8078  SourceLocation EndLoc);
8079  /// \brief Called on well-formed '\#pragma omp single' after parsing of the
8080  /// associated statement.
8082  Stmt *AStmt, SourceLocation StartLoc,
8083  SourceLocation EndLoc);
8084  /// \brief Called on well-formed '\#pragma omp master' after parsing of the
8085  /// associated statement.
8087  SourceLocation EndLoc);
8088  /// \brief Called on well-formed '\#pragma omp critical' after parsing of the
8089  /// associated statement.
8091  ArrayRef<OMPClause *> Clauses,
8092  Stmt *AStmt, SourceLocation StartLoc,
8093  SourceLocation EndLoc);
8094  /// \brief Called on well-formed '\#pragma omp parallel for' after parsing
8095  /// of the associated statement.
8097  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8098  SourceLocation EndLoc,
8099  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8100  /// \brief Called on well-formed '\#pragma omp parallel for simd' after
8101  /// parsing of the associated statement.
8103  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8104  SourceLocation EndLoc,
8105  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8106  /// \brief Called on well-formed '\#pragma omp parallel sections' after
8107  /// parsing of the associated statement.
8109  Stmt *AStmt,
8110  SourceLocation StartLoc,
8111  SourceLocation EndLoc);
8112  /// \brief Called on well-formed '\#pragma omp task' after parsing of the
8113  /// associated statement.
8115  Stmt *AStmt, SourceLocation StartLoc,
8116  SourceLocation EndLoc);
8117  /// \brief Called on well-formed '\#pragma omp taskyield'.
8119  SourceLocation EndLoc);
8120  /// \brief Called on well-formed '\#pragma omp barrier'.
8122  SourceLocation EndLoc);
8123  /// \brief Called on well-formed '\#pragma omp taskwait'.
8125  SourceLocation EndLoc);
8126  /// \brief Called on well-formed '\#pragma omp taskgroup'.
8128  SourceLocation EndLoc);
8129  /// \brief Called on well-formed '\#pragma omp flush'.
8131  SourceLocation StartLoc,
8132  SourceLocation EndLoc);
8133  /// \brief Called on well-formed '\#pragma omp ordered' after parsing of the
8134  /// associated statement.
8136  Stmt *AStmt, SourceLocation StartLoc,
8137  SourceLocation EndLoc);
8138  /// \brief Called on well-formed '\#pragma omp atomic' after parsing of the
8139  /// associated statement.
8141  Stmt *AStmt, SourceLocation StartLoc,
8142  SourceLocation EndLoc);
8143  /// \brief Called on well-formed '\#pragma omp target' after parsing of the
8144  /// associated statement.
8146  Stmt *AStmt, SourceLocation StartLoc,
8147  SourceLocation EndLoc);
8148  /// \brief Called on well-formed '\#pragma omp target data' after parsing of
8149  /// the associated statement.
8151  Stmt *AStmt, SourceLocation StartLoc,
8152  SourceLocation EndLoc);
8153  /// \brief Called on well-formed '\#pragma omp target enter data' after
8154  /// parsing of the associated statement.
8156  SourceLocation StartLoc,
8157  SourceLocation EndLoc);
8158  /// \brief Called on well-formed '\#pragma omp target exit data' after
8159  /// parsing of the associated statement.
8161  SourceLocation StartLoc,
8162  SourceLocation EndLoc);
8163  /// \brief Called on well-formed '\#pragma omp target parallel' after
8164  /// parsing of the associated statement.
8166  Stmt *AStmt,
8167  SourceLocation StartLoc,
8168  SourceLocation EndLoc);
8169  /// \brief Called on well-formed '\#pragma omp target parallel for' after
8170  /// parsing of the associated statement.
8172  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8173  SourceLocation EndLoc,
8174  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8175  /// \brief Called on well-formed '\#pragma omp teams' after parsing of the
8176  /// associated statement.
8178  Stmt *AStmt, SourceLocation StartLoc,
8179  SourceLocation EndLoc);
8180  /// \brief Called on well-formed '\#pragma omp cancellation point'.
8181  StmtResult
8183  SourceLocation EndLoc,
8184  OpenMPDirectiveKind CancelRegion);
8185  /// \brief Called on well-formed '\#pragma omp cancel'.
8187  SourceLocation StartLoc,
8188  SourceLocation EndLoc,
8189  OpenMPDirectiveKind CancelRegion);
8190  /// \brief Called on well-formed '\#pragma omp taskloop' after parsing of the
8191  /// associated statement.
8193  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8194  SourceLocation EndLoc,
8195  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8196  /// \brief Called on well-formed '\#pragma omp taskloop simd' after parsing of
8197  /// the associated statement.
8199  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8200  SourceLocation EndLoc,
8201  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8202  /// \brief Called on well-formed '\#pragma omp distribute' after parsing
8203  /// of the associated statement.
8205  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8206  SourceLocation EndLoc,
8207  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8208  /// \brief Called on well-formed '\#pragma omp target update'.
8210  SourceLocation StartLoc,
8211  SourceLocation EndLoc);
8212  /// \brief Called on well-formed '\#pragma omp distribute parallel for' after
8213  /// parsing of the associated statement.
8215  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8216  SourceLocation EndLoc,
8217  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8218  /// \brief Called on well-formed '\#pragma omp distribute parallel for simd'
8219  /// after parsing of the associated statement.
8221  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8222  SourceLocation EndLoc,
8223  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8224  /// \brief Called on well-formed '\#pragma omp distribute simd' after
8225  /// parsing of the associated statement.
8227  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8228  SourceLocation EndLoc,
8229  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8230  /// \brief Called on well-formed '\#pragma omp target parallel for simd' after
8231  /// parsing of the associated statement.
8233  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8234  SourceLocation EndLoc,
8235  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8236 
8237  /// Checks correctness of linear modifiers.
8239  SourceLocation LinLoc);
8240  /// Checks that the specified declaration matches requirements for the linear
8241  /// decls.
8244 
8245  /// \brief Called on well-formed '\#pragma omp declare simd' after parsing of
8246  /// the associated method/function.
8248  DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
8249  Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
8250  ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
8251  ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
8252 
8254  Expr *Expr,
8255  SourceLocation StartLoc,
8256  SourceLocation LParenLoc,
8257  SourceLocation EndLoc);
8258  /// \brief Called on well-formed 'if' clause.
8260  Expr *Condition, SourceLocation StartLoc,
8261  SourceLocation LParenLoc,
8262  SourceLocation NameModifierLoc,
8264  SourceLocation EndLoc);
8265  /// \brief Called on well-formed 'final' clause.
8266  OMPClause *ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc,
8267  SourceLocation LParenLoc,
8268  SourceLocation EndLoc);
8269  /// \brief Called on well-formed 'num_threads' clause.
8271  SourceLocation StartLoc,
8272  SourceLocation LParenLoc,
8273  SourceLocation EndLoc);
8274  /// \brief Called on well-formed 'safelen' clause.
8276  SourceLocation StartLoc,
8277  SourceLocation LParenLoc,
8278  SourceLocation EndLoc);
8279  /// \brief Called on well-formed 'simdlen' clause.
8281  SourceLocation LParenLoc,
8282  SourceLocation EndLoc);
8283  /// \brief Called on well-formed 'collapse' clause.
8285  SourceLocation StartLoc,
8286  SourceLocation LParenLoc,
8287  SourceLocation EndLoc);
8288  /// \brief Called on well-formed 'ordered' clause.
8289  OMPClause *
8291  SourceLocation LParenLoc = SourceLocation(),
8292  Expr *NumForLoops = nullptr);
8293  /// \brief Called on well-formed 'grainsize' clause.
8295  SourceLocation LParenLoc,
8296  SourceLocation EndLoc);
8297  /// \brief Called on well-formed 'num_tasks' clause.
8299  SourceLocation LParenLoc,
8300  SourceLocation EndLoc);
8301  /// \brief Called on well-formed 'hint' clause.
8303  SourceLocation LParenLoc,
8304  SourceLocation EndLoc);
8305 
8307  unsigned Argument,
8308  SourceLocation ArgumentLoc,
8309  SourceLocation StartLoc,
8310  SourceLocation LParenLoc,
8311  SourceLocation EndLoc);
8312  /// \brief Called on well-formed 'default' clause.
8314  SourceLocation KindLoc,
8315  SourceLocation StartLoc,
8316  SourceLocation LParenLoc,
8317  SourceLocation EndLoc);
8318  /// \brief Called on well-formed 'proc_bind' clause.
8320  SourceLocation KindLoc,
8321  SourceLocation StartLoc,
8322  SourceLocation LParenLoc,
8323  SourceLocation EndLoc);
8324 
8326  OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
8327  SourceLocation StartLoc, SourceLocation LParenLoc,
8328  ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
8329  SourceLocation EndLoc);
8330  /// \brief Called on well-formed 'schedule' clause.
8333  OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
8334  SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
8335  SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
8336 
8338  SourceLocation EndLoc);
8339  /// \brief Called on well-formed 'nowait' clause.
8341  SourceLocation EndLoc);
8342  /// \brief Called on well-formed 'untied' clause.
8344  SourceLocation EndLoc);
8345  /// \brief Called on well-formed 'mergeable' clause.
8347  SourceLocation EndLoc);
8348  /// \brief Called on well-formed 'read' clause.
8350  SourceLocation EndLoc);
8351  /// \brief Called on well-formed 'write' clause.
8353  SourceLocation EndLoc);
8354  /// \brief Called on well-formed 'update' clause.
8356  SourceLocation EndLoc);
8357  /// \brief Called on well-formed 'capture' clause.
8359  SourceLocation EndLoc);
8360  /// \brief Called on well-formed 'seq_cst' clause.
8362  SourceLocation EndLoc);
8363  /// \brief Called on well-formed 'threads' clause.
8365  SourceLocation EndLoc);
8366  /// \brief Called on well-formed 'simd' clause.
8368  SourceLocation EndLoc);
8369  /// \brief Called on well-formed 'nogroup' clause.
8371  SourceLocation EndLoc);
8372 
8374  OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
8375  SourceLocation StartLoc, SourceLocation LParenLoc,
8377  CXXScopeSpec &ReductionIdScopeSpec,
8378  const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind,
8379  OpenMPLinearClauseKind LinKind, OpenMPMapClauseKind MapTypeModifier,
8380  OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
8381  SourceLocation DepLinMapLoc);
8382  /// \brief Called on well-formed 'private' clause.
8384  SourceLocation StartLoc,
8385  SourceLocation LParenLoc,
8386  SourceLocation EndLoc);
8387  /// \brief Called on well-formed 'firstprivate' clause.
8389  SourceLocation StartLoc,
8390  SourceLocation LParenLoc,
8391  SourceLocation EndLoc);
8392  /// \brief Called on well-formed 'lastprivate' clause.
8394  SourceLocation StartLoc,
8395  SourceLocation LParenLoc,
8396  SourceLocation EndLoc);
8397  /// \brief Called on well-formed 'shared' clause.
8399  SourceLocation StartLoc,
8400  SourceLocation LParenLoc,
8401  SourceLocation EndLoc);
8402  /// \brief Called on well-formed 'reduction' clause.
8404  ArrayRef<Expr *> VarList, SourceLocation StartLoc,
8406  CXXScopeSpec &ReductionIdScopeSpec,
8407  const DeclarationNameInfo &ReductionId,
8408  ArrayRef<Expr *> UnresolvedReductions = llvm::None);
8409  /// \brief Called on well-formed 'linear' clause.
8410  OMPClause *
8412  SourceLocation StartLoc, SourceLocation LParenLoc,
8413  OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
8415  /// \brief Called on well-formed 'aligned' clause.
8417  Expr *Alignment,
8418  SourceLocation StartLoc,
8419  SourceLocation LParenLoc,
8421  SourceLocation EndLoc);
8422  /// \brief Called on well-formed 'copyin' clause.
8424  SourceLocation StartLoc,
8425  SourceLocation LParenLoc,
8426  SourceLocation EndLoc);
8427  /// \brief Called on well-formed 'copyprivate' clause.
8429  SourceLocation StartLoc,
8430  SourceLocation LParenLoc,
8431  SourceLocation EndLoc);
8432  /// \brief Called on well-formed 'flush' pseudo clause.
8434  SourceLocation StartLoc,
8435  SourceLocation LParenLoc,
8436  SourceLocation EndLoc);
8437  /// \brief Called on well-formed 'depend' clause.
8438  OMPClause *
8441  SourceLocation StartLoc, SourceLocation LParenLoc,
8442  SourceLocation EndLoc);
8443  /// \brief Called on well-formed 'device' clause.
8445  SourceLocation LParenLoc,
8446  SourceLocation EndLoc);
8447  /// \brief Called on well-formed 'map' clause.
8448  OMPClause *
8449  ActOnOpenMPMapClause(OpenMPMapClauseKind MapTypeModifier,
8450  OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
8452  ArrayRef<Expr *> VarList, SourceLocation StartLoc,
8453  SourceLocation LParenLoc, SourceLocation EndLoc);
8454  /// \brief Called on well-formed 'num_teams' clause.
8456  SourceLocation LParenLoc,
8457  SourceLocation EndLoc);
8458  /// \brief Called on well-formed 'thread_limit' clause.
8460  SourceLocation StartLoc,
8461  SourceLocation LParenLoc,
8462  SourceLocation EndLoc);
8463  /// \brief Called on well-formed 'priority' clause.
8465  SourceLocation LParenLoc,
8466  SourceLocation EndLoc);
8467  /// \brief Called on well-formed 'dist_schedule' clause.
8469  OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
8470  SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
8471  SourceLocation CommaLoc, SourceLocation EndLoc);
8472  /// \brief Called on well-formed 'defaultmap' clause.
8475  SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
8476  SourceLocation KindLoc, SourceLocation EndLoc);
8477  /// \brief Called on well-formed 'to' clause.
8479  SourceLocation StartLoc,
8480  SourceLocation LParenLoc,
8481  SourceLocation EndLoc);
8482  /// \brief Called on well-formed 'from' clause.
8484  SourceLocation StartLoc,
8485  SourceLocation LParenLoc,
8486  SourceLocation EndLoc);
8487  /// Called on well-formed 'use_device_ptr' clause.
8489  SourceLocation StartLoc,
8490  SourceLocation LParenLoc,
8491  SourceLocation EndLoc);
8492  /// Called on well-formed 'is_device_ptr' clause.
8494  SourceLocation StartLoc,
8495  SourceLocation LParenLoc,
8496  SourceLocation EndLoc);
8497 
8498  /// \brief The kind of conversion being performed.
8500  /// \brief An implicit conversion.
8502  /// \brief A C-style cast.
8504  /// \brief A functional-style cast.
8506  /// \brief A cast other than a C-style cast.
8508  };
8509 
8510  /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
8511  /// cast. If there is already an implicit cast, merge into the existing one.
8512  /// If isLvalue, the result of the cast is an lvalue.
8514  ExprValueKind VK = VK_RValue,
8515  const CXXCastPath *BasePath = nullptr,
8518 
8519  /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
8520  /// to the conversion from scalar type ScalarTy to the Boolean type.
8522 
8523  /// IgnoredValueConversions - Given that an expression's result is
8524  /// syntactically ignored, perform any conversions that are
8525  /// required.
8527 
8528  // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
8529  // functions and arrays to their respective pointers (C99 6.3.2.1).
8531 
8532  /// CallExprUnaryConversions - a special case of an unary conversion
8533  /// performed on a function designator of a call expression.
8535 
8536  // DefaultFunctionArrayConversion - converts functions and arrays
8537  // to their respective pointers (C99 6.3.2.1).
8538  ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose = true);
8539 
8540  // DefaultFunctionArrayLvalueConversion - converts functions and
8541  // arrays to their respective pointers and performs the
8542  // lvalue-to-rvalue conversion.
8544  bool Diagnose = true);
8545 
8546  // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
8547  // the operand. This is DefaultFunctionArrayLvalueConversion,
8548  // except that it assumes the operand isn't of function or array
8549  // type.
8551 
8552  // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
8553  // do not have a prototype. Integer promotions are performed on each
8554  // argument, and arguments that have type float are promoted to double.
8556 
8557  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
8564  };
8565 
8567  const FunctionProtoType *Proto,
8568  Expr *Fn);
8569 
8570  // Used for determining in which context a type is allowed to be passed to a
8571  // vararg function.
8572  enum VarArgKind {
8578  };
8579 
8580  // Determines which VarArgKind fits an expression.
8582 
8583  /// Check to see if the given expression is a valid argument to a variadic
8584  /// function, issuing a diagnostic if not.
8585  void checkVariadicArgument(const Expr *E, VariadicCallType CT);
8586 
8587  /// Check to see if a given expression could have '.c_str()' called on it.
8588  bool hasCStrMethod(const Expr *E);
8589 
8590  /// GatherArgumentsForCall - Collector argument expressions for various
8591  /// form of call prototypes.
8592  bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
8593  const FunctionProtoType *Proto,
8594  unsigned FirstParam, ArrayRef<Expr *> Args,
8595  SmallVectorImpl<Expr *> &AllArgs,
8597  bool AllowExplicit = false,
8598  bool IsListInitialization = false);
8599 
8600  // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
8601  // will create a runtime trap if the resulting type is not a POD type.
8603  FunctionDecl *FDecl);
8604 
8605  // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
8606  // operands and then handles various conversions that are common to binary
8607  // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
8608  // routine returns the first non-arithmetic type found. The client is
8609  // responsible for emitting appropriate error diagnostics.
8611  bool IsCompAssign = false);
8612 
8613  /// AssignConvertType - All of the 'assignment' semantic checks return this
8614  /// enum to indicate whether the assignment was allowed. These checks are
8615  /// done for simple assignments, as well as initialization, return from
8616  /// function, argument passing, etc. The query is phrased in terms of a
8617  /// source and destination type.
8619  /// Compatible - the types are compatible according to the standard.
8621 
8622  /// PointerToInt - The assignment converts a pointer to an int, which we
8623  /// accept as an extension.
8625 
8626  /// IntToPointer - The assignment converts an int to a pointer, which we
8627  /// accept as an extension.
8629 
8630  /// FunctionVoidPointer - The assignment is between a function pointer and
8631  /// void*, which the standard doesn't allow, but we accept as an extension.
8633 
8634  /// IncompatiblePointer - The assignment is between two pointers types that
8635  /// are not compatible, but we accept them as an extension.
8637 
8638  /// IncompatiblePointer - The assignment is between two pointers types which
8639  /// point to integers which have a different sign, but are otherwise
8640  /// identical. This is a subset of the above, but broken out because it's by
8641  /// far the most common case of incompatible pointers.
8643 
8644  /// CompatiblePointerDiscardsQualifiers - The assignment discards
8645  /// c/v/r qualifiers, which we accept as an extension.
8647 
8648  /// IncompatiblePointerDiscardsQualifiers - The assignment
8649  /// discards qualifiers that we don't permit to be discarded,
8650  /// like address spaces.
8652 
8653  /// IncompatibleNestedPointerQualifiers - The assignment is between two
8654  /// nested pointer types, and the qualifiers other than the first two
8655  /// levels differ e.g. char ** -> const char **, but we accept them as an
8656  /// extension.
8658 
8659  /// IncompatibleVectors - The assignment is between two vector types that
8660  /// have the same size, which we accept as an extension.
8662 
8663  /// IntToBlockPointer - The assignment converts an int to a block
8664  /// pointer. We disallow this.
8666 
8667  /// IncompatibleBlockPointer - The assignment is between two block
8668  /// pointers types that are not compatible.
8670 
8671  /// IncompatibleObjCQualifiedId - The assignment is between a qualified
8672  /// id type and something else (that is incompatible with it). For example,
8673  /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
8675 
8676  /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
8677  /// object with __weak qualifier.
8679 
8680  /// Incompatible - We reject this conversion outright, it is invalid to
8681  /// represent it in the AST.
8683  };
8684 
8685  /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
8686  /// assignment conversion type specified by ConvTy. This returns true if the
8687  /// conversion was invalid or false if the conversion was accepted.
8689  SourceLocation Loc,
8690  QualType DstType, QualType SrcType,
8691  Expr *SrcExpr, AssignmentAction Action,
8692  bool *Complained = nullptr);
8693 
8694  /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
8695  /// enum. If AllowMask is true, then we also allow the complement of a valid
8696  /// value, to be used as a mask.
8697  bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
8698  bool AllowMask) const;
8699 
8700  /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
8701  /// integer not in the range of enum values.
8702  void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
8703  Expr *SrcExpr);
8704 
8705  /// CheckAssignmentConstraints - Perform type checking for assignment,
8706  /// argument passing, variable initialization, and function return values.
8707  /// C99 6.5.16.
8709  QualType LHSType,
8710  QualType RHSType);
8711 
8712  /// Check assignment constraints and optionally prepare for a conversion of
8713  /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
8714  /// is true.
8716  ExprResult &RHS,
8717  CastKind &Kind,
8718  bool ConvertRHS = true);
8719 
8720  // CheckSingleAssignmentConstraints - Currently used by
8721  // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking,
8722  // this routine performs the default function/array converions, if ConvertRHS
8723  // is true.
8725  ExprResult &RHS,
8726  bool Diagnose = true,
8727  bool DiagnoseCFAudited = false,
8728  bool ConvertRHS = true);
8729 
8730  // \brief If the lhs type is a transparent union, check whether we
8731  // can initialize the transparent union with the given expression.
8733  ExprResult &RHS);
8734 
8736 
8737  bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
8738 
8741  bool AllowExplicit = false);
8744  bool AllowExplicit,
8747  const ImplicitConversionSequence& ICS,
8752  const StandardConversionSequence& SCS,
8754  CheckedConversionKind CCK);
8755 
8756  /// the following "Check" methods will return a valid/converted QualType
8757  /// or a null QualType (indicating an error diagnostic was issued).
8758 
8759  /// type checking binary operators (subroutines of CreateBuiltinBinOp).
8761  ExprResult &RHS);
8763  ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
8764  SourceLocation OpLoc, bool isIndirect);
8766  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
8767  bool IsDivide);
8768  QualType CheckRemainderOperands( // C99 6.5.5
8769  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8770  bool IsCompAssign = false);
8771  QualType CheckAdditionOperands( // C99 6.5.6
8772  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8773  BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
8774  QualType CheckSubtractionOperands( // C99 6.5.6
8775  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8776  QualType* CompLHSTy = nullptr);
8777  QualType CheckShiftOperands( // C99 6.5.7
8778  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8779  BinaryOperatorKind Opc, bool IsCompAssign = false);
8780  QualType CheckCompareOperands( // C99 6.5.8/9
8781  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8782  BinaryOperatorKind Opc, bool isRelational);
8783  QualType CheckBitwiseOperands( // C99 6.5.[10...12]
8784  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8785  bool IsCompAssign = false);
8786  QualType CheckLogicalOperands( // C99 6.5.[13,14]
8787  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
8788  BinaryOperatorKind Opc);
8789  // CheckAssignmentOperands is used for both simple and compound assignment.
8790  // For simple assignment, pass both expressions and a null converted type.
8791  // For compound assignment, pass both expressions and the converted type.
8792  QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
8793  Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType);
8794 
8796  UnaryOperatorKind Opcode, Expr *Op);
8798  BinaryOperatorKind Opcode,
8799  Expr *LHS, Expr *RHS);
8802 
8803  QualType CheckConditionalOperands( // C99 6.5.15
8804  ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
8805  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
8807  ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
8808  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
8810  bool *NonStandardCompositeType = nullptr);
8812  ExprResult &E1, ExprResult &E2,
8813  bool *NonStandardCompositeType = nullptr) {
8814  Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
8815  QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp,
8816  NonStandardCompositeType);
8817  E1 = E1Tmp;
8818  E2 = E2Tmp;
8819  return Composite;
8820  }
8821 
8823  SourceLocation QuestionLoc);
8824 
8825  bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
8826  SourceLocation QuestionLoc);
8827 
8830  bool IsEqual, SourceRange Range);
8831 
8832  /// type checking for vector binary operators.
8834  SourceLocation Loc, bool IsCompAssign,
8835  bool AllowBothBool, bool AllowBoolConversion);
8838  SourceLocation Loc, bool isRelational);
8840  SourceLocation Loc);
8841 
8842  bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
8843  bool isLaxVectorConversion(QualType srcType, QualType destType);
8844 
8845  /// type checking declaration initializers (C99 6.7.8)
8847 
8848  // type checking C++ declaration initializers (C++ [dcl.init]).
8849 
8850  /// ReferenceCompareResult - Expresses the result of comparing two
8851  /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
8852  /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
8854  /// Ref_Incompatible - The two types are incompatible, so direct
8855  /// reference binding is not possible.
8857  /// Ref_Related - The two types are reference-related, which means
8858  /// that their unqualified forms (T1 and T2) are either the same
8859  /// or T1 is a base class of T2.
8861  /// Ref_Compatible_With_Added_Qualification - The two types are
8862  /// reference-compatible with added qualification, meaning that
8863  /// they are reference-compatible and the qualifiers on T1 (cv1)
8864  /// are greater than the qualifiers on T2 (cv2).
8866  /// Ref_Compatible - The two types are reference-compatible and
8867  /// have equivalent qualifiers (cv1 == cv2).
8869  };
8870 
8872  QualType T1, QualType T2,
8873  bool &DerivedToBase,
8874  bool &ObjCConversion,
8875  bool &ObjCLifetimeConversion);
8876 
8879  ExprValueKind &VK, CXXCastPath &Path);
8880 
8881  /// \brief Force an expression with unknown-type to an expression of the
8882  /// given type.
8884 
8885  /// \brief Type-check an expression that's being passed to an
8886  /// __unknown_anytype parameter.
8888  Expr *result, QualType &paramType);
8889 
8890  // CheckVectorCast - check type constraints for vectors.
8891  // Since vectors are an extension, there are no C standard reference for this.
8892  // We allow casting between vectors and integer datatypes of the same size.
8893  // returns true if the cast is invalid
8894  bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
8895  CastKind &Kind);
8896 
8897  /// \brief Prepare `SplattedExpr` for a vector splat operation, adding
8898  /// implicit casts if necessary.
8899  ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
8900 
8901  // CheckExtVectorCast - check type constraints for extended vectors.
8902  // Since vectors are an extension, there are no C standard reference for this.
8903  // We allow casting between vectors and integer datatypes of the same size,
8904  // or vectors and the element type of that vector.
8905  // returns the cast expr
8907  CastKind &Kind);
8908 
8910  SourceLocation LParenLoc,
8911  Expr *CastExpr,
8912  SourceLocation RParenLoc);
8913 
8915 
8916  /// \brief Checks for invalid conversions and casts between
8917  /// retainable pointers and other pointer kinds.
8919  QualType castType, Expr *&op,
8921  bool Diagnose = true,
8922  bool DiagnoseCFAudited = false,
8923  BinaryOperatorKind Opc = BO_PtrMemD
8924  );
8925 
8927  void diagnoseARCUnbridgedCast(Expr *e);
8928 
8930  QualType ExprType);
8931 
8932  /// checkRetainCycles - Check whether an Objective-C message send
8933  /// might create an obvious retain cycle.
8935  void checkRetainCycles(Expr *receiver, Expr *argument);
8936  void checkRetainCycles(VarDecl *Var, Expr *Init);
8937 
8938  /// checkUnsafeAssigns - Check whether +1 expr is being assigned
8939  /// to weak/__unsafe_unretained type.
8940  bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
8941 
8942  /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
8943  /// to weak/__unsafe_unretained expression.
8944  void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
8945 
8946  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
8947  /// \param Method - May be null.
8948  /// \param [out] ReturnType - The return type of the send.
8949  /// \return true iff there were any incompatible types.
8950  bool CheckMessageArgumentTypes(QualType ReceiverType,
8951  MultiExprArg Args, Selector Sel,
8952  ArrayRef<SourceLocation> SelectorLocs,
8953  ObjCMethodDecl *Method, bool isClassMessage,
8954  bool isSuperMessage,
8955  SourceLocation lbrac, SourceLocation rbrac,
8956  SourceRange RecRange,
8957  QualType &ReturnType, ExprValueKind &VK);
8958 
8959  /// \brief Determine the result of a message send expression based on
8960  /// the type of the receiver, the method expected to receive the message,
8961  /// and the form of the message send.
8963  ObjCMethodDecl *Method,
8964  bool isClassMessage, bool isSuperMessage);
8965 
8966  /// \brief If the given expression involves a message send to a method
8967  /// with a related result type, emit a note describing what happened.
8968  void EmitRelatedResultTypeNote(const Expr *E);
8969 
8970  /// \brief Given that we had incompatible pointer types in a return
8971  /// statement, check whether we're in a method with a related result
8972  /// type, and if so, emit a note describing what happened.
8974 
8976  Decl *ConditionVar;
8977  FullExprArg Condition;
8978  bool Invalid;
8979  bool HasKnownValue;
8980  bool KnownValue;
8981 
8982  friend class Sema;
8983  ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
8984  bool IsConstexpr)
8985  : ConditionVar(ConditionVar), Condition(Condition), Invalid(false),
8986  HasKnownValue(IsConstexpr && Condition.get() &&
8987  !Condition.get()->isValueDependent()),
8988  KnownValue(HasKnownValue &&
8989  !!Condition.get()->EvaluateKnownConstInt(S.Context)) {}
8990  explicit ConditionResult(bool Invalid)
8991  : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
8992  HasKnownValue(false), KnownValue(false) {}
8993 
8994  public:
8996  bool isInvalid() const { return Invalid; }
8997  std::pair<VarDecl *, Expr *> get() const {
8998  return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
8999  Condition.get());
9000  }
9002  if (!HasKnownValue)
9003  return None;
9004  return KnownValue;
9005  }
9006  };
9008 
9009  enum class ConditionKind {
9010  Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
9011  ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
9012  Switch ///< An integral condition for a 'switch' statement.
9013  };
9014 
9015  ConditionResult ActOnCondition(Scope *S, SourceLocation Loc,
9016  Expr *SubExpr, ConditionKind CK);
9017 
9018  ConditionResult ActOnConditionVariable(Decl *ConditionVar,
9019  SourceLocation StmtLoc,
9020  ConditionKind CK);
9021 
9023 
9025  SourceLocation StmtLoc,
9026  ConditionKind CK);
9028 
9029  /// CheckBooleanCondition - Diagnose problems involving the use of
9030  /// the given expression as a boolean condition (e.g. in an if
9031  /// statement). Also performs the standard function and array
9032  /// decays, possibly changing the input variable.
9033  ///
9034  /// \param Loc - A location associated with the condition, e.g. the
9035  /// 'if' keyword.
9036  /// \return true iff there were any errors
9038  bool IsConstexpr = false);
9039 
9040  /// DiagnoseAssignmentAsCondition - Given that an expression is
9041  /// being used as a boolean condition, warn if it's an assignment.
9043 
9044  /// \brief Redundant parentheses over an equality comparison can indicate
9045  /// that the user intended an assignment used as condition.
9047 
9048  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
9049  ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
9050 
9051  /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
9052  /// the specified width and sign. If an overflow occurs, detect it and emit
9053  /// the specified diagnostic.
9054  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
9055  unsigned NewWidth, bool NewSign,
9056  SourceLocation Loc, unsigned DiagID);
9057 
9058  /// Checks that the Objective-C declaration is declared in the global scope.
9059  /// Emits an error and marks the declaration as invalid if it's not declared
9060  /// in the global scope.
9061  bool CheckObjCDeclScope(Decl *D);
9062 
9063  /// \brief Abstract base class used for diagnosing integer constant
9064  /// expression violations.
9066  public:
9067  bool Suppress;
9068 
9069  VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { }
9070 
9071  virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) =0;
9072  virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR);
9073  virtual ~VerifyICEDiagnoser() { }
9074  };
9075 
9076  /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
9077  /// and reports the appropriate diagnostics. Returns false on success.
9078  /// Can optionally return the value of the expression.
9080  VerifyICEDiagnoser &Diagnoser,
9081  bool AllowFold = true);
9083  unsigned DiagID,
9084  bool AllowFold = true);
9086  llvm::APSInt *Result = nullptr);
9087 
9088  /// VerifyBitField - verifies that a bit field expression is an ICE and has
9089  /// the correct width, and that the field type is valid.
9090  /// Returns false on success.
9091  /// Can optionally return whether the bit-field is of width 0
9093  QualType FieldTy, bool IsMsStruct,
9094  Expr *BitWidth, bool *ZeroWidth = nullptr);
9095 
9102  };
9103 
9105 
9106  // CUDA function call preference. Must be ordered numerically from
9107  // worst to best.
9109  CFP_Never, // Invalid caller/callee combination.
9110  CFP_WrongSide, // Calls from host-device to host or device
9111  // function that do not match current compilation
9112  // mode. Only in effect if
9113  // LangOpts.CUDADisableTargetCallChecks is true.
9114  CFP_HostDevice, // Any calls to host/device functions.
9115  CFP_SameSide, // Calls from host-device to host or device
9116  // function matching current compilation mode.
9117  CFP_Native, // host-to-host or device-to-device calls.
9118  };
9119 
9120  /// Identifies relative preference of a given Caller/Callee
9121  /// combination, based on their host/device attributes.
9122  /// \param Caller function which needs address of \p Callee.
9123  /// nullptr in case of global context.
9124  /// \param Callee target function
9125  ///
9126  /// \returns preference value for particular Caller/Callee combination.
9128  const FunctionDecl *Callee);
9129 
9130  /// Determines whether Caller may invoke Callee, based on their CUDA
9131  /// host/device attributes. Returns true if the call is not allowed.
9132  bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee) {
9133  return IdentifyCUDAPreference(Caller, Callee) == CFP_Never;
9134  }
9135 
9136  /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
9137  /// depending on FD and the current compilation settings.
9139  const LookupResult &Previous);
9140 
9141  /// Finds a function in \p Matches with highest calling priority
9142  /// from \p Caller context and erases all functions with lower
9143  /// calling priority.
9144  void EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
9146  void EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
9149  const FunctionDecl *Caller,
9150  SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
9151 
9152  /// Given a implicit special member, infer its CUDA target from the
9153  /// calls it needs to make to underlying base/field special members.
9154  /// \param ClassDecl the class for which the member is being created.
9155  /// \param CSM the kind of special member.
9156  /// \param MemberDecl the special member itself.
9157  /// \param ConstRHS true if this is a copy operation with a const object on
9158  /// its RHS.
9159  /// \param Diagnose true if this call should emit diagnostics.
9160  /// \return true if there was an error inferring.
9161  /// The result of this call is implicit CUDA target attribute(s) attached to
9162  /// the member declaration.
9164  CXXSpecialMember CSM,
9165  CXXMethodDecl *MemberDecl,
9166  bool ConstRHS,
9167  bool Diagnose);
9168 
9169  /// \return true if \p CD can be considered empty according to CUDA
9170  /// (E.2.3.1 in CUDA 7.5 Programming guide).
9173 
9174  /// \name Code completion
9175  //@{
9176  /// \brief Describes the context in which code completion occurs.
9178  /// \brief Code completion occurs at top-level or namespace context.
9180  /// \brief Code completion occurs within a class, struct, or union.
9182  /// \brief Code completion occurs within an Objective-C interface, protocol,
9183  /// or category.
9185  /// \brief Code completion occurs within an Objective-C implementation or
9186  /// category implementation
9188  /// \brief Code completion occurs within the list of instance variables
9189  /// in an Objective-C interface, protocol, category, or implementation.
9191  /// \brief Code completion occurs following one or more template
9192  /// headers.
9194  /// \brief Code completion occurs following one or more template
9195  /// headers within a class.
9197  /// \brief Code completion occurs within an expression.
9199  /// \brief Code completion occurs within a statement, which may
9200  /// also be an expression or a declaration.
9202  /// \brief Code completion occurs at the beginning of the
9203  /// initialization statement (or expression) in a for loop.
9205  /// \brief Code completion occurs within the condition of an if,
9206  /// while, switch, or for statement.
9208  /// \brief Code completion occurs within the body of a function on a
9209  /// recovery path, where we do not have a specific handle on our position
9210  /// in the grammar.
9212  /// \brief Code completion occurs where only a type is permitted.
9214  /// \brief Code completion occurs in a parenthesized expression, which
9215  /// might also be a type cast.
9217  /// \brief Code completion occurs within a sequence of declaration
9218  /// specifiers within a function, method, or block.
9220  };
9221 
9224  ParserCompletionContext CompletionContext);
9225  void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
9226  bool AllowNonIdentifiers,
9227  bool AllowNestedNameSpecifiers);
9228 
9229  struct CodeCompleteExpressionData;
9231  const CodeCompleteExpressionData &Data);
9233  SourceLocation OpLoc,
9234  bool IsArrow);
9236  void CodeCompleteTag(Scope *S, unsigned TagSpec);
9239  void CodeCompleteCase(Scope *S);
9240  void CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args);
9242  ArrayRef<Expr *> Args);
9243  void CodeCompleteInitializer(Scope *S, Decl *D);
9244  void CodeCompleteReturn(Scope *S);
9245  void CodeCompleteAfterIf(Scope *S);
9246  void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS);
9247 
9249  bool EnteringContext);
9250  void CodeCompleteUsing(Scope *S);
9256  Decl *Constructor,
9257  ArrayRef<CXXCtorInitializer *> Initializers);
9258 
9260  bool AfterAmpersand);
9261 
9270  bool IsParameter);
9273  ArrayRef<IdentifierInfo *> SelIdents,
9274  bool AtArgumentExpression);
9276  ArrayRef<IdentifierInfo *> SelIdents,
9277  bool AtArgumentExpression,
9278  bool IsSuper = false);
9279  void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
9280  ArrayRef<IdentifierInfo *> SelIdents,
9281  bool AtArgumentExpression,
9282  ObjCInterfaceDecl *Super = nullptr);
9284  DeclGroupPtrTy IterationVar);
9286  ArrayRef<IdentifierInfo *> SelIdents);
9288  ArrayRef<IdentifierLocPair> Protocols);
9292  IdentifierInfo *ClassName,
9293  SourceLocation ClassNameLoc);
9296  IdentifierInfo *ClassName,
9297  SourceLocation ClassNameLoc);
9299  IdentifierInfo *ClassName,
9300  SourceLocation ClassNameLoc);
9303  IdentifierInfo *PropertyName);
9305  bool IsInstanceMethod,
9306  ParsedType ReturnType);
9308  bool IsInstanceMethod,
9309  bool AtParameterName,
9310  ParsedType ReturnType,
9311  ArrayRef<IdentifierInfo *> SelIdents);
9312  void CodeCompletePreprocessorDirective(bool InConditional);
9314  void CodeCompletePreprocessorMacroName(bool IsDefinition);
9317  IdentifierInfo *Macro,
9319  unsigned Argument);
9322  CodeCompletionTUInfo &CCTUInfo,
9324  //@}
9325 
9326  //===--------------------------------------------------------------------===//
9327  // Extra semantic analysis beyond the C type system
9328 
9329 public:
9331  unsigned ByteNo) const;
9332 
9333 private:
9334  void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
9335  const ArraySubscriptExpr *ASE=nullptr,
9336  bool AllowOnePastEnd=true, bool IndexNegated=false);
9337  void CheckArrayAccess(const Expr *E);
9338  // Used to grab the relevant information from a FormatAttr and a
9339  // FunctionDeclaration.
9340  struct FormatStringInfo {
9341  unsigned FormatIdx;
9342  unsigned FirstDataArg;
9343  bool HasVAListArg;
9344  };
9345 
9346  static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
9347  FormatStringInfo *FSI);
9348  bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
9349  const FunctionProtoType *Proto);
9350  bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
9351  ArrayRef<const Expr *> Args);
9352  bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
9353  const FunctionProtoType *Proto);
9354  bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
9355  void CheckConstructorCall(FunctionDecl *FDecl,
9356  ArrayRef<const Expr *> Args,
9357  const FunctionProtoType *Proto,
9358  SourceLocation Loc);
9359 
9360  void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
9361  ArrayRef<const Expr *> Args, bool IsMemberFunction,
9362  SourceLocation Loc, SourceRange Range,
9363  VariadicCallType CallType);
9364 
9365  bool CheckObjCString(Expr *Arg);
9366 
9367  ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
9368  unsigned BuiltinID, CallExpr *TheCall);
9369 
9370  bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
9371  unsigned MaxWidth);
9372  bool CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9373  bool CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9374 
9375  bool CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9376  bool CheckMipsBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9377  bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9378  bool CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9379  bool CheckPPCBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
9380 
9381  bool SemaBuiltinVAStartImpl(CallExpr *TheCall);
9382  bool SemaBuiltinVAStart(CallExpr *TheCall);
9383  bool SemaBuiltinMSVAStart(CallExpr *TheCall);
9384  bool SemaBuiltinVAStartARM(CallExpr *Call);
9385  bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
9386  bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
9387 
9388 public:
9389  // Used by C++ template instantiation.
9390  ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
9391  ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
9392  SourceLocation BuiltinLoc,
9393  SourceLocation RParenLoc);
9394 
9395 private:
9396  bool SemaBuiltinPrefetch(CallExpr *TheCall);
9397  bool SemaBuiltinAssume(CallExpr *TheCall);
9398  bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
9399  bool SemaBuiltinLongjmp(CallExpr *TheCall);
9400  bool SemaBuiltinSetjmp(CallExpr *TheCall);
9401  ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
9402  ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
9403  ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
9405  bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
9406  llvm::APSInt &Result);
9407  bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
9408  int Low, int High);
9409  bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
9410  int ArgNum, unsigned ExpectedFieldNum,
9411  bool AllowName);
9412 public:
9423  };
9424  static FormatStringType GetFormatStringType(const FormatAttr *Format);
9425 
9426  bool FormatStringHasSArg(const StringLiteral *FExpr);
9427 
9428  static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
9429 
9430 private:
9431  bool CheckFormatArguments(const FormatAttr *Format,
9433  bool IsCXXMember,
9434  VariadicCallType CallType,
9435  SourceLocation Loc, SourceRange Range,
9436  llvm::SmallBitVector &CheckedVarArgs);
9437  bool CheckFormatArguments(ArrayRef<const Expr *> Args,
9438  bool HasVAListArg, unsigned format_idx,
9439  unsigned firstDataArg, FormatStringType Type,
9440  VariadicCallType CallType,
9441  SourceLocation Loc, SourceRange range,
9442  llvm::SmallBitVector &CheckedVarArgs);
9443 
9444  void CheckAbsoluteValueFunction(const CallExpr *Call,
9445  const FunctionDecl *FDecl,
9446  IdentifierInfo *FnInfo);
9447 
9448  void CheckMemaccessArguments(const CallExpr *Call,
9449  unsigned BId,
9450  IdentifierInfo *FnName);
9451 
9452  void CheckStrlcpycatArguments(const CallExpr *Call,
9453  IdentifierInfo *FnName);
9454 
9455  void CheckStrncatArguments(const CallExpr *Call,
9456  IdentifierInfo *FnName);
9457 
9458  void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
9459  SourceLocation ReturnLoc,
9460  bool isObjCMethod = false,
9461  const AttrVec *Attrs = nullptr,
9462  const FunctionDecl *FD = nullptr);
9463 
9464  void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS);
9465  void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
9466  void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
9467  void CheckForIntOverflow(Expr *E);
9468  void CheckUnsequencedOperations(Expr *E);
9469 
9470  /// \brief Perform semantic checks on a completed expression. This will either
9471  /// be a full-expression or a default argument expression.
9472  void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
9473  bool IsConstexpr = false);
9474 
9475  void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
9476  Expr *Init);
9477 
9478  /// \brief Check if the given expression contains 'break' or 'continue'
9479  /// statement that produces control flow different from GCC.
9480  void CheckBreakContinueBinding(Expr *E);
9481 
9482  /// \brief Check whether receiver is mutable ObjC container which
9483  /// attempts to add itself into the container
9484  void CheckObjCCircularContainer(ObjCMessageExpr *Message);
9485 
9486  void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
9487  void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
9488  bool DeleteWasArrayForm);
9489 public:
9490  /// \brief Register a magic integral constant to be used as a type tag.
9491  void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
9492  uint64_t MagicValue, QualType Type,
9493  bool LayoutCompatible, bool MustBeNull);
9494 
9495  struct TypeTagData {
9497 
9498  TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull) :
9499  Type(Type), LayoutCompatible(LayoutCompatible),
9500  MustBeNull(MustBeNull)
9501  {}
9502 
9504 
9505  /// If true, \c Type should be compared with other expression's types for
9506  /// layout-compatibility.
9507  unsigned LayoutCompatible : 1;
9508  unsigned MustBeNull : 1;
9509  };
9510 
9511  /// A pair of ArgumentKind identifier and magic value. This uniquely
9512  /// identifies the magic value.
9513  typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
9514 
9515 private:
9516  /// \brief A map from magic value to type information.
9517  std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
9518  TypeTagForDatatypeMagicValues;
9519 
9520  /// \brief Peform checks on a call of a function with argument_with_type_tag
9521  /// or pointer_with_type_tag attributes.
9522  void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
9523  const Expr * const *ExprArgs);
9524 
9525  /// \brief The parser's current scope.
9526  ///
9527  /// The parser maintains this state here.
9528  Scope *CurScope;
9529 
9530  mutable IdentifierInfo *Ident_super;
9531  mutable IdentifierInfo *Ident___float128;
9532 
9533  /// Nullability type specifiers.
9534  IdentifierInfo *Ident__Nonnull = nullptr;
9535  IdentifierInfo *Ident__Nullable = nullptr;
9536  IdentifierInfo *Ident__Null_unspecified = nullptr;
9537 
9538  IdentifierInfo *Ident_NSError = nullptr;
9539 
9540 protected:
9541  friend class Parser;
9543  friend class ASTReader;
9544  friend class ASTDeclReader;
9545  friend class ASTWriter;
9546 
9547 public:
9548  /// Retrieve the keyword associated
9550 
9551  /// The struct behind the CFErrorRef pointer.
9552  RecordDecl *CFError = nullptr;
9553 
9554  /// Retrieve the identifier "NSError".
9556 
9557  /// \brief Retrieve the parser's current scope.
9558  ///
9559  /// This routine must only be used when it is certain that semantic analysis
9560  /// and the parser are in precisely the same context, which is not the case
9561  /// when, e.g., we are performing any kind of template instantiation.
9562  /// Therefore, the only safe places to use this scope are in the parser
9563  /// itself and in routines directly invoked from the parser and *never* from
9564  /// template substitution or instantiation.
9565  Scope *getCurScope() const { return CurScope; }
9566 
9568  return CurScope->incrementMSManglingNumber();
9569  }
9570 
9573 
9574  Decl *getObjCDeclContext() const;
9575 
9578  }
9579 
9581 
9583  const DeclContext *DC = getCurLexicalContext();
9584  // A category implicitly has the attribute of the interface.
9585  if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
9586  DC = CatD->getClassInterface();
9587  return DC;
9588  }
9589 
9590  /// \brief To be used for checking whether the arguments being passed to
9591  /// function exceeds the number of parameters expected for it.
9592  static bool TooManyArguments(size_t NumParams, size_t NumArgs,
9593  bool PartialOverloading = false) {
9594  // We check whether we're just after a comma in code-completion.
9595  if (NumArgs > 0 && PartialOverloading)
9596  return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
9597  return NumArgs > NumParams;
9598  }
9599 
9600  // Emitting members of dllexported classes is delayed until the class
9601  // (including field initializers) is fully parsed.
9603 };
9604 
9605 /// \brief RAII object that enters a new expression evaluation context.
9607  Sema &Actions;
9608  bool Entered = true;
9609 
9610 public:
9613  Decl *LambdaContextDecl = nullptr,
9614  bool IsDecltype = false,
9615  bool ShouldEnter = true)
9616  : Actions(Actions), Entered(ShouldEnter) {
9617  if (Entered)
9618  Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
9619  IsDecltype);
9620  }
9624  bool IsDecltype = false)
9625  : Actions(Actions) {
9626  Actions.PushExpressionEvaluationContext(NewContext,
9628  IsDecltype);
9629  }
9630 
9632  if (Entered)
9633  Actions.PopExpressionEvaluationContext();
9634  }
9635 };
9636 
9637 DeductionFailureInfo
9639  sema::TemplateDeductionInfo &Info);
9640 
9641 /// \brief Contains a late templated function.
9642 /// Will be parsed at the end of the translation unit, used by Sema & Parser.
9645  /// \brief The template function declaration to be late parsed.
9647 };
9648 
9649 } // end namespace clang
9650 
9651 #endif
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition: Sema.h:425
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:1341
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'reduction' clause.
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:7864
llvm::DenseMap< Selector, ObjCMethodDecl * > ProtocolsMethodsMap
Definition: Sema.h:3083
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
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:14195
VariadicCallType
Definition: Sema.h:8558
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: Sema.h:751
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Definition: SemaDecl.cpp:2650
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)
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
PragmaStack< StringLiteral * > CodeSegStack
Definition: Sema.h:409
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:526
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK)
Definition: SemaExpr.cpp:14402
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:1561
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1472
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
Definition: SemaType.cpp:5193
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:488
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:6736
int Position
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchers.h:1367
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:6077
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:216
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition: Sema.h:9132
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:476
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:9565
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
Definition: SemaExpr.cpp:5936
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:7543
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
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:13631
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
Definition: Sema.h:809
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition: Sema.h:6809
no exception specification
IdentifierInfo * getSuperIdentifier() const
Definition: Sema.cpp:1490
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement...
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:2424
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:6620
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false, bool ShouldEnter=true)
Definition: Sema.h:9611
unsigned Length
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition: SemaAttr.cpp:28
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension...
Definition: Sema.h:8624
bool ActOnStartOpenMPDeclareTargetDirective(SourceLocation Loc)
Called on the start of target region i.e. '#pragma omp declare target'.
Stores the type being destroyed by a pseudo-destructor expression.
Definition: ExprCXX.h:2078
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
Definition: SemaExpr.cpp:3215
A (possibly-)qualified type.
Definition: Type.h:598
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
ASTConsumer & Consumer
Definition: Sema.h:300
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:13706
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
Definition: SemaDecl.cpp:1419
Simple class containing the result of Sema::CorrectTypo.
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType)
Definition: SemaExpr.cpp:9968
TemplateDeductionResult
Describes the result of template argument deduction.
Definition: Sema.h:6414
LateTemplateParserCB * LateTemplateParser
Definition: Sema.h:559
bool isInvalid() const
Definition: Ownership.h:160
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:175
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool isActive() const
Determine whether this diagnostic is still active.
Definition: Diagnostic.h:915
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:172
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:15219
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition: Sema.h:1230
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:1127
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:142
Instantiation or recovery rebuild of a for-range statement.
Definition: Sema.h:3438
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
unsigned MSAsmLabelNameCounter
counter for internal MS Asm label names.
Definition: Sema.h:781
DeclContext * getCurLexicalContext() const
Definition: Sema.h:9576
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:3882
NameClassification(const IdentifierInfo *Keyword)
Definition: Sema.h:1574
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'use_device_ptr' clause.
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition: Sema.h:374
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:8507
LateParsedTemplateMapT LateParsedTemplateMap
Definition: Sema.h:554
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:5354
FormatStringType
Definition: Sema.h:9413
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
Definition: SemaExpr.cpp:7007
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
CorrectTypoKind
Definition: Sema.h:2903
static bool getPrintable(bool B)
Definition: Sema.h:1350
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:3523
DeclContext * getFunctionLevelDeclContext()
Definition: Sema.cpp:920
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
Definition: SemaExpr.cpp:3177
Code completion occurs within a class, struct, or union.
Definition: Sema.h:9181
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c.h:53
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:7328
Template argument deduction was successful.
Definition: Sema.h:6416
RecordDecl * MSVCGuidDecl
The MSVC "_GUID" struct, which is defined in MSVC header files.
Definition: Sema.h:730
OpenCL supported extensions and optional core features.
Definition: OpenCLOptions.h:24
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:406
Represents a lazily-loaded vector of data.
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
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:2705
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition: Sema.h:504
A class which encapsulates the logic for delaying diagnostics during parsing and other processing...
Definition: Sema.h:582
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
IntrusiveRefCntPtr< MangleNumberingContext > MangleNumbering
The context information used to mangle lambda expressions and block literals within this context...
Definition: Sema.h:868
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:1937
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:107
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:295
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
Definition: SemaExpr.cpp:6107
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:767
const LangOptions & getLangOpts() const
Definition: Sema.h:1062
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.
static ConditionResult ConditionError()
Definition: Sema.h:9007
An initializer.
Definition: Sema.h:6112
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:7588
Look up the name of an Objective-C protocol.
Definition: Sema.h:2739
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition: Sema.h:4691
OpenCLOptions OpenCLFeatures
Definition: Sema.h:294
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:278
We are matching the template parameter lists of two templates that might be redeclarations.
Definition: Sema.h:5971
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:2879
FullExprArg MakeFullExpr(Expr *Arg)
Definition: Sema.h:3328
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:2157
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:6130
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
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:6641
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2481
LazyVector< CXXConstructorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition: Sema.h:530
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:6625
StmtResult ActOnExprStmt(ExprResult Arg)
Definition: SemaStmt.cpp:44
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4135
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:2681
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:6691
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:10752
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
Definition: SemaDecl.cpp:10748
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:1771
ActionResult< Expr * > ExprResult
Definition: Ownership.h:253
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed...
Definition: SemaExpr.cpp:4499
The current expression is potentially evaluated at run time, which means that code may be generated t...
Definition: Sema.h:819
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
Definition: SemaLookup.cpp:726
ExprResult BuildCoawaitExpr(SourceLocation KwLoc, Expr *E)
ObjCSubscriptKind
Definition: Sema.h:2422
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Stmt *InitStmt, ConditionResult Cond)
Definition: SemaStmt.cpp:666
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:3056
llvm::StringRef StackSlotLabel
Definition: Sema.h:346
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition: Sema.h:328
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:8637
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:3052
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:11382
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:332
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
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:1139
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:8068
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:6117
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
Definition: SemaExpr.cpp:11959
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
void incrementMSManglingNumber() const
Definition: Sema.h:9567
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:4801
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.
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:776
void CodeCompleteUsing(Scope *S)
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:7041
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispAttr::Mode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:202
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition: Sema.h:8618
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2671
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl, bool ConsiderCudaAttrs=true)
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function...
Definition: SemaDecl.cpp:5292
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
Microsoft __if_exists.
Definition: Sema.h:6127
PragmaOptionsAlignKind
Definition: Sema.h:7718
bool isOpenMPTargetCapturedDecl(ValueDecl *D, unsigned Level)
Check if the specified variable is captured by 'target' directive.
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
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...
StringRef P
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition: Sema.h:713
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4084
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:315
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:810
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1619
The size of a bit-field.
Definition: Sema.h:6091
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
Definition: SemaType.cpp:2085
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
bool CheckVecStepExpr(Expr *E)
Definition: SemaExpr.cpp:3816
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
Definition: SemaInit.cpp:7821
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:14883
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:164
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4357
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
Definition: SemaExpr.cpp:12204
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition: Sema.h:6981
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, AttributeList *attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
The base class of the type hierarchy.
Definition: Type.h:1281
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:7081
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: Sema.h:3265
bool CheckOpenMPLinearDecl(ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type)
Checks that the specified declaration matches requirements for the linear decls.
OMPClause * ActOnOpenMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:8670
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:8428
MissingImportKind
Kinds of missing import.
Definition: Sema.h:1884
std::unique_ptr< llvm::MemoryBuffer > Buffer
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1124
Declaration of a variable template.
ForRangeStatus
Definition: Sema.h:2605
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition: Sema.h:5721
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
Definition: SemaExpr.cpp:14024
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:471
Template argument deduction produced inconsistent deduced values for the given template parameter...
Definition: Sema.h:6427
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Sema.h:2750
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:3406
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST...
Definition: Sema.h:8682
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:93
void ActOnExitFunctionContext()
Definition: SemaDecl.cpp:1214
LazyVector< const DeclaratorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition: Sema.h:522
A container of type source information.
Definition: Decl.h:62
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:1354
Wrapper for void* pointer.
Definition: Ownership.h:46
Parser - This implements a parser for the C family of languages.
Definition: Parse/Parser.h:57
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition: Sema.h:2721
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition: Sema.h:7037
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:161
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
Definition: SemaStmt.cpp:2660
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:225
IdentifierInfo * getFloat128Identifier() const
Definition: Sema.cpp:1496
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Definition: SemaExpr.cpp:9508
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
unsigned fp_contract
Definition: LangOptions.h:163
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition: Sema.h:619
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:1120
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target update'.
void ActOnPragmaFPContract(tok::OnOffSwitch OOS)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT.
Definition: SemaAttr.cpp:450
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
Abstract base class used for diagnosing integer constant expression violations.
Definition: Sema.h:9065
FileNullability Nullability
Definition: Sema.h:241
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:2760
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition: Sema.cpp:545
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2187
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3962
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:115
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:6762
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
Definition: SemaExpr.cpp:12949
We are instantiating a template declaration.
Definition: Sema.h:6613
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 InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, QualType Param1, QualType Param2=QualType())
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
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:6981
enum clang::Sema::ActiveTemplateInstantiation::InstantiationKind Kind
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
Definition: SemaExpr.cpp:12319
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:3441
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
bool checkObjCKindOfType(QualType &type, SourceLocation loc)
Check the application of the Objective-C '__kindof' qualifier to the given type.
Definition: SemaType.cpp:5916
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:6665
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
VerifyICEDiagnoser(bool Suppress=false)
Definition: Sema.h:9069
RAII object to handle the state changes required to synthesize a function body.
Definition: Sema.h:668
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:10700
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:2725
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:742
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition: Sema.h:7012
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:11698
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:81
void ActOnFinishCXXNonNestedClass(Decl *D)
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
Definition: SemaStmt.cpp:1257
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:4806
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
Definition: SemaExpr.cpp:5848
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:13217
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
Definition: SemaExpr.cpp:2723
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:9606
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:768
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:1780
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:4118
std::pair< CXXRecordDecl *, CXXSpecialMember > SpecialMemberDecl
Definition: Sema.h:1017
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition: Sema.h:446
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1624
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaStmt.cpp:3422
DiagnosticsEngine & Diags
Definition: Sema.h:301
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition: Sema.h:2449
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:82
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:1038
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
Definition: Type.h:3167
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:396
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:9108
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:1141
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition: Sema.h:9602
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:1382
void ActOnObjCTemporaryExitContainerContext(DeclContext *DC)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaDecl.cpp:13211
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition: Sema.h:4695
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition: Sema.h:980
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:2765
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1377
void ActOnStartStmtExpr()
Definition: SemaExpr.cpp:11609
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:7064
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:908
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:49
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:38
Code completion occurs within an Objective-C implementation or category implementation.
Definition: Sema.h:9187
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:760
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:7661
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: Sema.h:1004
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
Definition: SemaDecl.cpp:10795
bool IsDecltype
Whether we are in a decltype expression.
Definition: Sema.h:842
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement. ...
Definition: SemaStmt.cpp:2431
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:11524
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:1585
SourceLocation PragmaLocation
Definition: Sema.h:348
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:11417
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:13552
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition: Sema.h:2734
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...
void AddParameterABIAttr(SourceRange AttrRange, Decl *D, ParameterABI ABI, unsigned SpellingListIndex)
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1377
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:6653
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:1063
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: Sema.h:769
FPOptions & getFPOptions()
Definition: Sema.h:1064
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:3759
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:117
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto)
Definition: SemaDecl.cpp:9988
MethodMatchStrategy
Definition: Sema.h:3175
Information about a template-id annotation token.
static SourceRange getPrintable(TypeLoc TL)
Definition: Sema.h:1362
void setMethod(CXXMethodDecl *MD)
Definition: Sema.h:934
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:5115
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
void threadSafetyCleanup(BeforeSet *Cache)
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation >> ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
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:13344
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:14111
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
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
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
Definition: SemaType.cpp:2468
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:11075
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:6771
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3253
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:6748
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted...
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:421
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:7595
An arbitrary expression.
Definition: Sema.h:6079
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6...
Definition: SemaExpr.cpp:761
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition: Sema.h:1130
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
Definition: SemaExpr.cpp:4093
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:2351
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:733
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:7008
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:1473
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition: Sema.cpp:1181
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition: Sema.h:2768
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension...
Definition: Sema.h:8628
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:4567
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition: Sema.h:597
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:5274
Step
Definition: OpenMPClause.h:313
void DiagnoseUnusedExprResult(const Stmt *S)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused...
Definition: SemaStmt.cpp:186
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:3344
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition: Sema.h:4364
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier...
Definition: Sema.h:8678
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:2334
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:4549
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition: Sema.cpp:1216
Value of a non-type template parameter.
Definition: Sema.h:2335
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
Represents a class type in Objective C.
Definition: Type.h:4727
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, bool IsDecltype)
Definition: Sema.h:878
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...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
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:1067
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:1827
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=None)
void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name, unsigned SpellingListIndex, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e...
Definition: SemaDecl.cpp:13117
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
Definition: SemaDecl.cpp:11993
A C-style cast.
Definition: Sema.h:8503
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:1185
FileNullability & operator[](FileID file)
Definition: Sema.h:245
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:84
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 hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition: Sema.h:1415
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:12075
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:2293
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
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:7023
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:6661
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition: Sema.h:7027
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition: SemaDecl.cpp:54
The arguments included an overloaded function name that could not be resolved to a suitable function...
Definition: Sema.h:6453
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, AttributeList *Attr)
Definition: SemaDecl.cpp:14778
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: Sema.h:739
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaStmt.cpp:1696
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:93
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.
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition: Sema.cpp:651
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false)
ImplicitExceptionSpecification ComputeInheritingCtorExceptionSpec(SourceLocation Loc, CXXConstructorDecl *CD)
Determine what sort of exception specification an inheriting constructor of a class will have...
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:283
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > LateParsedTemplateMapT
Definition: Sema.h:553
Code completion occurs following one or more template headers within a class.
Definition: Sema.h:9196
This is not an overload because the signature exactly matches an existing declaration.
Definition: Sema.h:2242
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType)
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition: Type.h:3094
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:14344
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:9644
StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt *InitStmt, ConditionResult Cond, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:532
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaType.cpp:5241
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:35
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:14482
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:8646
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:3606
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
The fixed underlying type of an enumeration.
Definition: Sema.h:6097
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
Definition: SemaDecl.cpp:8907
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3366
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible...
Definition: Sema.h:8856
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
LazyVector< VarDecl *, ExternalSemaSource,&ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition: Sema.h:515
FrontendAction * Action
Definition: Tooling.cpp:201
llvm::Optional< bool > getKnownValue() const
Definition: Sema.h:9001
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
Definition: SemaDecl.cpp:11935
VarDecl * getCopyElisionCandidate(QualType ReturnType, Expr *E, bool AllowParamOrMoveConstructible)
Determine whether the given expression is a candidate for copy elision in either a return statement o...
Definition: SemaStmt.cpp:2705
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:15068
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, AttributeList *Attrs, SourceLocation EqualLoc, Expr *Val)
Definition: SemaDecl.cpp:14508
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition: SemaDecl.cpp:583
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:11718
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:103
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
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:6612
The type of a non-type template parameter.
Definition: Sema.h:6118
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
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
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:509
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:12260
void PopExpressionEvaluationContext()
Definition: SemaExpr.cpp:12840
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
OverloadKind
C++ Overloading.
Definition: Sema.h:2235
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
void EndOpenMPClause()
End analysis of clauses.
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:500
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:5816
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:6645
Code completion occurs where only a type is permitted.
Definition: Sema.h:9213
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:957
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures...
Definition: Sema.h:3283
void ActOnAbortSEHFinallyBlock()
Definition: SemaStmt.cpp:3783
void diagnoseMisplacedModuleImport(Module *M, SourceLocation ImportLoc)
Check if module import may be found in the current context, emit error if not.
Definition: SemaDecl.cpp:15060
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
Definition: DeclSpec.h:2268
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition: Sema.h:917
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition: SemaExpr.cpp:205
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors...
Definition: Sema.h:5621
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:105
The type of an exception.
Definition: Sema.h:6121
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
Code completion occurs at top-level or namespace context.
Definition: Sema.h:9179
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Definition: SemaStmt.cpp:3805
SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition: Sema.h:1097
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)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Definition: OpenMPKinds.h:100
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:7015
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'is_device_ptr' clause.
Represents a C++ using-declaration.
Definition: DeclCXX.h:3039
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition: Sema.h:9211
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:4920
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:6256
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.
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:12088
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
Definition: SemaExpr.cpp:1390
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:3640
BinaryOperatorKind
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:884
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition: SemaExpr.cpp:52
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:1452
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:1073
Look up implicit 'self' parameter of an objective-c method.
Definition: Sema.h:2741
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:316
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
Definition: Sema.h:829
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:26
Represents the results of name lookup.
Definition: Sema/Lookup.h:30
bool IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level)
Return true if the provided declaration VD should be captured by reference.
Definition: SemaOpenMP.cpp:842
static const std::string & getPrintable(const std::string &S)
Definition: Sema.h:1353
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition: SemaExpr.cpp:739
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:2427
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer)
Finish current declare reduction construct initializer.
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement...
bool 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:317
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition: Sema.h:6990
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:6091
MinSizeAttr * mergeMinSizeAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:901
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
Definition: SemaExpr.cpp:11932
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition: Sema.cpp:945
void ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition: Sema.h:6681
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:78
A convenient class for passing around template argument information.
Definition: TemplateBase.h:523
void ActOnStartSEHFinallyBlock()
Definition: SemaStmt.cpp:3779
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:789
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:1736
uint32_t Offset
Definition: CacheTokens.cpp:44
void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope)
Introduce the lambda parameters into scope.
Definition: SemaLambda.cpp:474
bool isObjCMethodDecl(Decl *D)
Definition: Sema.h:1796
Ref_Compatible - The two types are reference-compatible and have equivalent qualifiers (cv1 == cv2)...
Definition: Sema.h:8868
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation Loc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:2752
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition: Sema.h:2398
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:9193
void CodeCompleteBracketDeclarator(Scope *S)
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:6082
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:9951
Look up all declarations in a scope with the given name, including resolved using declarations...
Definition: Sema.h:2729
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
OriginalCallArg(QualType OriginalParamType, unsigned ArgIdx, QualType OriginalArgType)
Definition: Sema.h:6478
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:7290
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)
OMPClause * ActOnOpenMPFromClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'from' clause.
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...
Code completion occurs within an expression.
Definition: Sema.h:9198
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)
PragmaStack(const ValueType &Default)
Definition: Sema.h:381
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:5849
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition: Sema.h:495
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
Definition: SemaDecl.cpp:13131
ObjCContainerKind
Definition: Sema.h:7310
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
We are substituting template argument determined as part of template argument deduction for either a ...
Definition: Sema.h:6636
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
Definition: SemaStmt.cpp:3829
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition: Sema.h:2776
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:6741
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:4834
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:1000
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2569
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:6435
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
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition: Sema.h:481
void CheckDelegatingCtorCycles()
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
Definition: SemaExpr.cpp:15087
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:2672
ImplicitExceptionSpecification ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted destructor of a class will have...
Look up the name of an OpenMP user-defined reduction operation.
Definition: Sema.h:2743
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition: Sema.h:6421
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition: Sema.h:6588
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:8499
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
std::pair< StringRef, QualType > CapturedParamNameType
Definition: Sema.h:3471
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition: Sema.h:2789
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
Definition: SemaStmt.cpp:2616
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:247
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition: Sema.h:720
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:401
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:13761
We are substituting explicit template arguments provided for a function template. ...
Definition: Sema.h:6629
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:326
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
Definition: SemaDecl.cpp:15106
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:39
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
The type of a data member.
Definition: Sema.h:6088
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:15014
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:187
OMPClause * ActOnOpenMPMapClause(OpenMPMapClauseKind MapTypeModifier, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'map' clause.
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
Definition: SemaCUDA.cpp:355
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:4898
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:2285
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition: Sema.h:627
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:1594
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:635
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2632
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
Definition: SemaStmt.cpp:609
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1968
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:6808
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:5556
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:87
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
Definition: SemaDecl.cpp:1898
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
void CheckCompleteVariableDeclaration(VarDecl *var)
Definition: SemaDecl.cpp:10295
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:187
void CheckVariableDeclarationType(VarDecl *NewVD)
Definition: SemaDecl.cpp:6760
Preprocessor & PP
Definition: Sema.h:298
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: Sema.h:736
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:727
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3243
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
Definition: SemaStmt.cpp:3787
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:3794
LambdaCaptureInitKind
Definition: DeclSpec.h:2316
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Definition: SemaExpr.cpp:7677
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition: Sema.h:7026
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:9054
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
Definition: SemaDecl.cpp:11437
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:3625
Represents an ObjC class declaration.
Definition: DeclObjC.h:1091
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)
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
Returns instance or factory methods in global method pool for given selector.
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition: Sema.h:856
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:5621
Member name lookup, which finds the names of class/struct/union members.
Definition: Sema.h:2713
We are matching the template parameter lists of a template template argument against the template par...
Definition: Sema.h:5992
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind)
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
Definition: SemaStmt.cpp:2167
detail::InMemoryDirectory::const_iterator I
IncompatiblePointer - The assignment is between two pointers types which point to integers which have...
Definition: Sema.h:8642
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Definition: SemaExpr.cpp:2800
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared...
Definition: Sema.h:695
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:1168
FullExprArg(Sema &actions)
Definition: Sema.h:3306
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
Definition: SemaExpr.cpp:14887
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:757
void addOverloadedOperatorToUnresolvedSet(UnresolvedSetImpl &Functions, DeclAccessPair Operator, QualType T1, QualType T2)
FunctionDecl * resolveAddressOfOnlyViableOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaStmt.cpp:3459
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:13984
OMPClause * ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
const LangOptions & LangOpts
Definition: Sema.h:297
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool AllowClassTemplates=false)
Definition: SemaDecl.cpp:599
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:1589
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:6785
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition: Sema.h:2756
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:473
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition: Sema.h:226
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:54
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:6946
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:11613
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
ParsingClassState PushParsingClass()
Definition: Sema.h:3612
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition: Sema.h:846
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition: Sema.h:496
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
A helper class for building up ExtParameterInfos.
Definition: Sema.h:7104
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: Sema.h:3260
Code completion occurs within a sequence of declaration specifiers within a function, method, or block.
Definition: Sema.h:9219
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:64
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:933
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition: Sema.h:5981
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition: Sema.h:6955
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.
Defines the clang::TemplateNameKind enum.
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition: Sema.h:6790
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:1007
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.
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Definition: SemaType.cpp:2519
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:1345
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:1961
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:4130
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition: Sema.h:6676
IdentifierInfo * IdentInfo
Definition: Sema.h:4084
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:263
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:1304
Merge availability attributes for an implementation of a protocol requirement.
Definition: Sema.h:2160
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:873
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition: SemaStmt.cpp:72
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
Definition: CallEvent.h:872
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< Decl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
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:899
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3073
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit, bool TypeMayContainAuto)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
Definition: SemaDecl.cpp:9517
A functional-style cast.
Definition: Sema.h:8505
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:872
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
Definition: SemaExpr.cpp:14058
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition: Sema.h:518
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:1519
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: Sema.h:7708
llvm::DenseMap< Selector, GlobalMethods > GlobalMethodPool
Definition: Sema.h:992
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:10772
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.
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration...
Definition: SemaDecl.cpp:6621
Retains information about a captured region.
Definition: ScopeInfo.h:624
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: Sema.h:3082
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:3353
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:550
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:5487
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:646
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:299
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
Definition: SemaStmt.cpp:3176
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:1607
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:870
Template argument deduction did not deduce a value for every template parameter.
Definition: Sema.h:6424
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:8350
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:8632
void PopCompoundScope()
Definition: Sema.cpp:1172
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.
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:9524
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:2462
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:2739
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
Definition: SemaLambda.cpp:470
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:324
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition: Sema.h:5963
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:577
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:5811
SourceLocation NameLoc
Definition: Sema.h:7536
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:484
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:1192
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)
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
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:2787
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:3417
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:9552
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:1054
llvm::SpecificBumpPtrAllocator< StateNode > Allocator
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
Definition: SemaExpr.cpp:5501
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition...
Definition: SemaExpr.cpp:14286
int * Depth
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:11191
NameClassification(ParsedType Type)
Definition: Sema.h:1572
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:597
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:613
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
friend class ASTContext
Definition: Type.h:4178
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:2927
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3456
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:590
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:5305
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:105
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:1860
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.
LookupNameKind
Describes the kind of name lookup to perform.
Definition: Sema.h:2701
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e...
Definition: SemaDecl.cpp:3714
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:706
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:603
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:102
DLLImportAttr * mergeDLLImportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
TemplateNameKind getTemplateNameKind() const
Definition: Sema.h:1625
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:4338
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:704
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
When performing template argument deduction for a function template, there were too many call argumen...
Definition: Sema.h:6444
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition: Sema.h:508
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
Definition: SemaDecl.cpp:249
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
StateNode * Previous
Declaration of a template type parameter.
The message is an instance message.
Definition: Sema.h:7592
void CodeCompleteObjCPropertyDefinition(Scope *S)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
bool isOpenMPPrivateDecl(ValueDecl *D, unsigned Level)
Check if the specified variable is used in 'private' clause.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:321
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition: SemaStmt.cpp:446
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:136
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:1406
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:4357
TypeResult ActOnTypeName(Scope *S, Declarator &D)
Definition: SemaType.cpp:5212
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:4567
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2414
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition: Sema.h:716
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:7363
llvm::SmallSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition: Sema.h:1022
SavePendingInstantiationsAndVTableUsesRAII(Sema &S, bool Enabled)
Definition: Sema.h:7045
Code completion occurs within an Objective-C interface, protocol, or category.
Definition: Sema.h:9184
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition: Sema.h:6757
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure...
Definition: SemaDecl.cpp:4514
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowParamOrMoveConstructible)
Definition: SemaStmt.cpp:2724
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:12635
IncompatibleVectors - The assignment is between two vector types that have the same size...
Definition: Sema.h:8661
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition: Sema.h:689
void completeExprArrayBound(Expr *E)
Definition: SemaType.cpp:6728
bool isInitListConstructor(const CXXConstructorDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init.list]p2.
void CodeCompleteObjCAtVisibility(Scope *S)
OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:33
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
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:1152
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:407
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:4384
SourceLocation LocStart
Definition: Sema.h:4081
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition: SemaCast.cpp:237
Initial building of a for-range statement.
Definition: Sema.h:3435
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:12391
When performing template argument deduction for a function template, there were too few call argument...
Definition: Sema.h:6447
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
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition: Sema.h:8651
void NoteAllFoundTemplates(TemplateName Name)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Definition: SemaExpr.cpp:14955
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.
bool resolveAndFixAddressOfOnlyViableOverloadCandidate(ExprResult &SrcExpr)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition: Sema.h:8860
Represents a C++ template name within the type system.
Definition: TemplateName.h:176
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:5394
void CodeCompletePreprocessorExpression()
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: Sema.h:742
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition: Sema.h:8853
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:435
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Definition: SemaType.cpp:6826
Block expression,.
Definition: Sema.h:6136
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:13334
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition: Sema.h:1409
void DiscardCleanupsInEvaluationContext()
Definition: SemaExpr.cpp:12898
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:9201
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:330
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: Sema.h:6668
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...
bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
Definition: SemaCUDA.cpp:389
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:13455
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:317
CXXMethodDecl * startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, ArrayRef< ParmVarDecl * > Params)
Start the definition of a lambda expression.
Definition: SemaLambda.cpp:354
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:179
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition: Sema.h:7224
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition: Sema.h:5371
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:3368
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:201
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition: Sema.h:839
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:9592
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition: Sema.h:467
void maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
Definition: SemaCUDA.cpp:444
void AdjustDestructorExceptionSpec(CXXRecordDecl *ClassDecl, CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
PragmaMSCommentKind
Definition: PragmaKinds.h:15
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
InClassInitStyle
In-class initialization styles for non-static data members.
Definition: Specifiers.h:224
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:6124
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:1570
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition: SemaStmt.cpp:67
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:234
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:5146
bool isExternallyVisible() const
Definition: Decl.h:348
ConditionKind
Definition: Sema.h:9009
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)
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement...
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement...
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
Definition: Sema.h:6732
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:7130
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:11888
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:1461
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
DiagnosticsEngine & getDiagnostics() const
Definition: Sema.h:1066
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:766
OMPClause * ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
void CleanupVarDeclMarking()
Definition: SemaExpr.cpp:13836
DeclContext * getContainingDC(DeclContext *DC)
Definition: SemaDecl.cpp:1077
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:4154
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition: Sema.h:7123
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:9462
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1244
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:384
Wraps an identifier and optional source location for the identifier.
Definition: AttributeList.h:72
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:4120
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:6438
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2461
sema::LambdaScopeInfo * PushLambdaScope()
Definition: Sema.cpp:1137
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:942
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.
Code completion occurs within the list of instance variables in an Objective-C interface, protocol, category, or implementation.
Definition: Sema.h:9190
void CodeCompleteNamespaceDecl(Scope *S)
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
Definition: SemaType.cpp:6786
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
Definition: SemaExpr.cpp:5515
OpenMPProcBindClauseKind
OpenMP attributes for 'proc_bind' clause.
Definition: OpenMPKinds.h:51
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
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:509
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
Definition: Specifiers.h:165
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
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:4371
const SourceManager & SM
Definition: Format.cpp:1184
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:231
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition: Sema.h:223
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition: Sema.h:960
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:2238
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
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:4698
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
ExprResult ActOnFinishFullExpr(Expr *Expr)
Definition: Sema.h:4903
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:775
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, llvm::function_ref< ExprResult(Expr *)> Filter)
Definition: Sema.h:2961
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:1352
BuildForRangeKind
Definition: Sema.h:3433
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:534
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
Definition: SemaCast.cpp:2593
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
Definition: SemaExpr.cpp:3526
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:5813
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
A declaration qualifier.
Definition: Sema.h:6109
FieldDecl * buildInitCaptureField(sema::LambdaScopeInfo *LSI, VarDecl *Var)
Build the implicit field for an init-capture.
Definition: SemaLambda.cpp:788
void CodeCompleteTypeQualifiers(DeclSpec &DS)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition: Sema.h:9513
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:11147
const QualType * data() const
The set of exceptions in the exception specification.
Definition: Sema.h:4374
Decl * ActOnSkippedFunctionBody(Decl *Decl)
Definition: SemaDecl.cpp:11429
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
Definition: SemaDecl.cpp:10929
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:471
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:11732
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:377
bool hasVisibleDefinition(const NamedDecl *D)
Definition: Sema.h:1428
void ActOnStartOfCompoundStmt()
Definition: SemaStmt.cpp:320
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:229
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:428
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition: Sema.cpp:1132
CanThrowResult
Possible results from evaluation of a noexcept expression.
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D)
Check declaration inside target region.
static unsigned getPrintable(unsigned I)
Definition: Sema.h:1349
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition: Sema.h:1548
ParsedType getDestructorType(const DeclSpec &DS, ParsedType ObjectType)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, 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...
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:1514
void CodeCompleteObjCAtDirective(Scope *S)
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
Definition: SemaDecl.cpp:11038
ARCConversionResult
Definition: Sema.h:8914
#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:2708
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition: Sema.h:727
Kind
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2483
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:376
PragmaSectionKind
Definition: Sema.h:7755
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Sema::ReuseLambdaContextDecl_t, bool IsDecltype=false)
Definition: Sema.h:9621
bool CheckCaseExpression(Expr *E)
Definition: SemaExpr.cpp:15058
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:146
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3153
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:2429
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4679
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:52
Represents the parsed form of a C++ template argument.
A stack object to be created when performing template instantiation.
Definition: Sema.h:6822
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition: SemaStmt.cpp:438
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition: Sema.h:9498
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:5900
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:14749
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
Definition: SemaExpr.cpp:1416
This is not an overload because the lookup results contain a non-function.
Definition: Sema.h:2246
DeduceAutoResult
Result type of DeduceAutoType.
Definition: Sema.h:6534
Encodes a location in the source.
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
Definition: SemaExpr.cpp:5290
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:459
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: SemaAttr.cpp:212
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
Definition: SemaDecl.cpp:9074
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:76
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
Definition: SemaDecl.cpp:13178
Defines enumerations for expression traits intrinsics.
SourceLocation CurrentPragmaLocation
Definition: Sema.h:387
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:852
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
Definition: SemaExpr.cpp:5606
ObjCPropertyQueryKind
Definition: DeclObjC.h:687
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:852
static const char * getPrintable(const char *S)
Definition: Sema.h:1351
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 ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement...
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition: SemaAttr.cpp:129
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:1182
bool IsNoReturnConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noreturn"...
DLLExportAttr * mergeDLLExportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
Definition: SemaExpr.cpp:12337
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
Definition: SemaDecl.cpp:10491
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function...
Definition: SemaDecl.cpp:11827
static SourceRange getPrintable(const Expr *E)
Definition: Sema.h:1361
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
Definition: SemaDecl.cpp:15205
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
Definition: SemaStmt.cpp:3158
VarDecl * IsOpenMPCapturedDecl(ValueDecl *D)
Check if the specified variable is used in one of the private clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP constructs.
Definition: SemaOpenMP.cpp:980
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:44
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:461
const std::string ID
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition: Sema.h:6432
void ExitDeclaratorContext(Scope *S)
Definition: SemaDecl.cpp:1177
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2727
void referenceDLLExportedClassMethods()
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:1682
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP target region.
Definition: Sema.h:8029
ASTContext & getASTContext() const
Definition: Sema.h:1069
OMPClause * ActOnOpenMPToClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'to' clause.
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation)
Definition: Sema.h:349
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:296
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:424
IncompatiblePointer - The assignment is between two pointers types that are not compatible, but we accept them as an extension.
Definition: Sema.h:8636
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
AvailabilityDiagnostic
Definition: Sema.h:3621
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3122
DelayedDiagnosticsState ProcessingContextState
Definition: Sema.h:578
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:861
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:119
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>. ...
Definition: Sema.h:724
ObjCSpecialMethodKind
Definition: Sema.h:7525
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1736
StmtResult ActOnCapturedRegionEnd(Stmt *S)
Definition: SemaStmt.cpp:3977
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition: Sema.h:594
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:12811
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:11393
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: Sema.h:9552
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:6848
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:3061
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:214
ExprResult DefaultLvalueConversion(Expr *E)
Definition: SemaExpr.cpp:630
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:3433
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:7212
void DiagnoseUseOfUnimplementedSelectors()
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition: Sema.h:499
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition: Sema.h:6962
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:6418
Ref_Compatible_With_Added_Qualification - The two types are reference-compatible with added qualifica...
Definition: Sema.h:8865
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: SemaStmt.cpp:3765
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
ASTConsumer & getASTConsumer() const
Definition: Sema.h:1070
static DeclarationName getPrintable(DeclarationName N)
Definition: Sema.h:1357
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:2171
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:7590
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:3263
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:5565
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:305
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).
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
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:5638
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
PragmaStack< MSVtorDispAttr::Mode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition: Sema.h:400
A friend declaration.
Definition: Sema.h:6106
AbstractDiagSelID
Definition: Sema.h:5623
Look up any declaration with any name.
Definition: Sema.h:2745
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
Definition: SemaExpr.cpp:7625
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:959
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
Definition: SemaType.cpp:1746
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:437
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition: SemaStmt.cpp:739
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:2276
bool FormatStringHasSArg(const StringLiteral *FExpr)
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition: Sema.h:308
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition: Sema.h:850
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:699
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition: Sema.h:563
bool isInvalid() const
Definition: Sema.h:8996
OpaquePtr< TemplateName > TemplateTy
Definition: Sema.h:291
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:9044
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.
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
void updateOutOfDateSelector(Selector Sel)
A default argument.
Definition: Sema.h:6115
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition: Sema.h:2450
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLoc, Expr *Length, SourceLocation RBLoc)
Definition: SemaExpr.cpp:4210
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:479
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:1601
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:1984
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:4127
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond, Stmt *Body)
Definition: SemaStmt.cpp:1235
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions...
Definition: SemaDecl.cpp:13820
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
Definition: SemaDecl.cpp:10944
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition: Sema.h:443
sema::FunctionScopeInfo * getCurFunction() const
Definition: Sema.h:1188
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:1511
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
Definition: SemaDecl.cpp:11087
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition: Sema.h:7111
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
void checkPartialSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a template specialization that would select a partial specialization.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Definition: Overload.h:701
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
Definition: SemaDecl.cpp:13854
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaStmt.cpp:3513
Constant expression in a noptr-new-declarator.
Definition: Sema.h:2336
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
Definition: SemaExpr.cpp:12906
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
ParameterABI
Kinds of parameter ABI.
Definition: Specifiers.h:295
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition: Sema.h:963
TentativeAnalysisScope(Sema &SemaRef)
Definition: Sema.h:6996
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.
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:11622
void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn, QualType DestType=QualType(), bool TakingAddress=false)
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
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:673
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:6719
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: Sema.h:745
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
getSpecialMember - get the special member enum for a method.
Definition: SemaDecl.cpp:2600
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:14863
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:6094
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:5591
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>...
Expression in a case label.
Definition: Sema.h:2333
ReuseLambdaContextDecl_t
Definition: Sema.h:3652
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:769
OpaquePtr< QualType > TypeTy
Definition: Sema.h:292
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:15162
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:14036
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2609
Abstract interface for a consumer of code-completion information.
sema::LambdaScopeInfo * getCurLambda()
Retrieve the current lambda scope info, if any.
Definition: Sema.cpp:1200
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:1190
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:7836
ParserCompletionContext
Describes the context in which code completion occurs.
Definition: Sema.h:9177
ObjCDeclSpec DeclSpec
Definition: Sema.h:7540
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:1801
TagTypeKind
The kind of a tag type.
Definition: Type.h:4342
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool *NonStandardCompositeType=nullptr)
Definition: Sema.h:8811
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:67
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:2346
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
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:7018
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition: Sema.h:560
ArrayRef< TemplateArgument > template_arguments() const
Definition: Sema.h:6670
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:876
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:3531
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:331
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:6779
Don't merge availability attributes at all.
Definition: Sema.h:2151
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
Definition: SemaDecl.cpp:10916
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
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:1205
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 ...
UnaryOperatorKind
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:1135
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: Sema.h:748
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
Definition: SemaExpr.cpp:11572
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2008
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl...
Definition: SemaAttr.cpp:51
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2332
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:330
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
Definition: SemaType.cpp:2654
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:1148
A template instantiation that is currently in progress.
Definition: Sema.h:6608
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:615
QualType GetSignedVectorType(QualType V)
Definition: SemaExpr.cpp:9442
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:1983
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:368
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:1627
void ActOnCapturedRegionError()
Definition: SemaStmt.cpp:3961
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:1482
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:312
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:8896
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:12010
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:2521
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:1143
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types...
StmtResult ActOnExprStmtError()
Definition: SemaStmt.cpp:62
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:15141
static NameClassification VarTemplate(TemplateName Name)
Definition: Sema.h:1595
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:5269
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Definition: SemaExpr.cpp:14216
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:7219
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:1949
SectionAttr * mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name, unsigned AttrSpellingListIndex)
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition: Sema.h:7017
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:6441
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:785
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
Definition: SemaStmt.cpp:2625
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
Definition: SemaExpr.cpp:3619
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...
void AddNSConsumedAttr(SourceRange AttrRange, Decl *D, unsigned SpellingListIndex, bool isNSConsumed, bool isTemplateInstantiation)
Label name lookup.
Definition: Sema.h:2710
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
Definition: SemaDecl.cpp:3732
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:1452
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1113
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:5367
ExpressionEvaluationContext Context
The expression evaluation context.
Definition: Sema.h:836
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
Definition: SemaExpr.cpp:5868
EnumDecl - Represents an enum.
Definition: Decl.h:3013
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition: Sema.h:8669
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:2772
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:2616
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:95
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:141
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition: SemaStmt.cpp:328
IdentifierResolver IdResolver
Definition: Sema.h:708
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition: Sema.cpp:409
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:13141
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:3106
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:10971
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:952
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:13822
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition: Sema.h:642
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
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:497
A dependently-generated diagnostic.
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:333
Represents a pointer to an Objective C object.
Definition: Type.h:4991
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated", "unavailable", and "availability").
Definition: Sema.h:2149
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
Definition: SemaDecl.cpp:5309
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition: Sema.h:557
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:127
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:3275
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaType.cpp:3239
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:1088
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
Definition: SemaStmt.cpp:3817
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:2461
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:4039
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.
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal, SourceLocation DotDotDotLoc, Expr *RHSVal, SourceLocation ColonLoc)
Definition: SemaStmt.cpp:376
ExprResult getExpression() const
Definition: Sema.h:1614
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx)
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
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...
void ActOnFinishOpenMPDeclareTargetDirective()
Called at the end of target region i.e. '#pragme omp end declare target'.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3707
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition: Sema.h:319
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:427
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:803
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:195
SourceManager & getSourceManager() const
Definition: Sema.h:1067
void FreePackedContext()
FreePackedContext - Deallocate and null out PackContext.
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:2753
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
Definition: SemaDecl.cpp:13222
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition: Sema.h:5892
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:1072
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2063
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
Definition: Sema.h:1912
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition: Sema.h:5889
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:95
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:4686
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
ObjCLiteralKind
Definition: Sema.h:2431
ValueType CurrentValue
Definition: Sema.h:386
LocalInstantiationScope * Scope
Definition: Sema.h:7216
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:8665
Represents a C++ base or member initializer.
Definition: DeclCXX.h:1922
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Definition: SemaExpr.cpp:12822
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:2346
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:5901
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:1309
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:940
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
Definition: SemaDecl.cpp:14308
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:1314
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...
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:2041
void * OpaqueParser
Definition: Sema.h:561
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition: Sema.h:972
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)
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
Definition: SemaInit.cpp:6192
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:59
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:7312
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:898
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:10669
void CodeCompleteObjCAtStatement(Scope *S)
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
void CheckShadow(Scope *S, VarDecl *D, const LookupResult &R)
Diagnose variable or built-in function shadowing.
Definition: SemaDecl.cpp:6534
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:15180
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
Definition: SemaExpr.cpp:11302
static NameClassification Error()
Definition: Sema.h:1577
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:1619
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.
PragmaMSStructKind
Definition: PragmaKinds.h:24
void ActOnCXXForRangeDecl(Decl *D)
Definition: SemaDecl.cpp:10222
OpenMPDefaultClauseKind
OpenMP attributes for 'default' clause.
Definition: OpenMPKinds.h:43
friend class ArgumentPackSubstitutionRAII
Definition: Sema.h:6800
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:4247
Deduction failed; that's all we know.
Definition: Sema.h:6455
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Definition: Sema.h:2954
static NameClassification Unknown()
Definition: Sema.h:1581
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: Sema.h:763
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:10265
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:451
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:15064
static SourceRange getPrintable(SourceLocation L)
Definition: Sema.h:1360
Represents a base class of a C++ class.
Definition: DeclCXX.h:159
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
Definition: SemaExpr.cpp:11869
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
const Expr * Replacement
Definition: AttributeList.h:58
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:2533
void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:408
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:408
Condition in a constexpr if statement.
Definition: Sema.h:2337
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3155
ProcessingContextState ParsingClassState
Definition: Sema.h:3611
void * SkippedDefinitionContext
Definition: Sema.h:2025
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:7815
The type-property cache.
Definition: Type.cpp:3242
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:2107
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
Definition: SemaDecl.cpp:4916
Describes whether we've seen any nullability information for the given file.
Definition: Sema.h:220
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:775
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
An implicit conversion.
Definition: Sema.h:8501
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:69
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition: Sema.cpp:1101
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Definition: SemaDecl.cpp:1687
A template argument list.
Definition: DeclTemplate.h:173
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:2154
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:2407
const DeclContext * getCurObjCLexicalContext() const
Definition: Sema.h:9582
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:12171
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:3157
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:9424
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute...
Definition: SemaAttr.cpp:464
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:3950
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition: Sema.h:6750
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
Definition: ASTMatchers.h:1920
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:3761
CCEKind
Contexts in which a converted constant expression is required.
Definition: Sema.h:2332
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition: SemaExpr.cpp:945
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: Sema.h:290
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:1724
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:2773
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:2315
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
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:2948
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation, for substitutions of prior template arguments.
Definition: Sema.h:6658
Data structure used to record current or nested expression evaluation contexts.
Definition: Sema.h:834
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:432
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:9204
void LateTemplateParserCleanupCB(void *P)
Definition: Sema.h:558
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:2860
void ActOnOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OMPDeclareTargetDeclAttr::MapTypeTy MT, NamedDeclSetType &SameDirectiveDecls)
Called on correct id-expression from the '#pragma omp declare target'.
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, SourceLocation IdLoc, IdentifierInfo &II, ParsedType ObjectType)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:263
Compatible - the types are compatible according to the standard.
Definition: Sema.h:8620
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
Decl * D
The template function declaration to be late parsed.
Definition: Sema.h:9646
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:3468
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
CUDAFunctionTarget
Definition: Sema.h:9096
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:13241
StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS)
The current expression occurs within a discarded statement.
Definition: Sema.h:804
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:2737
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:814
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void PopParsingClass(ParsingClassState state)
Definition: Sema.h:3615
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:92
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:1849
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:5840
TryCaptureKind
Definition: Sema.h:3687
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:13753
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: Sema.h:778
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:114
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
Definition: SemaExpr.cpp:8045
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:311
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition: SemaExpr.cpp:294
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:172
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
Definition: SemaDecl.cpp:1633
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:610
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:6100
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:3218
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:1297
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
Definition: SemaExpr.cpp:10087
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:955
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all...
Definition: Sema.h:793
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:1466
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2148
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
Definition: SemaExpr.cpp:7870
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
Definition: SemaStmt.cpp:2598
void UpdateMarkingForLValueToRValue(Expr *E)
Definition: SemaExpr.cpp:13797
Represents a complete lambda introducer.
Definition: DeclSpec.h:2324
a linked list of methods with the same selector name but different signatures.
AvailabilityResult getCurContextAvailability() const
Definition: SemaDecl.cpp:15242
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
Definition: Sema.h:991
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:174
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.
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Definition: SemaExpr.cpp:2575
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:3477
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:6103
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
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, bool IsMapTypeImplicit, SourceLocation DepLinMapLoc)
void PrintStats() const
Print out statistics about the semantic analysis.
Definition: Sema.cpp:343
void ActOnComment(SourceRange Comment)
Definition: Sema.cpp:1225
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:55
FPOptions FPFeatures
Definition: Sema.h:295
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:3331
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:435
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:932
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:1359
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition: Sema.h:9207
Lambda expression.
Definition: Sema.h:6133
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
Definition: SemaExpr.cpp:12211
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:799
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:5284
void ActOnObjCContainerFinishDefinition()
Definition: SemaDecl.cpp:13206
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:5377
SourceManager & SourceMgr
Definition: Sema.h:302
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:1604
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:9643
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:1179
static int getPrintable(int I)
Definition: Sema.h:1348
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
Definition: SemaDecl.cpp:1127
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness, issuing any diagnostics required.
PragmaStack< unsigned > PackStack
Definition: Sema.h:404
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.
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result)
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3394
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
Definition: SemaDecl.cpp:15149
InstantiationKind
The kind of template instantiation we are performing.
Definition: Sema.h:6610
#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:6910
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 ...
ASTContext & Context
Definition: Sema.h:299
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:8674
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:351
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident, unsigned AttrSpellingListIndex)
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
Definition: SemaExpr.cpp:14371
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K)
Definition: Sema.cpp:1502
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
Definition: SemaExpr.cpp:6008
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:6246
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:14244
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.
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:11224
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: Sema.h:754
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition: Sema.h:3334
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition: SemaDecl.cpp:497
Represents C++ using-directive.
Definition: DeclCXX.h:2615
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:540
The template argument was deduced via template argument deduction.
Definition: Sema.h:5896
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:2717
Describes an entity that is being initialized.
static QualType getPrintable(QualType T)
Definition: Sema.h:1358
SpecialMemberOverloadResult(const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:929
Decl * getObjCDeclContext() const
Definition: SemaDecl.cpp:15238
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:66
ExprResult release()
Definition: Sema.h:3308
NamedDecl * Previous
Definition: Sema.h:1507
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
Definition: SemaDecl.cpp:3299
The type of an arbitrary declaration.
Definition: Sema.h:6085
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:2223
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.
StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt *InitStmt, ConditionResult Cond, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:507
SourceLocation ColonLoc
Location of ':'.
Definition: OpenMPClause.h:266
SmallVector< Slot, 2 > Stack
Definition: Sema.h:384
brief A function argument from which we performed template argument
Definition: Sema.h:6477
void EmitAvailabilityWarning(AvailabilityDiagnostic AD, NamedDecl *D, StringRef Message, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass, const ObjCPropertyDecl *ObjCProperty, bool ObjCPropertyAccess)
ParsedType getType() const
Definition: Sema.h:1609
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).
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:39
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:2380
The explicitly-specified template arguments were not valid template arguments for the given template...
Definition: Sema.h:6450
The lookup resulted in an error.
Definition: Sema.h:2762
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
Definition: SemaDecl.cpp:4561
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:550
This class handles loading and caching of source files into memory.
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, SourceRange Range, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, unsigned AttrSpellingListIndex)
Attribute merging methods. Return true if a new attribute was added.
Preprocessor & getPreprocessor() const
Definition: Sema.h:1068
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types...
Definition: Sema.h:8657
The symbol does not exist.
Definition: Sema.h:4123
Declaration of a template function.
Definition: DeclTemplate.h:838
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition: Sema.h:946
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition: Sema.h:9216
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:1120
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:663
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:484
Attr - This represents one attribute.
Definition: Attr.h:45
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:7535
CastType
Definition: SemaCast.cpp:40
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, bool IsCompAssign=false)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6...
Definition: SemaExpr.cpp:1310
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2835
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Definition: SemaExpr.cpp:11578
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Definition: SemaType.cpp:4581
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:370
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
Definition: SemaExpr.cpp:10334
static const unsigned kMac68kAlignmentSentinel
Definition: Sema.h:403
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and...
Definition: SemaAttr.cpp:358
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:5129
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
Definition: SemaType.cpp:7227
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: SemaStmt.cpp:3729
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: Sema.h:772
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:12076
Helper class that creates diagnostics with optional template instantiation stacks.
Definition: Sema.h:1092
Decl * ActOnDeclarator(Scope *S, Declarator &D)
Definition: SemaDecl.cpp:4788
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:97
AttributeList - Represents a syntactic attribute.
Definition: AttributeList.h:94
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.
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement...
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement...
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:1331
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
Definition: Decl.h:305
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:976
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:634
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:4600
ValueType DefaultValue
Definition: Sema.h:385
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
Definition: SemaDecl.cpp:1580
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).
Definition: Overload.h:131
SourceLocation CurInitSegLoc
Definition: Sema.h:429