clang  5.0.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/DeclTemplate.h"
22 #include "clang/AST/Expr.h"
23 #include "clang/AST/ExprObjC.h"
25 #include "clang/AST/LocInfoType.h"
27 #include "clang/AST/NSAPI.h"
29 #include "clang/AST/StmtCXX.h"
30 #include "clang/AST/TypeLoc.h"
31 #include "clang/AST/TypeOrdering.h"
34 #include "clang/Basic/Module.h"
37 #include "clang/Basic/Specifiers.h"
39 #include "clang/Basic/TypeTraits.h"
41 #include "clang/Sema/CleanupInfo.h"
42 #include "clang/Sema/DeclSpec.h"
46 #include "clang/Sema/Ownership.h"
47 #include "clang/Sema/Scope.h"
48 #include "clang/Sema/ScopeInfo.h"
50 #include "clang/Sema/Weak.h"
51 #include "llvm/ADT/ArrayRef.h"
52 #include "llvm/ADT/Optional.h"
53 #include "llvm/ADT/SetVector.h"
54 #include "llvm/ADT/SmallPtrSet.h"
55 #include "llvm/ADT/SmallVector.h"
56 #include "llvm/ADT/TinyPtrVector.h"
57 #include <deque>
58 #include <memory>
59 #include <string>
60 #include <vector>
61 
62 namespace llvm {
63  class APSInt;
64  template <typename ValueT> struct DenseMapInfo;
65  template <typename ValueT, typename ValueInfoT> class DenseSet;
66  class SmallBitVector;
67  class InlineAsmIdentifierInfo;
68 }
69 
70 namespace clang {
71  class ADLResult;
72  class ASTConsumer;
73  class ASTContext;
74  class ASTMutationListener;
75  class ASTReader;
76  class ASTWriter;
77  class ArrayType;
78  class AttributeList;
79  class BindingDecl;
80  class BlockDecl;
81  class CapturedDecl;
82  class CXXBasePath;
83  class CXXBasePaths;
84  class CXXBindTemporaryExpr;
86  class CXXConstructorDecl;
87  class CXXConversionDecl;
88  class CXXDeleteExpr;
89  class CXXDestructorDecl;
90  class CXXFieldCollector;
91  class CXXMemberCallExpr;
92  class CXXMethodDecl;
93  class CXXScopeSpec;
94  class CXXTemporary;
95  class CXXTryStmt;
96  class CallExpr;
97  class ClassTemplateDecl;
98  class ClassTemplatePartialSpecializationDecl;
99  class ClassTemplateSpecializationDecl;
100  class VarTemplatePartialSpecializationDecl;
101  class CodeCompleteConsumer;
102  class CodeCompletionAllocator;
103  class CodeCompletionTUInfo;
104  class CodeCompletionResult;
105  class CoroutineBodyStmt;
106  class Decl;
107  class DeclAccessPair;
108  class DeclContext;
109  class DeclRefExpr;
110  class DeclaratorDecl;
111  class DeducedTemplateArgument;
112  class DependentDiagnostic;
113  class DesignatedInitExpr;
114  class Designation;
115  class EnableIfAttr;
116  class EnumConstantDecl;
117  class Expr;
118  class ExtVectorType;
119  class FormatAttr;
120  class FriendDecl;
121  class FunctionDecl;
122  class FunctionProtoType;
123  class FunctionTemplateDecl;
124  class ImplicitConversionSequence;
126  class InitListExpr;
127  class InitializationKind;
128  class InitializationSequence;
129  class InitializedEntity;
130  class IntegerLiteral;
131  class LabelStmt;
132  class LambdaExpr;
133  class LangOptions;
134  class LocalInstantiationScope;
135  class LookupResult;
136  class MacroInfo;
138  class ModuleLoader;
139  class MultiLevelTemplateArgumentList;
140  class NamedDecl;
141  class ObjCCategoryDecl;
142  class ObjCCategoryImplDecl;
143  class ObjCCompatibleAliasDecl;
144  class ObjCContainerDecl;
145  class ObjCImplDecl;
146  class ObjCImplementationDecl;
147  class ObjCInterfaceDecl;
148  class ObjCIvarDecl;
149  template <class T> class ObjCList;
150  class ObjCMessageExpr;
151  class ObjCMethodDecl;
152  class ObjCPropertyDecl;
153  class ObjCProtocolDecl;
154  class OMPThreadPrivateDecl;
155  class OMPDeclareReductionDecl;
156  class OMPDeclareSimdDecl;
157  class OMPClause;
158  struct OverloadCandidate;
159  class OverloadCandidateSet;
160  class OverloadExpr;
161  class ParenListExpr;
162  class ParmVarDecl;
163  class Preprocessor;
164  class PseudoDestructorTypeStorage;
165  class PseudoObjectExpr;
166  class QualType;
167  class StandardConversionSequence;
168  class Stmt;
169  class StringLiteral;
170  class SwitchStmt;
171  class TemplateArgument;
172  class TemplateArgumentList;
173  class TemplateArgumentLoc;
174  class TemplateDecl;
175  class TemplateParameterList;
176  class TemplatePartialOrderingContext;
177  class TemplateTemplateParmDecl;
178  class Token;
179  class TypeAliasDecl;
180  class TypedefDecl;
181  class TypedefNameDecl;
182  class TypeLoc;
183  class TypoCorrectionConsumer;
184  class UnqualifiedId;
185  class UnresolvedLookupExpr;
186  class UnresolvedMemberExpr;
187  class UnresolvedSetImpl;
188  class UnresolvedSetIterator;
189  class UsingDecl;
190  class UsingShadowDecl;
191  class ValueDecl;
192  class VarDecl;
193  class VarTemplateSpecializationDecl;
194  class VisibilityAttr;
195  class VisibleDeclConsumer;
196  class IndirectFieldDecl;
197  struct DeductionFailureInfo;
198  class TemplateSpecCandidateSet;
199 
200 namespace sema {
201  class AccessedEntity;
202  class BlockScopeInfo;
203  class CapturedRegionScopeInfo;
204  class CapturingScopeInfo;
205  class CompoundScopeInfo;
206  class DelayedDiagnostic;
207  class DelayedDiagnosticPool;
208  class FunctionScopeInfo;
209  class LambdaScopeInfo;
210  class PossiblyUnreachableDiag;
211  class TemplateDeductionInfo;
212 }
213 
214 namespace threadSafety {
215  class BeforeSet;
216  void threadSafetyCleanup(BeforeSet* Cache);
217 }
218 
219 // FIXME: No way to easily map from TemplateTypeParmTypes to
220 // TemplateTypeParmDecls, so we have this horrible PointerUnion.
221 typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
223 
224 /// Describes whether we've seen any nullability information for the given
225 /// file.
227  /// The first pointer declarator (of any pointer kind) in the file that does
228  /// not have a corresponding nullability annotation.
230 
231  /// Which kind of pointer declarator we saw.
232  uint8_t PointerKind;
233 
234  /// Whether we saw any type nullability annotations in the given file.
235  bool SawTypeNullability = false;
236 };
237 
238 /// A mapping from file IDs to a record of whether we've seen nullability
239 /// information in that file.
241  /// A mapping from file IDs to the nullability information for each file ID.
242  llvm::DenseMap<FileID, FileNullability> Map;
243 
244  /// A single-element cache based on the file ID.
245  struct {
248  } Cache;
249 
250 public:
252  // Check the single-element cache.
253  if (file == Cache.File)
254  return Cache.Nullability;
255 
256  // It's not in the single-element cache; flush the cache if we have one.
257  if (!Cache.File.isInvalid()) {
258  Map[Cache.File] = Cache.Nullability;
259  }
260 
261  // Pull this entry into the cache.
262  Cache.File = file;
263  Cache.Nullability = Map[file];
264  return Cache.Nullability;
265  }
266 };
267 
268 /// Sema - This implements semantic analysis and AST building for C.
269 class Sema {
270  Sema(const Sema &) = delete;
271  void operator=(const Sema &) = delete;
272 
273  ///\brief Source of additional semantic information.
274  ExternalSemaSource *ExternalSource;
275 
276  ///\brief Whether Sema has generated a multiplexer and has to delete it.
277  bool isMultiplexExternalSource;
278 
279  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
280 
281  bool isVisibleSlow(const NamedDecl *D);
282 
283  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
284  const NamedDecl *New) {
285  // We are about to link these. It is now safe to compute the linkage of
286  // the new decl. If the new decl has external linkage, we will
287  // link it with the hidden decl (which also has external linkage) and
288  // it will keep having external linkage. If it has internal linkage, we
289  // will not link it. Since it has no previous decls, it will remain
290  // with internal linkage.
291  return isVisible(Old) || New->isExternallyVisible();
292  }
293  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
294 
295 public:
299 
302 
309 
310  /// \brief Flag indicating whether or not to collect detailed statistics.
312 
313  /// \brief Code-completion consumer.
315 
316  /// CurContext - This is the current declaration context of parsing.
318 
319  /// \brief Generally null except when we temporarily switch decl contexts,
320  /// like in \see ActOnObjCTemporaryExitContainerContext.
322 
323  /// VAListTagName - The declaration name corresponding to __va_list_tag.
324  /// This is used as part of a hack to omit that class from ADL results.
326 
327  bool MSStructPragmaOn; // True when \#pragma ms_struct on
328 
329  /// \brief Controls member pointer representation format under the MS ABI.
332 
333  /// Stack of active SEH __finally scopes. Can be empty.
335 
336  /// \brief Source location for newly created implicit MSInheritanceAttrs
338 
339  /// \brief pragma clang section kind
342  PCSK_BSS = 1,
346  };
347 
349  PCSA_Set = 0,
351  };
352 
354  std::string SectionName;
355  bool Valid = false;
357 
361  };
362 
367 
369  PSK_Reset = 0x0, // #pragma ()
370  PSK_Set = 0x1, // #pragma (value)
371  PSK_Push = 0x2, // #pragma (push[, id])
372  PSK_Pop = 0x4, // #pragma (pop[, id])
373  PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
374  PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
375  PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
376  };
377 
378  template<typename ValueType>
379  struct PragmaStack {
380  struct Slot {
381  llvm::StringRef StackSlotLabel;
382  ValueType Value;
384  Slot(llvm::StringRef StackSlotLabel,
385  ValueType Value,
387  : StackSlotLabel(StackSlotLabel), Value(Value),
388  PragmaLocation(PragmaLocation) {}
389  };
390  void Act(SourceLocation PragmaLocation,
392  llvm::StringRef StackSlotLabel,
393  ValueType Value);
394 
395  // MSVC seems to add artificial slots to #pragma stacks on entering a C++
396  // method body to restore the stacks on exit, so it works like this:
397  //
398  // struct S {
399  // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
400  // void Method {}
401  // #pragma <name>(pop, InternalPragmaSlot)
402  // };
403  //
404  // It works even with #pragma vtordisp, although MSVC doesn't support
405  // #pragma vtordisp(push [, id], n)
406  // syntax.
407  //
408  // Push / pop a named sentinel slot.
410  assert((Action == PSK_Push || Action == PSK_Pop) &&
411  "Can only push / pop #pragma stack sentinels!");
412  Act(CurrentPragmaLocation, Action, Label, CurrentValue);
413  }
414 
415  // Constructors.
416  explicit PragmaStack(const ValueType &Default)
417  : DefaultValue(Default), CurrentValue(Default) {}
418 
420  ValueType DefaultValue; // Value used for PSK_Reset action.
421  ValueType CurrentValue;
423  };
424  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
425  // we shouldn't do so if they're in a module).
426 
427  /// \brief Whether to insert vtordisps prior to virtual bases in the Microsoft
428  /// C++ ABI. Possible values are 0, 1, and 2, which mean:
429  ///
430  /// 0: Suppress all vtordisps
431  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
432  /// structors
433  /// 2: Always insert vtordisps to support RTTI on partially constructed
434  /// objects
436  // #pragma pack.
437  // Sentinel to represent when the stack is set to mac68k alignment.
438  static const unsigned kMac68kAlignmentSentinel = ~0U;
440  // Segment #pragmas.
445 
446  // RAII object to push / pop sentinel slots for all MS #pragma stacks.
447  // Actions should be performed only if we enter / exit a C++ method body.
449  public:
450  PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
452 
453  private:
454  Sema &S;
455  StringRef SlotLabel;
456  bool ShouldAct;
457  };
458 
459  /// A mapping that describes the nullability we've seen in each header file.
461 
462  /// Last section used with #pragma init_seg.
465 
466  /// VisContext - Manages the stack for \#pragma GCC visibility.
467  void *VisContext; // Really a "PragmaVisStack*"
468 
469  /// \brief This represents the stack of attributes that were pushed by
470  /// \#pragma clang attribute.
475  bool IsUsed;
476  };
478 
479  /// \brief The declaration that is currently receiving an attribute from the
480  /// #pragma attribute stack.
482 
483  /// \brief This represents the last location of a "#pragma clang optimize off"
484  /// directive if such a directive has not been closed by an "on" yet. If
485  /// optimizations are currently "on", this is set to an invalid location.
487 
488  /// \brief Flag indicating if Sema is building a recovery call expression.
489  ///
490  /// This flag is used to avoid building recovery call expressions
491  /// if Sema is already doing so, which would cause infinite recursions.
493 
494  /// Used to control the generation of ExprWithCleanups.
496 
497  /// ExprCleanupObjects - This is the stack of objects requiring
498  /// cleanup that are created by the current full expression. The
499  /// element type here is ExprWithCleanups::Object.
501 
502  /// \brief Store a list of either DeclRefExprs or MemberExprs
503  /// that contain a reference to a variable (constant) that may or may not
504  /// be odr-used in this Expr, and we won't know until all lvalue-to-rvalue
505  /// and discarded value conversions have been applied to all subexpressions
506  /// of the enclosing full expression. This is cleared at the end of each
507  /// full expression.
508  llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
509 
510  /// \brief Stack containing information about each of the nested
511  /// function, block, and method scopes that are currently active.
512  ///
513  /// This array is never empty. Clients should ignore the first
514  /// element, which is used to cache a single FunctionScopeInfo
515  /// that's used to parse every top-level function.
517 
521 
522  /// ExtVectorDecls - This is a list all the extended vector types. This allows
523  /// us to associate a raw vector type with one of the ext_vector type names.
524  /// This is only necessary for issuing pretty diagnostics.
526 
527  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
528  std::unique_ptr<CXXFieldCollector> FieldCollector;
529 
531 
532  /// \brief Set containing all declared private fields that are not used.
534 
535  /// \brief Set containing all typedefs that are likely unused.
538 
539  /// \brief Delete-expressions to be analyzed at the end of translation unit
540  ///
541  /// This list contains class members, and locations of delete-expressions
542  /// that could not be proven as to whether they mismatch with new-expression
543  /// used in initializer of the field.
544  typedef std::pair<SourceLocation, bool> DeleteExprLoc;
546  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
547 
548  typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy;
549 
550  /// PureVirtualClassDiagSet - a set of class declarations which we have
551  /// emitted a list of pure virtual functions. Used to prevent emitting the
552  /// same list more than once.
553  std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
554 
555  /// ParsingInitForAutoVars - a set of declarations with auto types for which
556  /// we are currently parsing the initializer.
557  llvm::SmallPtrSet<const Decl*, 4> ParsingInitForAutoVars;
558 
559  /// \brief Look for a locally scoped extern "C" declaration by the given name.
561 
565 
566  /// \brief All the tentative definitions encountered in the TU.
568 
572 
573  /// \brief The set of file scoped decls seen so far that have not been used
574  /// and must warn if not used. Only contains the first declaration.
576 
580 
581  /// \brief All the delegating constructors seen so far in the file, used for
582  /// cycle detection at the end of the TU.
584 
585  /// \brief All the overriding functions seen during a class definition
586  /// that had their exception spec checks delayed, plus the overridden
587  /// function.
590 
591  /// \brief All the members seen during a class definition which were both
592  /// explicitly defaulted and had explicitly-specified exception
593  /// specifications, along with the function type containing their
594  /// user-specified exception specification. Those exception specifications
595  /// were overridden with the default specifications, but we still need to
596  /// check whether they are compatible with the default specification, and
597  /// we can't do that until the nesting set of class definitions is complete.
600 
601  typedef llvm::MapVector<const FunctionDecl *,
602  std::unique_ptr<LateParsedTemplate>>
605 
606  /// \brief Callback to the parser to parse templated functions when needed.
607  typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
608  typedef void LateTemplateParserCleanupCB(void *P);
612 
614  LateTemplateParserCleanupCB *LTPCleanup,
615  void *P) {
616  LateTemplateParser = LTP;
617  LateTemplateParserCleanup = LTPCleanup;
618  OpaqueParser = P;
619  }
620 
621  class DelayedDiagnostics;
622 
624  sema::DelayedDiagnosticPool *SavedPool;
626  };
629 
630  /// A class which encapsulates the logic for delaying diagnostics
631  /// during parsing and other processing.
633  /// \brief The current pool of diagnostics into which delayed
634  /// diagnostics should go.
636 
637  public:
638  DelayedDiagnostics() : CurPool(nullptr) {}
639 
640  /// Adds a delayed diagnostic.
641  void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
642 
643  /// Determines whether diagnostics should be delayed.
644  bool shouldDelayDiagnostics() { return CurPool != nullptr; }
645 
646  /// Returns the current delayed-diagnostics pool.
648  return CurPool;
649  }
650 
651  /// Enter a new scope. Access and deprecation diagnostics will be
652  /// collected in this pool.
655  state.SavedPool = CurPool;
656  CurPool = &pool;
657  return state;
658  }
659 
660  /// Leave a delayed-diagnostic state that was previously pushed.
661  /// Do not emit any of the diagnostics. This is performed as part
662  /// of the bookkeeping of popping a pool "properly".
664  CurPool = state.SavedPool;
665  }
666 
667  /// Enter a new scope where access and deprecation diagnostics are
668  /// not delayed.
671  state.SavedPool = CurPool;
672  CurPool = nullptr;
673  return state;
674  }
675 
676  /// Undo a previous pushUndelayed().
678  assert(CurPool == nullptr);
679  CurPool = state.SavedPool;
680  }
682 
683  /// A RAII object to temporarily push a declaration context.
684  class ContextRAII {
685  private:
686  Sema &S;
687  DeclContext *SavedContext;
688  ProcessingContextState SavedContextState;
689  QualType SavedCXXThisTypeOverride;
690 
691  public:
692  ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
693  : S(S), SavedContext(S.CurContext),
694  SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
695  SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
696  {
697  assert(ContextToPush && "pushing null context");
698  S.CurContext = ContextToPush;
699  if (NewThisContext)
701  }
702 
703  void pop() {
704  if (!SavedContext) return;
705  S.CurContext = SavedContext;
706  S.DelayedDiagnostics.popUndelayed(SavedContextState);
707  S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
708  SavedContext = nullptr;
709  }
710 
712  pop();
713  }
714  };
715 
716  /// \brief RAII object to handle the state changes required to synthesize
717  /// a function body.
719  Sema &S;
720  Sema::ContextRAII SavedContext;
721  bool PushedCodeSynthesisContext = false;
722 
723  public:
725  : S(S), SavedContext(S, DC) {
726  S.PushFunctionScope();
729  if (auto *FD = dyn_cast<FunctionDecl>(DC))
730  FD->setWillHaveBody(true);
731  else
732  assert(isa<ObjCMethodDecl>(DC));
733  }
734 
736  assert(!PushedCodeSynthesisContext);
737 
740  Ctx.PointOfInstantiation = UseLoc;
741  Ctx.Entity = cast<Decl>(S.CurContext);
743 
744  PushedCodeSynthesisContext = true;
745  }
746 
748  if (PushedCodeSynthesisContext)
750  if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext))
751  FD->setWillHaveBody(false);
754  }
755  };
756 
757  /// WeakUndeclaredIdentifiers - Identifiers contained in
758  /// \#pragma weak before declared. rare. may alias another
759  /// identifier, declared or undeclared
760  llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
761 
762  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
763  /// \#pragma redefine_extname before declared. Used in Solaris system headers
764  /// to define functions that occur in multiple standards to call the version
765  /// in the currently selected standard.
766  llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
767 
768 
769  /// \brief Load weak undeclared identifiers from the external source.
771 
772  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
773  /// \#pragma weak during processing of other Decls.
774  /// I couldn't figure out a clean way to generate these in-line, so
775  /// we store them here and handle separately -- which is a hack.
776  /// It would be best to refactor this.
778 
780 
781  /// Translation Unit Scope - useful to Objective-C actions that need
782  /// to lookup file scope declarations in the "ordinary" C decl namespace.
783  /// For example, user-defined classes, built-in "id" type, etc.
785 
786  /// \brief The C++ "std" namespace, where the standard library resides.
788 
789  /// \brief The C++ "std::bad_alloc" class, which is defined by the C++
790  /// standard library.
792 
793  /// \brief The C++ "std::align_val_t" enum class, which is defined by the C++
794  /// standard library.
796 
797  /// \brief The C++ "std::experimental" namespace, where the experimental parts
798  /// of the standard library resides.
800 
801  /// \brief The C++ "std::initializer_list" template, which is defined in
802  /// <initializer_list>.
804 
805  /// \brief The C++ "type_info" declaration, which is defined in <typeinfo>.
807 
808  /// \brief The MSVC "_GUID" struct, which is defined in MSVC header files.
810 
811  /// \brief Caches identifiers/selectors for NSFoundation APIs.
812  std::unique_ptr<NSAPI> NSAPIObj;
813 
814  /// \brief The declaration of the Objective-C NSNumber class.
816 
817  /// \brief The declaration of the Objective-C NSValue class.
819 
820  /// \brief Pointer to NSNumber type (NSNumber *).
822 
823  /// \brief Pointer to NSValue type (NSValue *).
825 
826  /// \brief The Objective-C NSNumber methods used to create NSNumber literals.
828 
829  /// \brief The declaration of the Objective-C NSString class.
831 
832  /// \brief Pointer to NSString type (NSString *).
834 
835  /// \brief The declaration of the stringWithUTF8String: method.
837 
838  /// \brief The declaration of the valueWithBytes:objCType: method.
840 
841  /// \brief The declaration of the Objective-C NSArray class.
843 
844  /// \brief The declaration of the arrayWithObjects:count: method.
846 
847  /// \brief The declaration of the Objective-C NSDictionary class.
849 
850  /// \brief The declaration of the dictionaryWithObjects:forKeys:count: method.
852 
853  /// \brief id<NSCopying> type.
855 
856  /// \brief will hold 'respondsToSelector:'
858 
859  /// A flag to remember whether the implicit forms of operator new and delete
860  /// have been declared.
862 
863  /// A flag to indicate that we're in a context that permits abstract
864  /// references to fields. This is really a
866 
867  /// \brief Describes how the expressions currently being parsed are
868  /// evaluated at run-time, if at all.
870  /// \brief The current expression and its subexpressions occur within an
871  /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
872  /// \c sizeof, where the type of the expression may be significant but
873  /// no code will be generated to evaluate the value of the expression at
874  /// run time.
875  Unevaluated,
876 
877  /// \brief The current expression occurs within a braced-init-list within
878  /// an unevaluated operand. This is mostly like a regular unevaluated
879  /// context, except that we still instantiate constexpr functions that are
880  /// referenced here so that we can perform narrowing checks correctly.
882 
883  /// \brief The current expression occurs within a discarded statement.
884  /// This behaves largely similarly to an unevaluated operand in preventing
885  /// definitions from being required, but not in other ways.
887 
888  /// \brief The current expression occurs within an unevaluated
889  /// operand that unconditionally permits abstract references to
890  /// fields, such as a SIZE operator in MS-style inline assembly.
892 
893  /// \brief The current context is "potentially evaluated" in C++11 terms,
894  /// but the expression is evaluated at compile-time (like the values of
895  /// cases in a switch statement).
897 
898  /// \brief The current expression is potentially evaluated at run time,
899  /// which means that code may be generated to evaluate the value of the
900  /// expression at run time.
902 
903  /// \brief The current expression is potentially evaluated, but any
904  /// declarations referenced inside that expression are only used if
905  /// in fact the current expression is used.
906  ///
907  /// This value is used when parsing default function arguments, for which
908  /// we would like to provide diagnostics (e.g., passing non-POD arguments
909  /// through varargs) but do not want to mark declarations as "referenced"
910  /// until the default argument is used.
912  };
913 
914  /// \brief Data structure used to record current or nested
915  /// expression evaluation contexts.
917  /// \brief The expression evaluation context.
919 
920  /// \brief Whether the enclosing context needed a cleanup.
922 
923  /// \brief Whether we are in a decltype expression.
925 
926  /// \brief The number of active cleanup objects when we entered
927  /// this expression evaluation context.
929 
930  /// \brief The number of typos encountered during this expression evaluation
931  /// context (i.e. the number of TypoExprs created).
932  unsigned NumTypos;
933 
934  llvm::SmallPtrSet<Expr*, 2> SavedMaybeODRUseExprs;
935 
936  /// \brief The lambdas that are present within this context, if it
937  /// is indeed an unevaluated context.
939 
940  /// \brief The declaration that provides context for lambda expressions
941  /// and block literals if the normal declaration context does not
942  /// suffice, e.g., in a default function argument.
944 
945  /// \brief The context information used to mangle lambda expressions
946  /// and block literals within this context.
947  ///
948  /// This mangling information is allocated lazily, since most contexts
949  /// do not have lambda expressions or block literals.
950  std::unique_ptr<MangleNumberingContext> MangleNumbering;
951 
952  /// \brief If we are processing a decltype type, a set of call expressions
953  /// for which we have deferred checking the completeness of the return type.
955 
956  /// \brief If we are processing a decltype type, a set of temporary binding
957  /// expressions for which we have deferred checking the destructor.
959 
961  unsigned NumCleanupObjects,
964  bool IsDecltype)
965  : Context(Context), ParentCleanup(ParentCleanup),
966  IsDecltype(IsDecltype), NumCleanupObjects(NumCleanupObjects),
967  NumTypos(0),
968  ManglingContextDecl(ManglingContextDecl), MangleNumbering() { }
969 
970  /// \brief Retrieve the mangling numbering context, used to consistently
971  /// number constructs like lambdas for mangling.
973 
974  bool isUnevaluated() const {
978  }
979  bool isConstantEvaluated() const {
981  }
982  };
983 
984  /// A stack of expression evaluation contexts.
986 
987  /// \brief Compute the mangling number context for a lambda expression or
988  /// block literal.
989  ///
990  /// \param DC - The DeclContext containing the lambda expression or
991  /// block literal.
992  /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl
993  /// associated with the context, if relevant.
995  const DeclContext *DC,
996  Decl *&ManglingContextDecl);
997 
998 
999  /// SpecialMemberOverloadResult - The overloading result for a special member
1000  /// function.
1001  ///
1002  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1003  /// integer are used to determine whether overload resolution succeeded.
1005  public:
1006  enum Kind {
1010  };
1011 
1012  private:
1013  llvm::PointerIntPair<CXXMethodDecl*, 2> Pair;
1014 
1015  public:
1018  : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1019 
1020  CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1021  void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1022 
1023  Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1024  void setKind(Kind K) { Pair.setInt(K); }
1025  };
1026 
1028  : public llvm::FastFoldingSetNode,
1030  public:
1031  SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1032  : FastFoldingSetNode(ID)
1033  {}
1034  };
1035 
1036  /// \brief A cache of special member function overload resolution results
1037  /// for C++ records.
1038  llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1039 
1040  /// \brief A cache of the flags available in enumerations with the flag_bits
1041  /// attribute.
1042  mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1043 
1044  /// \brief The kind of translation unit we are processing.
1045  ///
1046  /// When we're processing a complete translation unit, Sema will perform
1047  /// end-of-translation-unit semantic tasks (such as creating
1048  /// initializers for tentative definitions in C) once parsing has
1049  /// completed. Modules and precompiled headers perform different kinds of
1050  /// checks.
1052 
1053  llvm::BumpPtrAllocator BumpAlloc;
1054 
1055  /// \brief The number of SFINAE diagnostics that have been trapped.
1057 
1058  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1060 
1061  /// \brief A mapping from parameters with unparsed default arguments to the
1062  /// set of instantiations of each parameter.
1063  ///
1064  /// This mapping is a temporary data structure used when parsing
1065  /// nested class templates or nested classes of class templates,
1066  /// where we might end up instantiating an inner class before the
1067  /// default arguments of its methods have been parsed.
1069 
1070  // Contains the locations of the beginning of unparsed default
1071  // argument locations.
1072  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1073 
1074  /// UndefinedInternals - all the used, undefined objects which require a
1075  /// definition in this translation unit.
1076  llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1077 
1078  /// Obtain a sorted list of functions that are undefined but ODR-used.
1079  void getUndefinedButUsed(
1080  SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1081 
1082  /// Retrieves list of suspicious delete-expressions that will be checked at
1083  /// the end of translation unit.
1084  const llvm::MapVector<FieldDecl *, DeleteLocs> &
1086 
1087  typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods;
1088  typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
1089 
1090  /// Method Pool - allows efficient lookup when typechecking messages to "id".
1091  /// We need to maintain a list, since selectors can have differing signatures
1092  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1093  /// of selectors are "overloaded").
1094  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1095  /// methods inside categories with a particular selector.
1097 
1098  /// Method selectors used in a \@selector expression. Used for implementation
1099  /// of -Wselector.
1100  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1101 
1102  /// Kinds of C++ special members.
1111  };
1112 
1113  typedef std::pair<CXXRecordDecl*, CXXSpecialMember> SpecialMemberDecl;
1114 
1115  /// The C++ special members which we are currently in the process of
1116  /// declaring. If this process recursively triggers the declaration of the
1117  /// same special member, we should act as if it is not yet declared.
1118  llvm::SmallSet<SpecialMemberDecl, 4> SpecialMembersBeingDeclared;
1119 
1120  /// The function definitions which were renamed as part of typo-correction
1121  /// to match their respective declarations. We want to keep track of them
1122  /// to ensure that we don't emit a "redefinition" error if we encounter a
1123  /// correctly named definition after the renamed definition.
1124  llvm::SmallPtrSet<const NamedDecl *, 4> TypoCorrectedFunctionDefinitions;
1125 
1126  /// Stack of types that correspond to the parameter entities that are
1127  /// currently being copy-initialized. Can be empty.
1129 
1130  void ReadMethodPool(Selector Sel);
1132 
1133  /// Private Helper predicate to check for 'self'.
1134  bool isSelfExpr(Expr *RExpr);
1135  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1136 
1137  /// \brief Cause the active diagnostic on the DiagosticsEngine to be
1138  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1139  /// should not be used elsewhere.
1140  void EmitCurrentDiagnostic(unsigned DiagID);
1141 
1142  /// Records and restores the FP_CONTRACT state on entry/exit of compound
1143  /// statements.
1145  public:
1146  FPContractStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.FPFeatures) {}
1147  ~FPContractStateRAII() { S.FPFeatures = OldFPFeaturesState; }
1148 
1149  private:
1150  Sema& S;
1151  FPOptions OldFPFeaturesState;
1152  };
1153 
1154  void addImplicitTypedef(StringRef Name, QualType T);
1155 
1156 public:
1157  Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1159  CodeCompleteConsumer *CompletionConsumer = nullptr);
1160  ~Sema();
1161 
1162  /// \brief Perform initialization that occurs after the parser has been
1163  /// initialized but before it parses anything.
1164  void Initialize();
1165 
1166  const LangOptions &getLangOpts() const { return LangOpts; }
1169 
1172  Preprocessor &getPreprocessor() const { return PP; }
1173  ASTContext &getASTContext() const { return Context; }
1174  ASTConsumer &getASTConsumer() const { return Consumer; }
1176  ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1177 
1178  ///\brief Registers an external source. If an external source already exists,
1179  /// creates a multiplex external source and appends to it.
1180  ///
1181  ///\param[in] E - A non-null external sema source.
1182  ///
1184 
1185  void PrintStats() const;
1186 
1187  /// \brief Helper class that creates diagnostics with optional
1188  /// template instantiation stacks.
1189  ///
1190  /// This class provides a wrapper around the basic DiagnosticBuilder
1191  /// class that emits diagnostics. SemaDiagnosticBuilder is
1192  /// responsible for emitting the diagnostic (as DiagnosticBuilder
1193  /// does) and, if the diagnostic comes from inside a template
1194  /// instantiation, printing the template instantiation stack as
1195  /// well.
1197  Sema &SemaRef;
1198  unsigned DiagID;
1199 
1200  public:
1201  SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1202  : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }
1203 
1204  // This is a cunning lie. DiagnosticBuilder actually performs move
1205  // construction in its copy constructor (but due to varied uses, it's not
1206  // possible to conveniently express this as actual move construction). So
1207  // the default copy ctor here is fine, because the base class disables the
1208  // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op
1209  // in that case anwyay.
1210  SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;
1211 
1213  // If we aren't active, there is nothing to do.
1214  if (!isActive()) return;
1215 
1216  // Otherwise, we need to emit the diagnostic. First flush the underlying
1217  // DiagnosticBuilder data, and clear the diagnostic builder itself so it
1218  // won't emit the diagnostic in its own destructor.
1219  //
1220  // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1221  // do its own needless checks to see if the diagnostic needs to be
1222  // emitted. However, because we take care to ensure that the builder
1223  // objects never escape, a sufficiently smart compiler will be able to
1224  // eliminate that code.
1225  FlushCounts();
1226  Clear();
1227 
1228  // Dispatch to Sema to emit the diagnostic.
1229  SemaRef.EmitCurrentDiagnostic(DiagID);
1230  }
1231 
1232  /// Teach operator<< to produce an object of the correct type.
1233  template<typename T>
1235  const SemaDiagnosticBuilder &Diag, const T &Value) {
1236  const DiagnosticBuilder &BaseDiag = Diag;
1237  BaseDiag << Value;
1238  return Diag;
1239  }
1240  };
1241 
1242  /// \brief Emit a diagnostic.
1244  DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
1245  return SemaDiagnosticBuilder(DB, *this, DiagID);
1246  }
1247 
1248  /// \brief Emit a partial diagnostic.
1249  SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic& PD);
1250 
1251  /// \brief Build a partial diagnostic.
1252  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1253 
1254  bool findMacroSpelling(SourceLocation &loc, StringRef name);
1255 
1256  /// \brief Get a string to suggest for zero-initialization of a type.
1257  std::string
1259  std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1260 
1261  /// \brief Calls \c Lexer::getLocForEndOfToken()
1263 
1264  /// \brief Retrieve the module loader associated with the preprocessor.
1265  ModuleLoader &getModuleLoader() const;
1266 
1268 
1271 
1273 
1275 
1276  void PushFunctionScope();
1277  void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1279 
1280  /// \brief This is used to inform Sema what the current TemplateParameterDepth
1281  /// is during Parsing. Currently it is used to pass on the depth
1282  /// when parsing generic lambda 'auto' parameters.
1284 
1285  void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1286  RecordDecl *RD,
1287  CapturedRegionKind K);
1288  void
1290  const Decl *D = nullptr,
1291  const BlockExpr *blkExpr = nullptr);
1292 
1294  return FunctionScopes.back();
1295  }
1296 
1298  if (FunctionScopes.empty())
1299  return nullptr;
1300 
1301  for (int e = FunctionScopes.size()-1; e >= 0; --e) {
1302  if (isa<sema::BlockScopeInfo>(FunctionScopes[e]))
1303  continue;
1304  return FunctionScopes[e];
1305  }
1306  return nullptr;
1307  }
1308 
1309  template <typename ExprT>
1310  void recordUseOfEvaluatedWeak(const ExprT *E, bool IsRead=true) {
1311  if (!isUnevaluatedContext())
1312  getCurFunction()->recordUseOfWeak(E, IsRead);
1313  }
1314 
1315  void PushCompoundScope();
1316  void PopCompoundScope();
1317 
1319 
1321 
1322  /// \brief Retrieve the current block, if any.
1324 
1325  /// Retrieve the current lambda scope info, if any.
1326  /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
1327  /// lambda scope info ignoring all inner capturing scopes that are not
1328  /// lambda scopes.
1330  getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
1331 
1332  /// \brief Retrieve the current generic lambda info, if any.
1334 
1335  /// \brief Retrieve the current captured region, if any.
1337 
1338  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1340 
1341  void ActOnComment(SourceRange Comment);
1342 
1343  //===--------------------------------------------------------------------===//
1344  // Type Analysis / Processing: SemaType.cpp.
1345  //
1346 
1348  const DeclSpec *DS = nullptr);
1349  QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
1350  const DeclSpec *DS = nullptr);
1352  SourceLocation Loc, DeclarationName Entity);
1353  QualType BuildReferenceType(QualType T, bool LValueRef,
1354  SourceLocation Loc, DeclarationName Entity);
1356  Expr *ArraySize, unsigned Quals,
1357  SourceRange Brackets, DeclarationName Entity);
1358  QualType BuildExtVectorType(QualType T, Expr *ArraySize,
1359  SourceLocation AttrLoc);
1360 
1362 
1363  /// \brief Build a function type.
1364  ///
1365  /// This routine checks the function type according to C++ rules and
1366  /// under the assumption that the result type and parameter types have
1367  /// just been instantiated from a template. It therefore duplicates
1368  /// some of the behavior of GetTypeForDeclarator, but in a much
1369  /// simpler form that is only suitable for this narrow use case.
1370  ///
1371  /// \param T The return type of the function.
1372  ///
1373  /// \param ParamTypes The parameter types of the function. This array
1374  /// will be modified to account for adjustments to the types of the
1375  /// function parameters.
1376  ///
1377  /// \param Loc The location of the entity whose type involves this
1378  /// function type or, if there is no such entity, the location of the
1379  /// type that will have function type.
1380  ///
1381  /// \param Entity The name of the entity that involves the function
1382  /// type, if known.
1383  ///
1384  /// \param EPI Extra information about the function type. Usually this will
1385  /// be taken from an existing function with the same prototype.
1386  ///
1387  /// \returns A suitable function type, if there are no errors. The
1388  /// unqualified type will always be a FunctionProtoType.
1389  /// Otherwise, returns a NULL type.
1391  MutableArrayRef<QualType> ParamTypes,
1392  SourceLocation Loc, DeclarationName Entity,
1393  const FunctionProtoType::ExtProtoInfo &EPI);
1394 
1396  SourceLocation Loc,
1397  DeclarationName Entity);
1399  SourceLocation Loc, DeclarationName Entity);
1403  SourceLocation Loc);
1405  SourceLocation Loc);
1406 
1410  TypeSourceInfo *ReturnTypeInfo);
1411 
1412  /// \brief Package the given type and TSI into a ParsedType.
1417  TypeSourceInfo **TInfo = nullptr);
1418  CanThrowResult canThrow(const Expr *E);
1420  const FunctionProtoType *FPT);
1427  const FunctionProtoType *Old, SourceLocation OldLoc,
1428  const FunctionProtoType *New, SourceLocation NewLoc);
1430  const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1431  const FunctionProtoType *Old, SourceLocation OldLoc,
1432  const FunctionProtoType *New, SourceLocation NewLoc);
1433  bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID,
1434  const PartialDiagnostic &NestedDiagID,
1435  const PartialDiagnostic &NoteID,
1436  const FunctionProtoType *Superset,
1437  SourceLocation SuperLoc,
1438  const FunctionProtoType *Subset,
1439  SourceLocation SubLoc);
1440  bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
1441  const PartialDiagnostic &NoteID,
1442  const FunctionProtoType *Target,
1443  SourceLocation TargetLoc,
1444  const FunctionProtoType *Source,
1445  SourceLocation SourceLoc);
1446 
1448 
1449  /// \brief The parser has parsed the context-sensitive type 'instancetype'
1450  /// in an Objective-C message declaration. Return the appropriate type.
1452 
1453  /// \brief Abstract class used to diagnose incomplete types.
1454  struct TypeDiagnoser {
1456 
1457  virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
1458  virtual ~TypeDiagnoser() {}
1459  };
1460 
1461  static int getPrintable(int I) { return I; }
1462  static unsigned getPrintable(unsigned I) { return I; }
1463  static bool getPrintable(bool B) { return B; }
1464  static const char * getPrintable(const char *S) { return S; }
1465  static StringRef getPrintable(StringRef S) { return S; }
1466  static const std::string &getPrintable(const std::string &S) { return S; }
1467  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
1468  return II;
1469  }
1471  static QualType getPrintable(QualType T) { return T; }
1472  static SourceRange getPrintable(SourceRange R) { return R; }
1473  static SourceRange getPrintable(SourceLocation L) { return L; }
1474  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
1475  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
1476 
1477  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
1478  unsigned DiagID;
1479  std::tuple<const Ts &...> Args;
1480 
1481  template <std::size_t... Is>
1482  void emit(const SemaDiagnosticBuilder &DB,
1483  llvm::index_sequence<Is...>) const {
1484  // Apply all tuple elements to the builder in order.
1485  bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
1486  (void)Dummy;
1487  }
1488 
1489  public:
1490  BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
1491  : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
1492  assert(DiagID != 0 && "no diagnostic for type diagnoser");
1493  }
1494 
1495  void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
1496  const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
1497  emit(DB, llvm::index_sequence_for<Ts...>());
1498  DB << T;
1499  }
1500  };
1501 
1502 private:
1503  bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
1504  TypeDiagnoser *Diagnoser);
1505 
1506  struct ModuleScope {
1508  VisibleModuleSet OuterVisibleModules;
1509  };
1510  /// The modules we're currently parsing.
1512 
1513  /// Get the module whose scope we are currently within.
1514  Module *getCurrentModule() const {
1515  return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
1516  }
1517 
1518  VisibleModuleSet VisibleModules;
1519 
1520 public:
1521  /// \brief Get the module owning an entity.
1522  Module *getOwningModule(Decl *Entity) { return Entity->getOwningModule(); }
1523 
1524  /// \brief Make a merged definition of an existing hidden definition \p ND
1525  /// visible at the specified location.
1527 
1528  bool isModuleVisible(Module *M) { return VisibleModules.isVisible(M); }
1529 
1530  /// Determine whether a declaration is visible to name lookup.
1531  bool isVisible(const NamedDecl *D) {
1532  return !D->isHidden() || isVisibleSlow(D);
1533  }
1534 
1535  /// Determine whether any declaration of an entity is visible.
1536  bool
1538  llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
1539  return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
1540  }
1541  bool hasVisibleDeclarationSlow(const NamedDecl *D,
1543 
1546 
1547  /// Determine if \p D and \p Suggested have a structurally compatible
1548  /// layout as described in C11 6.2.7/1.
1549  bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
1550 
1551  /// Determine if \p D has a visible definition. If not, suggest a declaration
1552  /// that should be made visible to expose the definition.
1553  bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
1554  bool OnlyNeedComplete = false);
1556  NamedDecl *Hidden;
1557  return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
1558  }
1559 
1560  /// Determine if the template parameter \p D has a visible default argument.
1561  bool
1563  llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1564 
1565  /// Determine if there is a visible declaration of \p D that is an explicit
1566  /// specialization declaration for a specialization of a template. (For a
1567  /// member specialization, use hasVisibleMemberSpecialization.)
1569  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1570 
1571  /// Determine if there is a visible declaration of \p D that is a member
1572  /// specialization declaration (as opposed to an instantiated declaration).
1574  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
1575 
1576  /// Determine if \p A and \p B are equivalent internal linkage declarations
1577  /// from different modules, and thus an ambiguity error can be downgraded to
1578  /// an extension warning.
1580  const NamedDecl *B);
1582  SourceLocation Loc, const NamedDecl *D,
1584 
1586  return !RequireCompleteTypeImpl(Loc, T, nullptr);
1587  }
1589  TypeDiagnoser &Diagnoser);
1591  unsigned DiagID);
1592 
1593  template <typename... Ts>
1594  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
1595  const Ts &...Args) {
1596  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1597  return RequireCompleteType(Loc, T, Diagnoser);
1598  }
1599 
1600  void completeExprArrayBound(Expr *E);
1601  bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser);
1602  bool RequireCompleteExprType(Expr *E, unsigned DiagID);
1603 
1604  template <typename... Ts>
1605  bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
1606  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1607  return RequireCompleteExprType(E, Diagnoser);
1608  }
1609 
1611  TypeDiagnoser &Diagnoser);
1612  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
1613 
1614  template <typename... Ts>
1615  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
1616  const Ts &...Args) {
1617  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
1618  return RequireLiteralType(Loc, T, Diagnoser);
1619  }
1620 
1622  const CXXScopeSpec &SS, QualType T);
1623 
1625  /// If AsUnevaluated is false, E is treated as though it were an evaluated
1626  /// context, such as when building a type for decltype(auto).
1628  bool AsUnevaluated = true);
1631  SourceLocation Loc);
1632 
1633  //===--------------------------------------------------------------------===//
1634  // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
1635  //
1636 
1637  struct SkipBodyInfo {
1639  : ShouldSkip(false), CheckSameAsPrevious(false), Previous(nullptr),
1640  New(nullptr) {}
1645  };
1646 
1647  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
1648 
1650 
1652 
1654  Scope *S, CXXScopeSpec *SS = nullptr,
1655  bool isClassName = false, bool HasTrailingDot = false,
1656  ParsedType ObjectType = nullptr,
1657  bool IsCtorOrDtorName = false,
1658  bool WantNontrivialTypeSourceInfo = false,
1659  bool IsClassTemplateDeductionContext = true,
1660  IdentifierInfo **CorrectedII = nullptr);
1662  bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
1664  SourceLocation IILoc,
1665  Scope *S,
1666  CXXScopeSpec *SS,
1667  ParsedType &SuggestedType,
1668  bool IsTemplateName = false);
1669 
1670  /// Attempt to behave like MSVC in situations where lookup of an unqualified
1671  /// type name has failed in a dependent context. In these situations, we
1672  /// automatically form a DependentTypeName that will retry lookup in a related
1673  /// scope during instantiation.
1675  SourceLocation NameLoc,
1676  bool IsTemplateTypeArg);
1677 
1678  /// \brief Describes the result of the name lookup and resolution performed
1679  /// by \c ClassifyName().
1690  };
1691 
1694  ExprResult Expr;
1695  TemplateName Template;
1696  ParsedType Type;
1697  const IdentifierInfo *Keyword;
1698 
1699  explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
1700 
1701  public:
1703 
1704  NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {}
1705 
1707  : Kind(NC_Keyword), Keyword(Keyword) { }
1708 
1710  return NameClassification(NC_Error);
1711  }
1712 
1715  }
1716 
1719  }
1720 
1723  Result.Template = Name;
1724  return Result;
1725  }
1726 
1729  Result.Template = Name;
1730  return Result;
1731  }
1732 
1735  Result.Template = Name;
1736  return Result;
1737  }
1738 
1740 
1742  assert(Kind == NC_Type);
1743  return Type;
1744  }
1745 
1747  assert(Kind == NC_Expression);
1748  return Expr;
1749  }
1750 
1752  assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
1753  Kind == NC_VarTemplate);
1754  return Template;
1755  }
1756 
1758  switch (Kind) {
1759  case NC_TypeTemplate:
1760  return TNK_Type_template;
1761  case NC_FunctionTemplate:
1762  return TNK_Function_template;
1763  case NC_VarTemplate:
1764  return TNK_Var_template;
1765  default:
1766  llvm_unreachable("unsupported name classification.");
1767  }
1768  }
1769  };
1770 
1771  /// \brief Perform name lookup on the given name, classifying it based on
1772  /// the results of name lookup and the following token.
1773  ///
1774  /// This routine is used by the parser to resolve identifiers and help direct
1775  /// parsing. When the identifier cannot be found, this routine will attempt
1776  /// to correct the typo and classify based on the resulting name.
1777  ///
1778  /// \param S The scope in which we're performing name lookup.
1779  ///
1780  /// \param SS The nested-name-specifier that precedes the name.
1781  ///
1782  /// \param Name The identifier. If typo correction finds an alternative name,
1783  /// this pointer parameter will be updated accordingly.
1784  ///
1785  /// \param NameLoc The location of the identifier.
1786  ///
1787  /// \param NextToken The token following the identifier. Used to help
1788  /// disambiguate the name.
1789  ///
1790  /// \param IsAddressOfOperand True if this name is the operand of a unary
1791  /// address of ('&') expression, assuming it is classified as an
1792  /// expression.
1793  ///
1794  /// \param CCC The correction callback, if typo correction is desired.
1795  NameClassification
1797  SourceLocation NameLoc, const Token &NextToken,
1798  bool IsAddressOfOperand,
1799  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr);
1800 
1801  /// Describes the detailed kind of a template name. Used in diagnostics.
1803  ClassTemplate,
1804  FunctionTemplate,
1805  VarTemplate,
1806  AliasTemplate,
1807  TemplateTemplateParam,
1808  DependentTemplate
1809  };
1812 
1813  /// Determine whether it's plausible that E was intended to be a
1814  /// template-name.
1816  if (!getLangOpts().CPlusPlus || E.isInvalid())
1817  return false;
1818  if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
1819  return !DRE->hasExplicitTemplateArgs();
1820  if (auto *ME = dyn_cast<MemberExpr>(E.get()))
1821  return !ME->hasExplicitTemplateArgs();
1822  // Any additional cases recognized here should also be handled by
1823  // diagnoseExprIntendedAsTemplateName.
1824  return false;
1825  }
1827  SourceLocation Less,
1828  SourceLocation Greater);
1829 
1831 
1833  MultiTemplateParamsArg TemplateParameterLists);
1838  SourceLocation Loc);
1839  void
1840  diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
1841  SourceLocation FallbackLoc,
1842  SourceLocation ConstQualLoc = SourceLocation(),
1843  SourceLocation VolatileQualLoc = SourceLocation(),
1844  SourceLocation RestrictQualLoc = SourceLocation(),
1845  SourceLocation AtomicQualLoc = SourceLocation(),
1846  SourceLocation UnalignedQualLoc = SourceLocation());
1847 
1848  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
1849  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
1851  const LookupResult &R);
1853  void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
1854  const LookupResult &R);
1855  void CheckShadow(Scope *S, VarDecl *D);
1856 
1857  /// Warn if 'E', which is an expression that is about to be modified, refers
1858  /// to a shadowing declaration.
1860 
1862 
1863 private:
1864  /// Map of current shadowing declarations to shadowed declarations. Warn if
1865  /// it looks like the user is trying to modify the shadowing declaration.
1866  llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
1867 
1868 public:
1869  void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
1870  void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
1871  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
1872  TypedefNameDecl *NewTD);
1875  TypeSourceInfo *TInfo,
1878  LookupResult &Previous, bool &Redeclaration);
1880  TypeSourceInfo *TInfo,
1882  MultiTemplateParamsArg TemplateParamLists,
1883  bool &AddToScope,
1884  ArrayRef<BindingDecl *> Bindings = None);
1885  NamedDecl *
1887  MultiTemplateParamsArg TemplateParamLists);
1888  // Returns true if the variable declaration is a redeclaration
1892  Expr *Init);
1896 
1898  TypeSourceInfo *TInfo,
1900  MultiTemplateParamsArg TemplateParamLists,
1901  bool &AddToScope);
1903 
1904  bool CheckConstexprFunctionDecl(const FunctionDecl *FD);
1905  bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body);
1906 
1909  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1911  SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
1912  // Returns true if the function declaration is a redeclaration
1915  bool IsMemberSpecialization);
1916  bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl);
1917  void CheckMain(FunctionDecl *FD, const DeclSpec &D);
1921  SourceLocation Loc,
1922  QualType T);
1925  QualType T, TypeSourceInfo *TSInfo,
1926  StorageClass SC);
1927  void ActOnParamDefaultArgument(Decl *param,
1928  SourceLocation EqualLoc,
1929  Expr *defarg);
1931  SourceLocation EqualLoc,
1932  SourceLocation ArgLoc);
1933  void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
1934  bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
1935  SourceLocation EqualLoc);
1936 
1937  void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
1938  void ActOnUninitializedDecl(Decl *dcl);
1939  void ActOnInitializerError(Decl *Dcl);
1940 
1941  void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
1942  void ActOnCXXForRangeDecl(Decl *D);
1944  IdentifierInfo *Ident,
1945  ParsedAttributes &Attrs,
1946  SourceLocation AttrEnd);
1947  void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
1948  void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
1949  void FinalizeDeclaration(Decl *D);
1951  ArrayRef<Decl *> Group);
1953 
1954  /// Should be called on all declarations that might have attached
1955  /// documentation comments.
1956  void ActOnDocumentableDecl(Decl *D);
1958 
1960  SourceLocation LocAfterDecls);
1962  FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
1963  SkipBodyInfo *SkipBody = nullptr);
1965  MultiTemplateParamsArg TemplateParamLists,
1966  SkipBodyInfo *SkipBody = nullptr);
1968  SkipBodyInfo *SkipBody = nullptr);
1971  return D && isa<ObjCMethodDecl>(D);
1972  }
1973 
1974  /// \brief Determine whether we can delay parsing the body of a function or
1975  /// function template until it is used, assuming we don't care about emitting
1976  /// code for that function.
1977  ///
1978  /// This will be \c false if we may need the body of the function in the
1979  /// middle of parsing an expression (where it's impractical to switch to
1980  /// parsing a different function), for instance, if it's constexpr in C++11
1981  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
1982  bool canDelayFunctionBody(const Declarator &D);
1983 
1984  /// \brief Determine whether we can skip parsing the body of a function
1985  /// definition, assuming we don't care about analyzing its body or emitting
1986  /// code for that function.
1987  ///
1988  /// This will be \c false only if we may need the body of the function in
1989  /// order to parse the rest of the program (for instance, if it is
1990  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
1991  bool canSkipFunctionBody(Decl *D);
1992 
1995  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
1998 
1999  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
2000  /// attribute for which parsing is delayed.
2002 
2003  /// \brief Diagnose any unused parameters in the given sequence of
2004  /// ParmVarDecl pointers.
2006 
2007  /// \brief Diagnose whether the size of parameters or return value of a
2008  /// function or obj-c method definition is pass-by-value and larger than a
2009  /// specified threshold.
2010  void
2012  QualType ReturnTy, NamedDecl *D);
2013 
2014  void DiagnoseInvalidJumps(Stmt *Body);
2016  SourceLocation AsmLoc,
2017  SourceLocation RParenLoc);
2018 
2019  /// \brief Handle a C++11 empty-declaration and attribute-declaration.
2021  AttributeList *AttrList,
2022  SourceLocation SemiLoc);
2023 
2024  enum class ModuleDeclKind {
2025  Module, ///< 'module X;'
2026  Partition, ///< 'module partition X;'
2027  Implementation, ///< 'module implementation X;'
2028  };
2029 
2030  /// The parser has processed a module-declaration that begins the definition
2031  /// of a module interface or implementation.
2033  SourceLocation ModuleLoc, ModuleDeclKind MDK,
2034  ModuleIdPath Path);
2035 
2036  /// \brief The parser has processed a module import declaration.
2037  ///
2038  /// \param AtLoc The location of the '@' symbol, if any.
2039  ///
2040  /// \param ImportLoc The location of the 'import' keyword.
2041  ///
2042  /// \param Path The module access path.
2044  ModuleIdPath Path);
2045 
2046  /// \brief The parser has processed a module import translated from a
2047  /// #include or similar preprocessing directive.
2048  void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2049  void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2050 
2051  /// \brief The parsed has entered a submodule.
2052  void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
2053  /// \brief The parser has left a submodule.
2054  void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
2055 
2056  /// \brief Create an implicit import of the given module at the given
2057  /// source location, for error recovery, if possible.
2058  ///
2059  /// This routine is typically used when an entity found by name lookup
2060  /// is actually hidden within a module that we know about but the user
2061  /// has forgotten to import.
2063  Module *Mod);
2064 
2065  /// Kinds of missing import. Note, the values of these enumerators correspond
2066  /// to %select values in diagnostics.
2067  enum class MissingImportKind {
2068  Declaration,
2069  Definition,
2070  DefaultArgument,
2071  ExplicitSpecialization,
2072  PartialSpecialization
2073  };
2074 
2075  /// \brief Diagnose that the specified declaration needs to be visible but
2076  /// isn't, and suggest a module import that would resolve the problem.
2078  MissingImportKind MIK, bool Recover = true);
2080  SourceLocation DeclLoc, ArrayRef<Module *> Modules,
2081  MissingImportKind MIK, bool Recover);
2082 
2084  SourceLocation LBraceLoc);
2086  SourceLocation RBraceLoc);
2087 
2088  /// \brief We've found a use of a templated declaration that would trigger an
2089  /// implicit instantiation. Check that any relevant explicit specializations
2090  /// and partial specializations are visible, and diagnose if not.
2092 
2093  /// \brief We've found a use of a template specialization that would select a
2094  /// partial specialization. Check that the partial specialization is visible,
2095  /// and diagnose if not.
2097  NamedDecl *Spec);
2098 
2099  /// \brief Retrieve a suitable printing policy.
2101  return getPrintingPolicy(Context, PP);
2102  }
2103 
2104  /// \brief Retrieve a suitable printing policy.
2105  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
2106  const Preprocessor &PP);
2107 
2108  /// Scope actions.
2109  void ActOnPopScope(SourceLocation Loc, Scope *S);
2111 
2113  RecordDecl *&AnonRecord);
2115  MultiTemplateParamsArg TemplateParams,
2116  bool IsExplicitInstantiation,
2117  RecordDecl *&AnonRecord);
2118 
2120  AccessSpecifier AS,
2121  RecordDecl *Record,
2122  const PrintingPolicy &Policy);
2123 
2125  RecordDecl *Record);
2126 
2127  /// Common ways to introduce type names without a tag for use in diagnostics.
2128  /// Keep in sync with err_tag_reference_non_tag.
2129  enum NonTagKind {
2139  };
2140 
2141  /// Given a non-tag type declaration, returns an enum useful for indicating
2142  /// what kind of non-tag type this is.
2144 
2146  TagTypeKind NewTag, bool isDefinition,
2147  SourceLocation NewTagLoc,
2148  const IdentifierInfo *Name);
2149 
2150  enum TagUseKind {
2151  TUK_Reference, // Reference to a tag: 'struct foo *X;'
2152  TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
2153  TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
2154  TUK_Friend // Friend declaration: 'friend struct foo;'
2155  };
2156 
2157  Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
2159  SourceLocation NameLoc, AttributeList *Attr,
2160  AccessSpecifier AS, SourceLocation ModulePrivateLoc,
2161  MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl,
2162  bool &IsDependent, SourceLocation ScopedEnumKWLoc,
2163  bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
2164  bool IsTypeSpecifier, bool IsTemplateParamOrArg,
2165  SkipBodyInfo *SkipBody = nullptr);
2166 
2168  unsigned TagSpec, SourceLocation TagLoc,
2169  CXXScopeSpec &SS,
2172  MultiTemplateParamsArg TempParamLists);
2173 
2175  unsigned TagSpec,
2176  TagUseKind TUK,
2177  const CXXScopeSpec &SS,
2179  SourceLocation TagLoc,
2180  SourceLocation NameLoc);
2181 
2182  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
2183  IdentifierInfo *ClassName,
2184  SmallVectorImpl<Decl *> &Decls);
2185  Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
2186  Declarator &D, Expr *BitfieldWidth);
2187 
2188  FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
2189  Declarator &D, Expr *BitfieldWidth,
2190  InClassInitStyle InitStyle,
2191  AccessSpecifier AS);
2193  SourceLocation DeclStart,
2194  Declarator &D, Expr *BitfieldWidth,
2195  InClassInitStyle InitStyle,
2196  AccessSpecifier AS,
2197  AttributeList *MSPropertyAttr);
2198 
2200  TypeSourceInfo *TInfo,
2201  RecordDecl *Record, SourceLocation Loc,
2202  bool Mutable, Expr *BitfieldWidth,
2203  InClassInitStyle InitStyle,
2204  SourceLocation TSSL,
2205  AccessSpecifier AS, NamedDecl *PrevDecl,
2206  Declarator *D = nullptr);
2207 
2208  bool CheckNontrivialField(FieldDecl *FD);
2209  void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
2211  bool Diagnose = false);
2213  void ActOnLastBitfield(SourceLocation DeclStart,
2214  SmallVectorImpl<Decl *> &AllIvarDecls);
2215  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
2216  Declarator &D, Expr *BitfieldWidth,
2217  tok::ObjCKeywordKind visibility);
2218 
2219  // This is used for both record definitions and ObjC interface declarations.
2220  void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl,
2221  ArrayRef<Decl *> Fields,
2222  SourceLocation LBrac, SourceLocation RBrac,
2223  AttributeList *AttrList);
2224 
2225  /// ActOnTagStartDefinition - Invoked when we have entered the
2226  /// scope of a tag's definition (e.g., for an enumeration, class,
2227  /// struct, or union).
2229 
2230  /// Perform ODR-like check for C/ObjC when merging tag types from modules.
2231  /// Differently from C++, actually parse the body and reject / error out
2232  /// in case of a structural mismatch.
2233  bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev,
2234  SkipBodyInfo &SkipBody);
2235 
2237 
2238  /// \brief Invoked when we enter a tag definition that we're skipping.
2240 
2242 
2243  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
2244  /// C++ record definition's base-specifiers clause and are starting its
2245  /// member declarations.
2247  SourceLocation FinalLoc,
2248  bool IsFinalSpelledSealed,
2249  SourceLocation LBraceLoc);
2250 
2251  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
2252  /// the definition of a tag (enumeration, class, struct, or union).
2254  SourceRange BraceRange);
2255 
2257 
2259 
2260  /// \brief Invoked when we must temporarily exit the objective-c container
2261  /// scope for parsing/looking-up C constructs.
2262  ///
2263  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
2266 
2267  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
2268  /// error parsing the definition of a tag.
2270 
2272  EnumConstantDecl *LastEnumConst,
2273  SourceLocation IdLoc,
2274  IdentifierInfo *Id,
2275  Expr *val);
2277  bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
2278  QualType EnumUnderlyingTy,
2279  bool EnumUnderlyingIsImplicit,
2280  const EnumDecl *Prev);
2281 
2282  /// Determine whether the body of an anonymous enumeration should be skipped.
2283  /// \param II The name of the first enumerator.
2285  SourceLocation IILoc);
2286 
2287  Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
2288  SourceLocation IdLoc, IdentifierInfo *Id,
2289  AttributeList *Attrs, SourceLocation EqualLoc,
2290  Expr *Val);
2291  void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
2292  Decl *EnumDecl,
2293  ArrayRef<Decl *> Elements,
2294  Scope *S, AttributeList *Attr);
2295 
2297 
2298  /// Set the current declaration context until it gets popped.
2299  void PushDeclContext(Scope *S, DeclContext *DC);
2300  void PopDeclContext();
2301 
2302  /// EnterDeclaratorContext - Used when we must lookup names in the context
2303  /// of a declarator's nested name specifier.
2305  void ExitDeclaratorContext(Scope *S);
2306 
2307  /// Push the parameters of D, which must be a function, into scope.
2309  void ActOnExitFunctionContext();
2310 
2312 
2313  /// getCurFunctionDecl - If inside of a function body, this returns a pointer
2314  /// to the function decl for the function being parsed. If we're currently
2315  /// in a 'block', this returns the containing context.
2317 
2318  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
2319  /// the method decl for the method being parsed. If we're currently
2320  /// in a 'block', this returns the containing context.
2322 
2323  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
2324  /// or C function we're in, otherwise return null. If we're currently
2325  /// in a 'block', this returns the containing context.
2327 
2328  /// Add this decl to the scope shadowed decl chains.
2329  void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
2330 
2331  /// \brief Make the given externally-produced declaration visible at the
2332  /// top level scope.
2333  ///
2334  /// \param D The externally-produced declaration to push.
2335  ///
2336  /// \param Name The name of the externally-produced declaration.
2338 
2339  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
2340  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
2341  /// true if 'D' belongs to the given declaration context.
2342  ///
2343  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
2344  /// enclosing namespace set of the context, rather than contained
2345  /// directly within it.
2346  bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
2347  bool AllowInlineNamespace = false);
2348 
2349  /// Finds the scope corresponding to the given decl context, if it
2350  /// happens to be an enclosing scope. Otherwise return NULL.
2352 
2353  /// Subroutines of ActOnDeclarator().
2355  TypeSourceInfo *TInfo);
2357 
2358  /// \brief Describes the kind of merge to perform for availability
2359  /// attributes (including "deprecated", "unavailable", and "availability").
2361  /// \brief Don't merge availability attributes at all.
2363  /// \brief Merge availability attributes for a redeclaration, which requires
2364  /// an exact match.
2366  /// \brief Merge availability attributes for an override, which requires
2367  /// an exact match or a weakening of constraints.
2369  /// \brief Merge availability attributes for an implementation of
2370  /// a protocol requirement.
2372  };
2373 
2374  /// Attribute merging methods. Return true if a new attribute was added.
2375  AvailabilityAttr *mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
2376  IdentifierInfo *Platform,
2377  bool Implicit,
2378  VersionTuple Introduced,
2379  VersionTuple Deprecated,
2380  VersionTuple Obsoleted,
2381  bool IsUnavailable,
2382  StringRef Message,
2383  bool IsStrict, StringRef Replacement,
2385  unsigned AttrSpellingListIndex);
2386  TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
2387  TypeVisibilityAttr::VisibilityType Vis,
2388  unsigned AttrSpellingListIndex);
2389  VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range,
2390  VisibilityAttr::VisibilityType Vis,
2391  unsigned AttrSpellingListIndex);
2392  UuidAttr *mergeUuidAttr(Decl *D, SourceRange Range,
2393  unsigned AttrSpellingListIndex, StringRef Uuid);
2394  DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
2395  unsigned AttrSpellingListIndex);
2396  DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
2397  unsigned AttrSpellingListIndex);
2398  MSInheritanceAttr *
2399  mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
2400  unsigned AttrSpellingListIndex,
2401  MSInheritanceAttr::Spelling SemanticSpelling);
2402  FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range,
2403  IdentifierInfo *Format, int FormatIdx,
2404  int FirstArg, unsigned AttrSpellingListIndex);
2405  SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
2406  unsigned AttrSpellingListIndex);
2407  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
2408  IdentifierInfo *Ident,
2409  unsigned AttrSpellingListIndex);
2410  MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
2411  unsigned AttrSpellingListIndex);
2412  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
2413  unsigned AttrSpellingListIndex);
2414  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, SourceRange Range,
2415  IdentifierInfo *Ident,
2416  unsigned AttrSpellingListIndex);
2417  CommonAttr *mergeCommonAttr(Decl *D, SourceRange Range, IdentifierInfo *Ident,
2418  unsigned AttrSpellingListIndex);
2419 
2420  void mergeDeclAttributes(NamedDecl *New, Decl *Old,
2423  LookupResult &OldDecls);
2424  bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
2425  bool MergeTypeWithOld);
2427  Scope *S, bool MergeTypeWithOld);
2430  void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
2431  void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
2432  bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
2433  void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
2435 
2436  // AssignmentAction - This is used by all the assignment diagnostic functions
2437  // to represent what is actually causing the operation
2447  };
2448 
2449  /// C++ Overloading.
2451  /// This is a legitimate overload: the existing declarations are
2452  /// functions or function templates with different signatures.
2454 
2455  /// This is not an overload because the signature exactly matches
2456  /// an existing declaration.
2458 
2459  /// This is not an overload because the lookup results contain a
2460  /// non-function.
2462  };
2464  FunctionDecl *New,
2465  const LookupResult &OldDecls,
2466  NamedDecl *&OldDecl,
2467  bool IsForUsingDecl);
2468  bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl,
2469  bool ConsiderCudaAttrs = true);
2470 
2471  /// \brief Checks availability of the function depending on the current
2472  /// function context.Inside an unavailable function,unavailability is ignored.
2473  ///
2474  /// \returns true if \p FD is unavailable and current context is inside
2475  /// an available function, false otherwise.
2477 
2479  TryImplicitConversion(Expr *From, QualType ToType,
2480  bool SuppressUserConversions,
2481  bool AllowExplicit,
2482  bool InOverloadResolution,
2483  bool CStyle,
2484  bool AllowObjCWritebackConversion);
2485 
2486  bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
2487  bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
2488  bool IsComplexPromotion(QualType FromType, QualType ToType);
2489  bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
2490  bool InOverloadResolution,
2491  QualType& ConvertedType, bool &IncompatibleObjC);
2492  bool isObjCPointerConversion(QualType FromType, QualType ToType,
2493  QualType& ConvertedType, bool &IncompatibleObjC);
2494  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
2495  QualType &ConvertedType);
2496  bool IsBlockPointerConversion(QualType FromType, QualType ToType,
2497  QualType& ConvertedType);
2498  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
2499  const FunctionProtoType *NewType,
2500  unsigned *ArgPos = nullptr);
2502  QualType FromType, QualType ToType);
2503 
2506  bool CheckPointerConversion(Expr *From, QualType ToType,
2507  CastKind &Kind,
2508  CXXCastPath& BasePath,
2509  bool IgnoreBaseAccess,
2510  bool Diagnose = true);
2511  bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
2512  bool InOverloadResolution,
2513  QualType &ConvertedType);
2514  bool CheckMemberPointerConversion(Expr *From, QualType ToType,
2515  CastKind &Kind,
2516  CXXCastPath &BasePath,
2517  bool IgnoreBaseAccess);
2518  bool IsQualificationConversion(QualType FromType, QualType ToType,
2519  bool CStyle, bool &ObjCLifetimeConversion);
2520  bool IsFunctionConversion(QualType FromType, QualType ToType,
2521  QualType &ResultTy);
2524 
2526  const VarDecl *NRVOCandidate,
2527  QualType ResultType,
2528  Expr *Value,
2529  bool AllowNRVO = true);
2530 
2532  ExprResult Init);
2534  SourceLocation EqualLoc,
2535  ExprResult Init,
2536  bool TopLevelOfInitList = false,
2537  bool AllowExplicit = false);
2539  NestedNameSpecifier *Qualifier,
2541  CXXMethodDecl *Method);
2542 
2545 
2546  /// Contexts in which a converted constant expression is required.
2547  enum CCEKind {
2548  CCEK_CaseValue, ///< Expression in a case label.
2549  CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
2550  CCEK_TemplateArg, ///< Value of a non-type template parameter.
2551  CCEK_NewExpr, ///< Constant expression in a noptr-new-declarator.
2552  CCEK_ConstexprIf ///< Condition in a constexpr if statement.
2553  };
2555  llvm::APSInt &Value, CCEKind CCE);
2557  APValue &Value, CCEKind CCE);
2558 
2559  /// \brief Abstract base class used to perform a contextual implicit
2560  /// conversion from an expression to any type passing a filter.
2562  public:
2563  bool Suppress;
2565 
2566  ContextualImplicitConverter(bool Suppress = false,
2567  bool SuppressConversion = false)
2568  : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
2569 
2570  /// \brief Determine whether the specified type is a valid destination type
2571  /// for this conversion.
2572  virtual bool match(QualType T) = 0;
2573 
2574  /// \brief Emits a diagnostic complaining that the expression does not have
2575  /// integral or enumeration type.
2576  virtual SemaDiagnosticBuilder
2577  diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) = 0;
2578 
2579  /// \brief Emits a diagnostic when the expression has incomplete class type.
2580  virtual SemaDiagnosticBuilder
2581  diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0;
2582 
2583  /// \brief Emits a diagnostic when the only matching conversion function
2584  /// is explicit.
2585  virtual SemaDiagnosticBuilder diagnoseExplicitConv(
2586  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2587 
2588  /// \brief Emits a note for the explicit conversion function.
2589  virtual SemaDiagnosticBuilder
2590  noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2591 
2592  /// \brief Emits a diagnostic when there are multiple possible conversion
2593  /// functions.
2594  virtual SemaDiagnosticBuilder
2595  diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) = 0;
2596 
2597  /// \brief Emits a note for one of the candidate conversions.
2598  virtual SemaDiagnosticBuilder
2599  noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0;
2600 
2601  /// \brief Emits a diagnostic when we picked a conversion function
2602  /// (for cases when we are not allowed to pick a conversion function).
2603  virtual SemaDiagnosticBuilder diagnoseConversion(
2604  Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
2605 
2607  };
2608 
2610  bool AllowScopedEnumerations;
2611 
2612  public:
2613  ICEConvertDiagnoser(bool AllowScopedEnumerations,
2614  bool Suppress, bool SuppressConversion)
2615  : ContextualImplicitConverter(Suppress, SuppressConversion),
2616  AllowScopedEnumerations(AllowScopedEnumerations) {}
2617 
2618  /// Match an integral or (possibly scoped) enumeration type.
2619  bool match(QualType T) override;
2620 
2623  return diagnoseNotInt(S, Loc, T);
2624  }
2625 
2626  /// \brief Emits a diagnostic complaining that the expression does not have
2627  /// integral or enumeration type.
2628  virtual SemaDiagnosticBuilder
2629  diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0;
2630  };
2631 
2632  /// Perform a contextual implicit conversion.
2634  SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
2635 
2636 
2641  };
2643 
2644  // Note that LK_String is intentionally after the other literals, as
2645  // this is used for diagnostics logic.
2654  };
2656 
2658  NestedNameSpecifier *Qualifier,
2660  NamedDecl *Member);
2661 
2662  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
2663  // TODO: make this is a typesafe union.
2666 
2667  void AddOverloadCandidate(FunctionDecl *Function,
2669  ArrayRef<Expr *> Args,
2670  OverloadCandidateSet &CandidateSet,
2671  bool SuppressUserConversions = false,
2672  bool PartialOverloading = false,
2673  bool AllowExplicit = false,
2674  ConversionSequenceList EarlyConversions = None);
2675  void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
2676  ArrayRef<Expr *> Args,
2677  OverloadCandidateSet &CandidateSet,
2678  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
2679  bool SuppressUserConversions = false,
2680  bool PartialOverloading = false);
2682  QualType ObjectType,
2683  Expr::Classification ObjectClassification,
2684  ArrayRef<Expr *> Args,
2685  OverloadCandidateSet& CandidateSet,
2686  bool SuppressUserConversion = false);
2687  void AddMethodCandidate(CXXMethodDecl *Method,
2689  CXXRecordDecl *ActingContext, QualType ObjectType,
2690  Expr::Classification ObjectClassification,
2691  ArrayRef<Expr *> Args,
2692  OverloadCandidateSet& CandidateSet,
2693  bool SuppressUserConversions = false,
2694  bool PartialOverloading = false,
2695  ConversionSequenceList EarlyConversions = None);
2698  CXXRecordDecl *ActingContext,
2699  TemplateArgumentListInfo *ExplicitTemplateArgs,
2700  QualType ObjectType,
2701  Expr::Classification ObjectClassification,
2702  ArrayRef<Expr *> Args,
2703  OverloadCandidateSet& CandidateSet,
2704  bool SuppressUserConversions = false,
2705  bool PartialOverloading = false);
2706  void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
2708  TemplateArgumentListInfo *ExplicitTemplateArgs,
2709  ArrayRef<Expr *> Args,
2710  OverloadCandidateSet& CandidateSet,
2711  bool SuppressUserConversions = false,
2712  bool PartialOverloading = false);
2713  bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate,
2714  ArrayRef<QualType> ParamTypes,
2715  ArrayRef<Expr *> Args,
2716  OverloadCandidateSet &CandidateSet,
2717  ConversionSequenceList &Conversions,
2718  bool SuppressUserConversions,
2719  CXXRecordDecl *ActingContext = nullptr,
2720  QualType ObjectType = QualType(),
2722  ObjectClassification = {});
2723  void AddConversionCandidate(CXXConversionDecl *Conversion,
2725  CXXRecordDecl *ActingContext,
2726  Expr *From, QualType ToType,
2727  OverloadCandidateSet& CandidateSet,
2728  bool AllowObjCConversionOnExplicit);
2731  CXXRecordDecl *ActingContext,
2732  Expr *From, QualType ToType,
2733  OverloadCandidateSet &CandidateSet,
2734  bool AllowObjCConversionOnExplicit);
2735  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
2737  CXXRecordDecl *ActingContext,
2738  const FunctionProtoType *Proto,
2739  Expr *Object, ArrayRef<Expr *> Args,
2740  OverloadCandidateSet& CandidateSet);
2742  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2743  OverloadCandidateSet& CandidateSet,
2744  SourceRange OpRange = SourceRange());
2745  void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
2746  OverloadCandidateSet& CandidateSet,
2747  bool IsAssignmentOperator = false,
2748  unsigned NumContextualBoolArguments = 0);
2750  SourceLocation OpLoc, ArrayRef<Expr *> Args,
2751  OverloadCandidateSet& CandidateSet);
2753  SourceLocation Loc,
2754  ArrayRef<Expr *> Args,
2755  TemplateArgumentListInfo *ExplicitTemplateArgs,
2756  OverloadCandidateSet& CandidateSet,
2757  bool PartialOverloading = false);
2758 
2759  // Emit as a 'note' the specific overload candidate
2760  void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn,
2761  QualType DestType = QualType(),
2762  bool TakingAddress = false);
2763 
2764  // Emit as a series of 'note's all template and non-templates identified by
2765  // the expression Expr
2766  void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
2767  bool TakingAddress = false);
2768 
2769  /// Check the enable_if expressions on the given function. Returns the first
2770  /// failing attribute, or NULL if they were all successful.
2771  EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
2772  bool MissingImplicitThis = false);
2773 
2774  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2775  /// non-ArgDependent DiagnoseIfAttrs.
2776  ///
2777  /// Argument-dependent diagnose_if attributes should be checked each time a
2778  /// function is used as a direct callee of a function call.
2779  ///
2780  /// Returns true if any errors were emitted.
2782  const Expr *ThisArg,
2784  SourceLocation Loc);
2785 
2786  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
2787  /// ArgDependent DiagnoseIfAttrs.
2788  ///
2789  /// Argument-independent diagnose_if attributes should be checked on every use
2790  /// of a function.
2791  ///
2792  /// Returns true if any errors were emitted.
2794  SourceLocation Loc);
2795 
2796  /// Returns whether the given function's address can be taken or not,
2797  /// optionally emitting a diagnostic if the address can't be taken.
2798  ///
2799  /// Returns false if taking the address of the function is illegal.
2800  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
2801  bool Complain = false,
2802  SourceLocation Loc = SourceLocation());
2803 
2804  // [PossiblyAFunctionType] --> [Return]
2805  // NonFunctionType --> NonFunctionType
2806  // R (A) --> R(A)
2807  // R (*)(A) --> R (A)
2808  // R (&)(A) --> R (A)
2809  // R (S::*)(A) --> R (A)
2810  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
2811 
2812  FunctionDecl *
2814  QualType TargetType,
2815  bool Complain,
2816  DeclAccessPair &Found,
2817  bool *pHadMultipleCandidates = nullptr);
2818 
2819  FunctionDecl *
2821  DeclAccessPair &FoundResult);
2822 
2824  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
2825 
2826  FunctionDecl *
2828  bool Complain = false,
2829  DeclAccessPair *Found = nullptr);
2830 
2832  ExprResult &SrcExpr,
2833  bool DoFunctionPointerConverion = false,
2834  bool Complain = false,
2835  SourceRange OpRangeForComplaining = SourceRange(),
2836  QualType DestTypeForComplaining = QualType(),
2837  unsigned DiagIDForComplaining = 0);
2838 
2839 
2842  FunctionDecl *Fn);
2845  FunctionDecl *Fn);
2846 
2848  ArrayRef<Expr *> Args,
2849  OverloadCandidateSet &CandidateSet,
2850  bool PartialOverloading = false);
2851 
2852  // An enum used to represent the different possible results of building a
2853  // range-based for loop.
2858  };
2859 
2861  SourceLocation RangeLoc,
2862  const DeclarationNameInfo &NameInfo,
2863  LookupResult &MemberLookup,
2864  OverloadCandidateSet *CandidateSet,
2865  Expr *Range, ExprResult *CallExpr);
2866 
2868  UnresolvedLookupExpr *ULE,
2869  SourceLocation LParenLoc,
2870  MultiExprArg Args,
2871  SourceLocation RParenLoc,
2872  Expr *ExecConfig,
2873  bool AllowTypoCorrection=true,
2874  bool CalleesAddressIsTaken=false);
2875 
2877  MultiExprArg Args, SourceLocation RParenLoc,
2878  OverloadCandidateSet *CandidateSet,
2879  ExprResult *Result);
2880 
2882  UnaryOperatorKind Opc,
2883  const UnresolvedSetImpl &Fns,
2884  Expr *input);
2885 
2887  BinaryOperatorKind Opc,
2888  const UnresolvedSetImpl &Fns,
2889  Expr *LHS, Expr *RHS);
2890 
2892  SourceLocation RLoc,
2893  Expr *Base,Expr *Idx);
2894 
2895  ExprResult
2897  SourceLocation LParenLoc,
2898  MultiExprArg Args,
2899  SourceLocation RParenLoc);
2900  ExprResult
2902  MultiExprArg Args,
2903  SourceLocation RParenLoc);
2904 
2906  SourceLocation OpLoc,
2907  bool *NoArrowOperatorFound = nullptr);
2908 
2909  /// CheckCallReturnType - Checks that a call expression's return type is
2910  /// complete. Returns true on failure. The location passed in is the location
2911  /// that best represents the call.
2912  bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
2913  CallExpr *CE, FunctionDecl *FD);
2914 
2915  /// Helpers for dealing with blocks and functions.
2917  bool CheckParameterNames);
2921 
2922  /// \name Name lookup
2923  ///
2924  /// These routines provide name lookup that is used during semantic
2925  /// analysis to resolve the various kinds of names (identifiers,
2926  /// overloaded operator names, constructor names, etc.) into zero or
2927  /// more declarations within a particular scope. The major entry
2928  /// points are LookupName, which performs unqualified name lookup,
2929  /// and LookupQualifiedName, which performs qualified name lookup.
2930  ///
2931  /// All name lookup is performed based on some specific criteria,
2932  /// which specify what names will be visible to name lookup and how
2933  /// far name lookup should work. These criteria are important both
2934  /// for capturing language semantics (certain lookups will ignore
2935  /// certain names, for example) and for performance, since name
2936  /// lookup is often a bottleneck in the compilation of C++. Name
2937  /// lookup criteria is specified via the LookupCriteria enumeration.
2938  ///
2939  /// The results of name lookup can vary based on the kind of name
2940  /// lookup performed, the current language, and the translation
2941  /// unit. In C, for example, name lookup will either return nothing
2942  /// (no entity found) or a single declaration. In C++, name lookup
2943  /// can additionally refer to a set of overloaded functions or
2944  /// result in an ambiguity. All of the possible results of name
2945  /// lookup are captured by the LookupResult class, which provides
2946  /// the ability to distinguish among them.
2947  //@{
2948 
2949  /// @brief Describes the kind of name lookup to perform.
2951  /// Ordinary name lookup, which finds ordinary names (functions,
2952  /// variables, typedefs, etc.) in C and most kinds of names
2953  /// (functions, variables, members, types, etc.) in C++.
2955  /// Tag name lookup, which finds the names of enums, classes,
2956  /// structs, and unions.
2958  /// Label name lookup.
2960  /// Member name lookup, which finds the names of
2961  /// class/struct/union members.
2963  /// Look up of an operator name (e.g., operator+) for use with
2964  /// operator overloading. This lookup is similar to ordinary name
2965  /// lookup, but will ignore any declarations that are class members.
2967  /// Look up of a name that precedes the '::' scope resolution
2968  /// operator in C++. This lookup completely ignores operator, object,
2969  /// function, and enumerator names (C++ [basic.lookup.qual]p1).
2971  /// Look up a namespace name within a C++ using directive or
2972  /// namespace alias definition, ignoring non-namespace names (C++
2973  /// [basic.lookup.udir]p1).
2975  /// Look up all declarations in a scope with the given name,
2976  /// including resolved using declarations. This is appropriate
2977  /// for checking redeclarations for a using declaration.
2979  /// Look up an ordinary name that is going to be redeclared as a
2980  /// name with linkage. This lookup ignores any declarations that
2981  /// are outside of the current scope unless they have linkage. See
2982  /// C99 6.2.2p4-5 and C++ [basic.link]p6.
2984  /// Look up a friend of a local class. This lookup does not look
2985  /// outside the innermost non-class scope. See C++11 [class.friend]p11.
2987  /// Look up the name of an Objective-C protocol.
2989  /// Look up implicit 'self' parameter of an objective-c method.
2991  /// \brief Look up the name of an OpenMP user-defined reduction operation.
2993  /// \brief Look up any declaration with any name.
2995  };
2996 
2997  /// \brief Specifies whether (or how) name lookup is being performed for a
2998  /// redeclaration (vs. a reference).
3000  /// \brief The lookup is a reference to this name that is not for the
3001  /// purpose of redeclaring the name.
3003  /// \brief The lookup results will be used for redeclaration of a name,
3004  /// if an entity by that name already exists.
3006  };
3007 
3008  /// \brief The possible outcomes of name lookup for a literal operator.
3010  /// \brief The lookup resulted in an error.
3012  /// \brief The lookup found a single 'cooked' literal operator, which
3013  /// expects a normal literal to be built and passed to it.
3015  /// \brief The lookup found a single 'raw' literal operator, which expects
3016  /// a string literal containing the spelling of the literal token.
3018  /// \brief The lookup found an overload set of literal operator templates,
3019  /// which expect the characters of the spelling of the literal token to be
3020  /// passed as a non-type template argument pack.
3022  /// \brief The lookup found an overload set of literal operator templates,
3023  /// which expect the character type and characters of the spelling of the
3024  /// string literal token to be passed as template arguments.
3026  };
3027 
3028  SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
3030  bool ConstArg,
3031  bool VolatileArg,
3032  bool RValueThis,
3033  bool ConstThis,
3034  bool VolatileThis);
3035 
3036  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
3037  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
3039 
3040 private:
3041  bool CppLookupName(LookupResult &R, Scope *S);
3042 
3043  struct TypoExprState {
3044  std::unique_ptr<TypoCorrectionConsumer> Consumer;
3045  TypoDiagnosticGenerator DiagHandler;
3046  TypoRecoveryCallback RecoveryHandler;
3047  TypoExprState();
3048  TypoExprState(TypoExprState &&other) noexcept;
3049  TypoExprState &operator=(TypoExprState &&other) noexcept;
3050  };
3051 
3052  /// \brief The set of unhandled TypoExprs and their associated state.
3053  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
3054 
3055  /// \brief Creates a new TypoExpr AST node.
3056  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
3058  TypoRecoveryCallback TRC);
3059 
3060  // \brief The set of known/encountered (unique, canonicalized) NamespaceDecls.
3061  //
3062  // The boolean value will be true to indicate that the namespace was loaded
3063  // from an AST/PCH file, or false otherwise.
3064  llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
3065 
3066  /// \brief Whether we have already loaded known namespaces from an extenal
3067  /// source.
3068  bool LoadedExternalKnownNamespaces;
3069 
3070  /// \brief Helper for CorrectTypo and CorrectTypoDelayed used to create and
3071  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
3072  /// should be skipped entirely.
3073  std::unique_ptr<TypoCorrectionConsumer>
3074  makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
3075  Sema::LookupNameKind LookupKind, Scope *S,
3076  CXXScopeSpec *SS,
3077  std::unique_ptr<CorrectionCandidateCallback> CCC,
3078  DeclContext *MemberContext, bool EnteringContext,
3079  const ObjCObjectPointerType *OPT,
3080  bool ErrorRecovery);
3081 
3082 public:
3083  const TypoExprState &getTypoExprState(TypoExpr *TE) const;
3084 
3085  /// \brief Clears the state of the given TypoExpr.
3086  void clearDelayedTypo(TypoExpr *TE);
3087 
3088  /// \brief Look up a name, looking for a single declaration. Return
3089  /// null if the results were absent, ambiguous, or overloaded.
3090  ///
3091  /// It is preferable to use the elaborated form and explicitly handle
3092  /// ambiguity and overloaded.
3094  SourceLocation Loc,
3095  LookupNameKind NameKind,
3096  RedeclarationKind Redecl
3098  bool LookupName(LookupResult &R, Scope *S,
3099  bool AllowBuiltinCreation = false);
3100  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
3101  bool InUnqualifiedLookup = false);
3102  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
3103  CXXScopeSpec &SS);
3105  bool AllowBuiltinCreation = false,
3106  bool EnteringContext = false);
3108  RedeclarationKind Redecl
3109  = NotForRedeclaration);
3110  bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
3111 
3113  QualType T1, QualType T2,
3114  UnresolvedSetImpl &Functions);
3115 
3117  SourceLocation GnuLabelLoc = SourceLocation());
3118 
3122  unsigned Quals);
3123  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
3124  bool RValueThis, unsigned ThisQuals);
3126  unsigned Quals);
3127  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
3128  bool RValueThis, unsigned ThisQuals);
3130 
3131  bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id);
3133  ArrayRef<QualType> ArgTys,
3134  bool AllowRaw,
3135  bool AllowTemplate,
3136  bool AllowStringTemplate);
3137  bool isKnownName(StringRef name);
3138 
3139  void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
3140  ArrayRef<Expr *> Args, ADLResult &Functions);
3141 
3144  bool IncludeGlobalScope = true);
3146  VisibleDeclConsumer &Consumer,
3147  bool IncludeGlobalScope = true,
3148  bool IncludeDependentBases = false);
3149 
3151  CTK_NonError, // CorrectTypo used in a non error recovery situation.
3152  CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
3153  };
3154 
3156  Sema::LookupNameKind LookupKind,
3157  Scope *S, CXXScopeSpec *SS,
3158  std::unique_ptr<CorrectionCandidateCallback> CCC,
3159  CorrectTypoKind Mode,
3160  DeclContext *MemberContext = nullptr,
3161  bool EnteringContext = false,
3162  const ObjCObjectPointerType *OPT = nullptr,
3163  bool RecordFailure = true);
3164 
3166  Sema::LookupNameKind LookupKind, Scope *S,
3167  CXXScopeSpec *SS,
3168  std::unique_ptr<CorrectionCandidateCallback> CCC,
3171  DeclContext *MemberContext = nullptr,
3172  bool EnteringContext = false,
3173  const ObjCObjectPointerType *OPT = nullptr);
3174 
3175  /// \brief Process any TypoExprs in the given Expr and its children,
3176  /// generating diagnostics as appropriate and returning a new Expr if there
3177  /// were typos that were all successfully corrected and ExprError if one or
3178  /// more typos could not be corrected.
3179  ///
3180  /// \param E The Expr to check for TypoExprs.
3181  ///
3182  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
3183  /// initializer.
3184  ///
3185  /// \param Filter A function applied to a newly rebuilt Expr to determine if
3186  /// it is an acceptable/usable result from a single combination of typo
3187  /// corrections. As long as the filter returns ExprError, different
3188  /// combinations of corrections will be tried until all are exhausted.
3189  ExprResult
3190  CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl = nullptr,
3191  llvm::function_ref<ExprResult(Expr *)> Filter =
3192  [](Expr *E) -> ExprResult { return E; });
3193 
3194  ExprResult
3196  llvm::function_ref<ExprResult(Expr *)> Filter) {
3197  return CorrectDelayedTyposInExpr(E, nullptr, Filter);
3198  }
3199 
3200  ExprResult
3202  llvm::function_ref<ExprResult(Expr *)> Filter =
3203  [](Expr *E) -> ExprResult { return E; }) {
3204  return ER.isInvalid() ? ER : CorrectDelayedTyposInExpr(ER.get(), Filter);
3205  }
3206 
3207  ExprResult
3209  llvm::function_ref<ExprResult(Expr *)> Filter) {
3210  return CorrectDelayedTyposInExpr(ER, nullptr, Filter);
3211  }
3212 
3213  void diagnoseTypo(const TypoCorrection &Correction,
3214  const PartialDiagnostic &TypoDiag,
3215  bool ErrorRecovery = true);
3216 
3217  void diagnoseTypo(const TypoCorrection &Correction,
3218  const PartialDiagnostic &TypoDiag,
3219  const PartialDiagnostic &PrevNote,
3220  bool ErrorRecovery = true);
3221 
3223 
3224  void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
3225  ArrayRef<Expr *> Args,
3226  AssociatedNamespaceSet &AssociatedNamespaces,
3227  AssociatedClassSet &AssociatedClasses);
3228 
3230  bool ConsiderLinkage, bool AllowInlineNamespace);
3231 
3233  //@}
3234 
3236  SourceLocation IdLoc,
3237  bool TypoCorrection = false);
3239  Scope *S, bool ForRedeclaration,
3240  SourceLocation Loc);
3242  Scope *S);
3244 
3245  // More parsing and symbol table subroutines.
3246 
3247  void ProcessPragmaWeak(Scope *S, Decl *D);
3248  // Decl attributes - this routine is the top level dispatcher.
3249  void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
3250  // Helper for delayed processing of attributes.
3251  void ProcessDeclAttributeDelayed(Decl *D, const AttributeList *AttrList);
3252  void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL,
3253  bool IncludeCXX11Attributes = true);
3255  const AttributeList *AttrList);
3256 
3258 
3259  /// Determine if type T is a valid subject for a nonnull and similar
3260  /// attributes. By default, we look through references (the behavior used by
3261  /// nonnull), but if the second parameter is true, then we treat a reference
3262  /// type as valid.
3263  bool isValidPointerAttrType(QualType T, bool RefOkay = false);
3264 
3265  bool CheckRegparmAttr(const AttributeList &attr, unsigned &value);
3266  bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
3267  const FunctionDecl *FD = nullptr);
3268  bool CheckNoReturnAttr(const AttributeList &attr);
3269  bool CheckNoCallerSavedRegsAttr(const AttributeList &attr);
3271  unsigned ArgNum, StringRef &Str,
3272  SourceLocation *ArgLocation = nullptr);
3273  bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
3274  void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
3276  CXXRecordDecl *RD, SourceRange Range, bool BestCase,
3277  MSInheritanceAttr::Spelling SemanticSpelling);
3278 
3280 
3281  /// Adjust the calling convention of a method to be the ABI default if it
3282  /// wasn't specified explicitly. This handles method types formed from
3283  /// function type typedefs and typename template arguments.
3284  void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
3285  SourceLocation Loc);
3286 
3287  // Check if there is an explicit attribute, but only look through parens.
3288  // The intent is to look for an attribute on the current declarator, but not
3289  // one that came from a typedef.
3291 
3292  /// Get the outermost AttributedType node that sets a calling convention.
3293  /// Valid types should not have multiple attributes with different CCs.
3295 
3296  /// Check whether a nullability type specifier can be added to the given
3297  /// type.
3298  ///
3299  /// \param type The type to which the nullability specifier will be
3300  /// added. On success, this type will be updated appropriately.
3301  ///
3302  /// \param nullability The nullability specifier to add.
3303  ///
3304  /// \param nullabilityLoc The location of the nullability specifier.
3305  ///
3306  /// \param isContextSensitive Whether this nullability specifier was
3307  /// written as a context-sensitive keyword (in an Objective-C
3308  /// method) or an Objective-C property attribute, rather than as an
3309  /// underscored type specifier.
3310  ///
3311  /// \param allowArrayTypes Whether to accept nullability specifiers on an
3312  /// array type (e.g., because it will decay to a pointer).
3313  ///
3314  /// \returns true if nullability cannot be applied, false otherwise.
3316  SourceLocation nullabilityLoc,
3317  bool isContextSensitive,
3318  bool allowArrayTypes);
3319 
3320  /// \brief Stmt attributes - this routine is the top level dispatcher.
3322  SourceRange Range);
3323 
3325  ObjCMethodDecl *MethodDecl,
3326  bool IsProtocolMethodDecl);
3327 
3329  ObjCMethodDecl *Overridden,
3330  bool IsProtocolMethodDecl);
3331 
3332  /// WarnExactTypedMethods - This routine issues a warning if method
3333  /// implementation declaration matches exactly that of its declaration.
3335  ObjCMethodDecl *MethodDecl,
3336  bool IsProtocolMethodDecl);
3337 
3338  typedef llvm::SmallPtrSet<Selector, 8> SelectorSet;
3339 
3340  /// CheckImplementationIvars - This routine checks if the instance variables
3341  /// listed in the implelementation match those listed in the interface.
3343  ObjCIvarDecl **Fields, unsigned nIvars,
3344  SourceLocation Loc);
3345 
3346  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
3347  /// remains unimplemented in the class or category \@implementation.
3349  ObjCContainerDecl* IDecl,
3350  bool IncompleteImpl = false);
3351 
3352  /// DiagnoseUnimplementedProperties - This routine warns on those properties
3353  /// which must be implemented by this implementation.
3355  ObjCContainerDecl *CDecl,
3356  bool SynthesizeProperties);
3357 
3358  /// Diagnose any null-resettable synthesized setters.
3360 
3361  /// DefaultSynthesizeProperties - This routine default synthesizes all
3362  /// properties which must be synthesized in the class's \@implementation.
3364  ObjCInterfaceDecl *IDecl,
3365  SourceLocation AtEnd);
3367 
3368  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
3369  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
3370  /// declared in class 'IFace'.
3372  ObjCMethodDecl *Method, ObjCIvarDecl *IV);
3373 
3374  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
3375  /// backs the property is not used in the property's accessor.
3377  const ObjCImplementationDecl *ImplD);
3378 
3379  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
3380  /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
3381  /// It also returns ivar's property on success.
3383  const ObjCPropertyDecl *&PDecl) const;
3384 
3385  /// Called by ActOnProperty to handle \@property declarations in
3386  /// class extensions.
3388  SourceLocation AtLoc,
3389  SourceLocation LParenLoc,
3390  FieldDeclarator &FD,
3391  Selector GetterSel,
3392  SourceLocation GetterNameLoc,
3393  Selector SetterSel,
3394  SourceLocation SetterNameLoc,
3395  const bool isReadWrite,
3396  unsigned &Attributes,
3397  const unsigned AttributesAsWritten,
3398  QualType T,
3399  TypeSourceInfo *TSI,
3400  tok::ObjCKeywordKind MethodImplKind);
3401 
3402  /// Called by ActOnProperty and HandlePropertyInClassExtension to
3403  /// handle creating the ObjcPropertyDecl for a category or \@interface.
3405  ObjCContainerDecl *CDecl,
3406  SourceLocation AtLoc,
3407  SourceLocation LParenLoc,
3408  FieldDeclarator &FD,
3409  Selector GetterSel,
3410  SourceLocation GetterNameLoc,
3411  Selector SetterSel,
3412  SourceLocation SetterNameLoc,
3413  const bool isReadWrite,
3414  const unsigned Attributes,
3415  const unsigned AttributesAsWritten,
3416  QualType T,
3417  TypeSourceInfo *TSI,
3418  tok::ObjCKeywordKind MethodImplKind,
3419  DeclContext *lexicalDC = nullptr);
3420 
3421  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
3422  /// warning) when atomic property has one but not the other user-declared
3423  /// setter or getter.
3425  ObjCInterfaceDecl* IDecl);
3426 
3428 
3430  const ObjCImplementationDecl *ImplD,
3431  const ObjCInterfaceDecl *IFD);
3432 
3434 
3438  };
3439 
3440  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
3441  /// true, or false, accordingly.
3442  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
3443  const ObjCMethodDecl *PrevMethod,
3444  MethodMatchStrategy strategy = MMS_strict);
3445 
3446  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
3447  /// or protocol against those declared in their implementations.
3448  void MatchAllMethodDeclarations(const SelectorSet &InsMap,
3449  const SelectorSet &ClsMap,
3450  SelectorSet &InsMapSeen,
3451  SelectorSet &ClsMapSeen,
3452  ObjCImplDecl* IMPDecl,
3453  ObjCContainerDecl* IDecl,
3454  bool &IncompleteImpl,
3455  bool ImmediateClass,
3456  bool WarnCategoryMethodImpl=false);
3457 
3458  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
3459  /// category matches with those implemented in its primary class and
3460  /// warns each time an exact match is found.
3462 
3463  /// \brief Add the given method to the list of globally-known methods.
3465 
3466 private:
3467  /// AddMethodToGlobalPool - Add an instance or factory method to the global
3468  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
3469  void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
3470 
3471  /// LookupMethodInGlobalPool - Returns the instance or factory method and
3472  /// optionally warns if there are multiple signatures.
3473  ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
3474  bool receiverIdOrClass,
3475  bool instance);
3476 
3477 public:
3478  /// \brief - Returns instance or factory methods in global method pool for
3479  /// given selector. It checks the desired kind first, if none is found, and
3480  /// parameter checkTheOther is set, it then checks the other kind. If no such
3481  /// method or only one method is found, function returns false; otherwise, it
3482  /// returns true.
3483  bool
3486  bool InstanceFirst, bool CheckTheOther,
3487  const ObjCObjectType *TypeBound = nullptr);
3488 
3489  bool
3491  SourceRange R, bool receiverIdOrClass,
3493 
3494  void
3496  Selector Sel, SourceRange R,
3497  bool receiverIdOrClass);
3498 
3499 private:
3500  /// \brief - Returns a selector which best matches given argument list or
3501  /// nullptr if none could be found
3502  ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
3503  bool IsInstance,
3505 
3506 
3507  /// \brief Record the typo correction failure and return an empty correction.
3508  TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
3509  bool RecordFailure = true) {
3510  if (RecordFailure)
3511  TypoCorrectionFailures[Typo].insert(TypoLoc);
3512  return TypoCorrection();
3513  }
3514 
3515 public:
3516  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
3517  /// unit are added to a global pool. This allows us to efficiently associate
3518  /// a selector with a method declaraation for purposes of typechecking
3519  /// messages sent to "id" (where the class of the object is unknown).
3520  void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3521  AddMethodToGlobalPool(Method, impl, /*instance*/true);
3522  }
3523 
3524  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
3525  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
3526  AddMethodToGlobalPool(Method, impl, /*instance*/false);
3527  }
3528 
3529  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
3530  /// pool.
3531  void AddAnyMethodToGlobalPool(Decl *D);
3532 
3533  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
3534  /// there are multiple signatures.
3536  bool receiverIdOrClass=false) {
3537  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3538  /*instance*/true);
3539  }
3540 
3541  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
3542  /// there are multiple signatures.
3544  bool receiverIdOrClass=false) {
3545  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
3546  /*instance*/false);
3547  }
3548 
3550  QualType ObjectType=QualType());
3551  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
3552  /// implementation.
3554 
3555  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
3556  /// initialization.
3559 
3560  //===--------------------------------------------------------------------===//
3561  // Statement Parsing Callbacks: SemaStmt.cpp.
3562 public:
3563  class FullExprArg {
3564  public:
3565  FullExprArg() : E(nullptr) { }
3566  FullExprArg(Sema &actions) : E(nullptr) { }
3567 
3569  return E;
3570  }
3571 
3572  Expr *get() const { return E; }
3573 
3575  return E;
3576  }
3577 
3578  private:
3579  // FIXME: No need to make the entire Sema class a friend when it's just
3580  // Sema::MakeFullExpr that needs access to the constructor below.
3581  friend class Sema;
3582 
3583  explicit FullExprArg(Expr *expr) : E(expr) {}
3584 
3585  Expr *E;
3586  };
3587 
3589  return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
3590  }
3592  return FullExprArg(ActOnFinishFullExpr(Arg, CC).get());
3593  }
3595  ExprResult FE =
3596  ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
3597  /*DiscardedValue*/ true);
3598  return FullExprArg(FE.get());
3599  }
3600 
3603 
3605  bool HasLeadingEmptyMacro = false);
3606 
3607  void ActOnStartOfCompoundStmt();
3610  ArrayRef<Stmt *> Elts, bool isStmtExpr);
3611 
3612  /// \brief A RAII object to enter scope of a compound statement.
3614  public:
3617  }
3618 
3620  S.ActOnFinishOfCompoundStmt();
3621  }
3622 
3623  private:
3624  Sema &S;
3625  };
3626 
3627  /// An RAII helper that pops function a function scope on exit.
3630  bool Active;
3631  FunctionScopeRAII(Sema &S) : S(S), Active(true) {}
3633  if (Active)
3634  S.PopFunctionScopeInfo();
3635  }
3636  void disable() { Active = false; }
3637  };
3638 
3640  SourceLocation StartLoc,
3641  SourceLocation EndLoc);
3644  StmtResult ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
3645  SourceLocation DotDotDotLoc, Expr *RHSVal,
3647  void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
3648 
3651  Stmt *SubStmt, Scope *CurScope);
3653  SourceLocation ColonLoc, Stmt *SubStmt);
3654 
3656  ArrayRef<const Attr*> Attrs,
3657  Stmt *SubStmt);
3658 
3659  class ConditionResult;
3660  StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr,
3661  Stmt *InitStmt,
3662  ConditionResult Cond, Stmt *ThenVal,
3663  SourceLocation ElseLoc, Stmt *ElseVal);
3664  StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
3665  Stmt *InitStmt,
3666  ConditionResult Cond, Stmt *ThenVal,
3667  SourceLocation ElseLoc, Stmt *ElseVal);
3669  Stmt *InitStmt,
3670  ConditionResult Cond);
3672  Stmt *Switch, Stmt *Body);
3673  StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond,
3674  Stmt *Body);
3676  SourceLocation WhileLoc, SourceLocation CondLParen,
3677  Expr *Cond, SourceLocation CondRParen);
3678 
3680  SourceLocation LParenLoc,
3681  Stmt *First,
3682  ConditionResult Second,
3683  FullExprArg Third,
3684  SourceLocation RParenLoc,
3685  Stmt *Body);
3687  Expr *collection);
3689  Stmt *First, Expr *collection,
3690  SourceLocation RParenLoc);
3691  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
3692 
3694  /// Initial building of a for-range statement.
3696  /// Instantiation or recovery rebuild of a for-range statement. Don't
3697  /// attempt any typo-correction.
3699  /// Determining whether a for-range statement could be built. Avoid any
3700  /// unnecessary or irreversible actions.
3702  };
3703 
3705  SourceLocation CoawaitLoc,
3706  Stmt *LoopVar,
3707  SourceLocation ColonLoc, Expr *Collection,
3708  SourceLocation RParenLoc,
3711  SourceLocation CoawaitLoc,
3713  Stmt *RangeDecl, Stmt *Begin, Stmt *End,
3714  Expr *Cond, Expr *Inc,
3715  Stmt *LoopVarDecl,
3716  SourceLocation RParenLoc,
3718  StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
3719 
3721  SourceLocation LabelLoc,
3722  LabelDecl *TheDecl);
3724  SourceLocation StarLoc,
3725  Expr *DestExp);
3726  StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
3727  StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
3728 
3729  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3730  CapturedRegionKind Kind, unsigned NumParams);
3731  typedef std::pair<StringRef, QualType> CapturedParamNameType;
3732  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
3736  void ActOnCapturedRegionError();
3738  SourceLocation Loc,
3739  unsigned NumParams);
3740  VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E,
3741  bool AllowParamOrMoveConstructible);
3742  bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD,
3743  bool AllowParamOrMoveConstructible);
3744 
3745  StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
3746  Scope *CurScope);
3747  StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3748  StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
3749 
3750  StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
3751  bool IsVolatile, unsigned NumOutputs,
3752  unsigned NumInputs, IdentifierInfo **Names,
3753  MultiExprArg Constraints, MultiExprArg Exprs,
3754  Expr *AsmString, MultiExprArg Clobbers,
3755  SourceLocation RParenLoc);
3756 
3758  SourceLocation TemplateKWLoc,
3759  UnqualifiedId &Id,
3760  llvm::InlineAsmIdentifierInfo &Info,
3761  bool IsUnevaluatedContext);
3762  bool LookupInlineAsmField(StringRef Base, StringRef Member,
3763  unsigned &Offset, SourceLocation AsmLoc);
3764  ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member,
3765  llvm::InlineAsmIdentifierInfo &Info,
3766  SourceLocation AsmLoc);
3768  ArrayRef<Token> AsmToks,
3769  StringRef AsmString,
3770  unsigned NumOutputs, unsigned NumInputs,
3771  ArrayRef<StringRef> Constraints,
3772  ArrayRef<StringRef> Clobbers,
3773  ArrayRef<Expr*> Exprs,
3774  SourceLocation EndLoc);
3775  LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
3776  SourceLocation Location,
3777  bool AlwaysCreate);
3778 
3779  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
3780  SourceLocation StartLoc,
3781  SourceLocation IdLoc, IdentifierInfo *Id,
3782  bool Invalid = false);
3783 
3785 
3787  Decl *Parm, Stmt *Body);
3788 
3790 
3792  MultiStmtArg Catch, Stmt *Finally);
3793 
3796  Scope *CurScope);
3798  Expr *operand);
3800  Expr *SynchExpr,
3801  Stmt *SynchBody);
3802 
3804 
3806  SourceLocation StartLoc,
3807  SourceLocation IdLoc,
3808  IdentifierInfo *Id);
3809 
3811 
3813  Decl *ExDecl, Stmt *HandlerBlock);
3814  StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
3815  ArrayRef<Stmt *> Handlers);
3816 
3817  StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
3818  SourceLocation TryLoc, Stmt *TryBlock,
3819  Stmt *Handler);
3821  Expr *FilterExpr,
3822  Stmt *Block);
3827 
3829 
3830  bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const;
3831 
3832  /// \brief If it's a file scoped decl that must warn if not used, keep track
3833  /// of it.
3835 
3836  /// DiagnoseUnusedExprResult - If the statement passed in is an expression
3837  /// whose result is unused, warn.
3838  void DiagnoseUnusedExprResult(const Stmt *S);
3840  void DiagnoseUnusedDecl(const NamedDecl *ND);
3841 
3842  /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
3843  /// statement as a \p Body, and it is located on the same line.
3844  ///
3845  /// This helps prevent bugs due to typos, such as:
3846  /// if (condition);
3847  /// do_stuff();
3849  const Stmt *Body,
3850  unsigned DiagID);
3851 
3852  /// Warn if a for/while loop statement \p S, which is followed by
3853  /// \p PossibleBody, has a suspicious null statement as a body.
3854  void DiagnoseEmptyLoopBody(const Stmt *S,
3855  const Stmt *PossibleBody);
3856 
3857  /// Warn if a value is moved to itself.
3858  void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
3859  SourceLocation OpLoc);
3860 
3861  /// \brief Warn if we're implicitly casting from a _Nullable pointer type to a
3862  /// _Nonnull one.
3864  SourceLocation Loc);
3865 
3866  /// Warn when implicitly casting 0 to nullptr.
3868 
3870  return DelayedDiagnostics.push(pool);
3871  }
3873 
3877  }
3880  }
3881 
3883 
3885  const ObjCInterfaceDecl *UnknownObjCClass,
3886  bool ObjCPropertyAccess,
3887  bool AvoidPartialAvailabilityChecks = false);
3888 
3890  UnavailableAttr::ImplicitReason reason);
3891 
3892  /// \brief Issue any -Wunguarded-availability warnings in \c FD
3894 
3895  //===--------------------------------------------------------------------===//
3896  // Expression Parsing Callbacks: SemaExpr.cpp.
3897 
3898  bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
3900  const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
3901  bool ObjCPropertyAccess = false,
3902  bool AvoidPartialAvailabilityChecks = false);
3905  std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
3907  ObjCMethodDecl *Getter,
3908  SourceLocation Loc);
3910  ArrayRef<Expr *> Args);
3911 
3913  Decl *LambdaContextDecl = nullptr,
3914  bool IsDecltype = false);
3918  bool IsDecltype = false);
3920 
3922 
3925 
3927 
3928  // Functions for marking a declaration referenced. These functions also
3929  // contain the relevant logic for marking if a reference to a function or
3930  // variable is an odr-use (in the C++11 sense). There are separate variants
3931  // for expressions referring to a decl; these exist because odr-use marking
3932  // needs to be delayed for some constant variables when we build one of the
3933  // named expressions.
3934  //
3935  // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
3936  // should usually be true. This only needs to be set to false if the lack of
3937  // odr-use cannot be determined from the current context (for instance,
3938  // because the name denotes a virtual function and was written without an
3939  // explicit nested-name-specifier).
3940  void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
3942  bool MightBeOdrUse = true);
3944  void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
3946 
3948  void CleanupVarDeclMarking();
3949 
3952  };
3953 
3954  /// \brief Try to capture the given variable.
3955  ///
3956  /// \param Var The variable to capture.
3957  ///
3958  /// \param Loc The location at which the capture occurs.
3959  ///
3960  /// \param Kind The kind of capture, which may be implicit (for either a
3961  /// block or a lambda), or explicit by-value or by-reference (for a lambda).
3962  ///
3963  /// \param EllipsisLoc The location of the ellipsis, if one is provided in
3964  /// an explicit lambda capture.
3965  ///
3966  /// \param BuildAndDiagnose Whether we are actually supposed to add the
3967  /// captures or diagnose errors. If false, this routine merely check whether
3968  /// the capture can occur without performing the capture itself or complaining
3969  /// if the variable cannot be captured.
3970  ///
3971  /// \param CaptureType Will be set to the type of the field used to capture
3972  /// this variable in the innermost block or lambda. Only valid when the
3973  /// variable can be captured.
3974  ///
3975  /// \param DeclRefType Will be set to the type of a reference to the capture
3976  /// from within the current scope. Only valid when the variable can be
3977  /// captured.
3978  ///
3979  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
3980  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
3981  /// This is useful when enclosing lambdas must speculatively capture
3982  /// variables that may or may not be used in certain specializations of
3983  /// a nested generic lambda.
3984  ///
3985  /// \returns true if an error occurred (i.e., the variable cannot be
3986  /// captured) and false if the capture succeeded.
3988  SourceLocation EllipsisLoc, bool BuildAndDiagnose,
3989  QualType &CaptureType,
3990  QualType &DeclRefType,
3991  const unsigned *const FunctionScopeIndexToStopAt);
3992 
3993  /// \brief Try to capture the given variable.
3994  bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc,
3996  SourceLocation EllipsisLoc = SourceLocation());
3997 
3998  /// \brief Checks if the variable must be captured.
4000 
4001  /// \brief Given a variable, determine the type that a reference to that
4002  /// variable will have in the given scope.
4004 
4005  /// Mark all of the declarations referenced within a particular AST node as
4006  /// referenced. Used when template instantiation instantiates a non-dependent
4007  /// type -- entities referenced by the type are now referenced.
4010  bool SkipLocalVariables = false);
4011 
4012  /// \brief Try to recover by turning the given expression into a
4013  /// call. Returns true if recovery was attempted or an error was
4014  /// emitted; this may also leave the ExprResult invalid.
4016  bool ForceComplain = false,
4017  bool (*IsPlausibleResult)(QualType) = nullptr);
4018 
4019  /// \brief Figure out if an expression could be turned into a call.
4020  bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
4021  UnresolvedSetImpl &NonTemplateOverloads);
4022 
4023  /// \brief Conditionally issue a diagnostic based on the current
4024  /// evaluation context.
4025  ///
4026  /// \param Statement If Statement is non-null, delay reporting the
4027  /// diagnostic until the function body is parsed, and then do a basic
4028  /// reachability analysis to determine if the statement is reachable.
4029  /// If it is unreachable, the diagnostic will not be emitted.
4030  bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
4031  const PartialDiagnostic &PD);
4032 
4033  // Primary Expressions.
4034  SourceRange getExprRange(Expr *E) const;
4035 
4037  Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
4038  UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
4039  std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr,
4040  bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
4041 
4042  void DecomposeUnqualifiedId(const UnqualifiedId &Id,
4044  DeclarationNameInfo &NameInfo,
4045  const TemplateArgumentListInfo *&TemplateArgs);
4046 
4047  bool
4049  std::unique_ptr<CorrectionCandidateCallback> CCC,
4050  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
4051  ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
4052 
4054  IdentifierInfo *II,
4055  bool AllowBuiltinCreation=false);
4056 
4058  SourceLocation TemplateKWLoc,
4059  const DeclarationNameInfo &NameInfo,
4060  bool isAddressOfOperand,
4061  const TemplateArgumentListInfo *TemplateArgs);
4062 
4064  ExprValueKind VK,
4065  SourceLocation Loc,
4066  const CXXScopeSpec *SS = nullptr);
4067  ExprResult
4069  const DeclarationNameInfo &NameInfo,
4070  const CXXScopeSpec *SS = nullptr,
4071  NamedDecl *FoundD = nullptr,
4072  const TemplateArgumentListInfo *TemplateArgs = nullptr);
4073  ExprResult
4075  const CXXScopeSpec &SS,
4076  SourceLocation nameLoc,
4077  IndirectFieldDecl *indirectField,
4079  Expr *baseObjectExpr = nullptr,
4080  SourceLocation opLoc = SourceLocation());
4081 
4083  SourceLocation TemplateKWLoc,
4084  LookupResult &R,
4085  const TemplateArgumentListInfo *TemplateArgs,
4086  const Scope *S);
4088  SourceLocation TemplateKWLoc,
4089  LookupResult &R,
4090  const TemplateArgumentListInfo *TemplateArgs,
4091  bool IsDefiniteInstance,
4092  const Scope *S);
4094  const LookupResult &R,
4095  bool HasTrailingLParen);
4096 
4097  ExprResult
4099  const DeclarationNameInfo &NameInfo,
4100  bool IsAddressOfOperand, const Scope *S,
4101  TypeSourceInfo **RecoveryTSI = nullptr);
4102 
4104  SourceLocation TemplateKWLoc,
4105  const DeclarationNameInfo &NameInfo,
4106  const TemplateArgumentListInfo *TemplateArgs);
4107 
4109  LookupResult &R,
4110  bool NeedsADL,
4111  bool AcceptInvalidDecl = false);
4113  const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
4114  NamedDecl *FoundD = nullptr,
4115  const TemplateArgumentListInfo *TemplateArgs = nullptr,
4116  bool AcceptInvalidDecl = false);
4117 
4119  DeclarationNameInfo &SuffixInfo,
4120  ArrayRef<Expr *> Args,
4121  SourceLocation LitEndLoc,
4122  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
4123 
4127  ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val);
4128 
4129  bool CheckLoopHintExpr(Expr *E, SourceLocation Loc);
4130 
4131  ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
4133  Scope *UDLScope = nullptr);
4136  SourceLocation R,
4137  MultiExprArg Val);
4138 
4139  /// ActOnStringLiteral - The specified tokens were lexed as pasted string
4140  /// fragments (e.g. "foo" "bar" L"baz").
4142  Scope *UDLScope = nullptr);
4143 
4145  SourceLocation DefaultLoc,
4146  SourceLocation RParenLoc,
4147  Expr *ControllingExpr,
4148  ArrayRef<ParsedType> ArgTypes,
4149  ArrayRef<Expr *> ArgExprs);
4151  SourceLocation DefaultLoc,
4152  SourceLocation RParenLoc,
4153  Expr *ControllingExpr,
4155  ArrayRef<Expr *> Exprs);
4156 
4157  // Binary/Unary Operators. 'Tok' is the token for the operator.
4159  Expr *InputExpr);
4161  UnaryOperatorKind Opc, Expr *Input);
4163  tok::TokenKind Op, Expr *Input);
4164 
4166 
4168  SourceLocation OpLoc,
4169  UnaryExprOrTypeTrait ExprKind,
4170  SourceRange R);
4172  UnaryExprOrTypeTrait ExprKind);
4173  ExprResult
4175  UnaryExprOrTypeTrait ExprKind,
4176  bool IsType, void *TyOrEx,
4177  SourceRange ArgRange);
4178 
4180  bool CheckVecStepExpr(Expr *E);
4181 
4184  SourceRange ExprRange,
4185  UnaryExprOrTypeTrait ExprKind);
4187  SourceLocation OpLoc,
4189  SourceLocation NameLoc,
4190  SourceLocation RParenLoc);
4193 
4195  Expr *Idx, SourceLocation RLoc);
4197  Expr *Idx, SourceLocation RLoc);
4199  Expr *LowerBound, SourceLocation ColonLoc,
4200  Expr *Length, SourceLocation RBLoc);
4201 
4202  // This struct is for use by ActOnMemberAccess to allow
4203  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
4204  // changing the access operator from a '.' to a '->' (to see if that is the
4205  // change needed to fix an error about an unknown member, e.g. when the class
4206  // defines a custom operator->).
4211  };
4212 
4214  Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
4215  CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
4216  NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
4217  const TemplateArgumentListInfo *TemplateArgs,
4218  const Scope *S,
4219  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
4220 
4221  ExprResult
4223  bool IsArrow, const CXXScopeSpec &SS,
4224  SourceLocation TemplateKWLoc,
4225  NamedDecl *FirstQualifierInScope, LookupResult &R,
4226  const TemplateArgumentListInfo *TemplateArgs,
4227  const Scope *S,
4228  bool SuppressQualifierCheck = false,
4229  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
4230 
4231  ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
4232  SourceLocation OpLoc,
4233  const CXXScopeSpec &SS, FieldDecl *Field,
4235  const DeclarationNameInfo &MemberNameInfo);
4236 
4238 
4239  bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
4240  const CXXScopeSpec &SS,
4241  const LookupResult &R);
4242 
4244  bool IsArrow, SourceLocation OpLoc,
4245  const CXXScopeSpec &SS,
4246  SourceLocation TemplateKWLoc,
4247  NamedDecl *FirstQualifierInScope,
4248  const DeclarationNameInfo &NameInfo,
4249  const TemplateArgumentListInfo *TemplateArgs);
4250 
4252  SourceLocation OpLoc,
4253  tok::TokenKind OpKind,
4254  CXXScopeSpec &SS,
4255  SourceLocation TemplateKWLoc,
4256  UnqualifiedId &Member,
4257  Decl *ObjCImpDecl);
4258 
4259  void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
4260  bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
4261  FunctionDecl *FDecl,
4262  const FunctionProtoType *Proto,
4263  ArrayRef<Expr *> Args,
4264  SourceLocation RParenLoc,
4265  bool ExecConfig = false);
4267  ParmVarDecl *Param,
4268  const Expr *ArgExpr);
4269 
4270  /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
4271  /// This provides the location of the left/right parens and a list of comma
4272  /// locations.
4274  MultiExprArg ArgExprs, SourceLocation RParenLoc,
4275  Expr *ExecConfig = nullptr,
4276  bool IsExecConfig = false);
4278  SourceLocation LParenLoc,
4279  ArrayRef<Expr *> Arg,
4280  SourceLocation RParenLoc,
4281  Expr *Config = nullptr,
4282  bool IsExecConfig = false);
4283 
4285  MultiExprArg ExecConfig,
4286  SourceLocation GGGLoc);
4287 
4289  Declarator &D, ParsedType &Ty,
4290  SourceLocation RParenLoc, Expr *CastExpr);
4292  TypeSourceInfo *Ty,
4293  SourceLocation RParenLoc,
4294  Expr *Op);
4296 
4297  /// \brief Build an altivec or OpenCL literal.
4299  SourceLocation RParenLoc, Expr *E,
4300  TypeSourceInfo *TInfo);
4301 
4303 
4305  ParsedType Ty,
4306  SourceLocation RParenLoc,
4307  Expr *InitExpr);
4308 
4310  TypeSourceInfo *TInfo,
4311  SourceLocation RParenLoc,
4312  Expr *LiteralExpr);
4313 
4315  MultiExprArg InitArgList,
4316  SourceLocation RBraceLoc);
4317 
4319  SourceLocation Loc,
4320  bool GNUSyntax,
4321  ExprResult Init);
4322 
4323 private:
4324  static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
4325 
4326 public:
4328  tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
4330  BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
4332  Expr *LHSExpr, Expr *RHSExpr);
4333 
4334  void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
4335 
4336  /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
4337  /// in the case of a the GNU conditional expr extension.
4340  Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
4341 
4342  /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
4344  LabelDecl *TheDecl);
4345 
4346  void ActOnStartStmtExpr();
4347  ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
4348  SourceLocation RPLoc); // "({..})"
4349  void ActOnStmtExprError();
4350 
4351  // __builtin_offsetof(type, identifier(.identifier|[expr])*)
4354  bool isBrackets; // true if [expr], false if .ident
4355  union {
4358  } U;
4359  };
4360 
4361  /// __builtin_offsetof(type, a.b[123][456].c)
4363  TypeSourceInfo *TInfo,
4364  ArrayRef<OffsetOfComponent> Components,
4365  SourceLocation RParenLoc);
4367  SourceLocation BuiltinLoc,
4369  ParsedType ParsedArgTy,
4370  ArrayRef<OffsetOfComponent> Components,
4371  SourceLocation RParenLoc);
4372 
4373  // __builtin_choose_expr(constExpr, expr1, expr2)
4375  Expr *CondExpr, Expr *LHSExpr,
4376  Expr *RHSExpr, SourceLocation RPLoc);
4377 
4378  // __builtin_va_arg(expr, type)
4379  ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty,
4380  SourceLocation RPLoc);
4382  TypeSourceInfo *TInfo, SourceLocation RPLoc);
4383 
4384  // __null
4386 
4387  bool CheckCaseExpression(Expr *E);
4388 
4389  /// \brief Describes the result of an "if-exists" condition check.
4391  /// \brief The symbol exists.
4393 
4394  /// \brief The symbol does not exist.
4396 
4397  /// \brief The name is a dependent name, so the results will differ
4398  /// from one instantiation to the next.
4400 
4401  /// \brief An error occurred.
4403  };
4404 
4407  const DeclarationNameInfo &TargetNameInfo);
4408 
4411  bool IsIfExists, CXXScopeSpec &SS,
4412  UnqualifiedId &Name);
4413 
4415  bool IsIfExists,
4416  NestedNameSpecifierLoc QualifierLoc,
4417  DeclarationNameInfo NameInfo,
4418  Stmt *Nested);
4420  bool IsIfExists,
4422  Stmt *Nested);
4423 
4424  //===------------------------- "Block" Extension ------------------------===//
4425 
4426  /// ActOnBlockStart - This callback is invoked when a block literal is
4427  /// started.
4428  void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
4429 
4430  /// ActOnBlockArguments - This callback allows processing of block arguments.
4431  /// If there are no arguments, this is still invoked.
4432  void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
4433  Scope *CurScope);
4434 
4435  /// ActOnBlockError - If there is an error parsing a block, this callback
4436  /// is invoked to pop the information about the block from the action impl.
4437  void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
4438 
4439  /// ActOnBlockStmtExpr - This is called when the body of a block statement
4440  /// literal was successfully completed. ^(int x){...}
4442  Scope *CurScope);
4443 
4444  //===---------------------------- Clang Extensions ----------------------===//
4445 
4446  /// __builtin_convertvector(...)
4448  SourceLocation BuiltinLoc,
4449  SourceLocation RParenLoc);
4450 
4451  //===---------------------------- OpenCL Features -----------------------===//
4452 
4453  /// __builtin_astype(...)
4454  ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
4455  SourceLocation BuiltinLoc,
4456  SourceLocation RParenLoc);
4457 
4458  //===---------------------------- C++ Features --------------------------===//
4459 
4460  // Act on C++ namespaces
4462  SourceLocation NamespaceLoc,
4463  SourceLocation IdentLoc,
4464  IdentifierInfo *Ident,
4465  SourceLocation LBrace,
4466  AttributeList *AttrList,
4468  void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
4469 
4470  NamespaceDecl *getStdNamespace() const;
4472 
4474 
4475  CXXRecordDecl *getStdBadAlloc() const;
4476  EnumDecl *getStdAlignValT() const;
4477 
4478  /// \brief Tests whether Ty is an instance of std::initializer_list and, if
4479  /// it is and Element is not NULL, assigns the element type to Element.
4480  bool isStdInitializerList(QualType Ty, QualType *Element);
4481 
4482  /// \brief Looks for the std::initializer_list template and instantiates it
4483  /// with Element, or emits an error if it's not found.
4484  ///
4485  /// \returns The instantiated template, or null on error.
4487 
4488  /// \brief Determine whether Ctor is an initializer-list constructor, as
4489  /// defined in [dcl.init.list]p2.
4490  bool isInitListConstructor(const FunctionDecl *Ctor);
4491 
4492  Decl *ActOnUsingDirective(Scope *CurScope,
4493  SourceLocation UsingLoc,
4494  SourceLocation NamespcLoc,
4495  CXXScopeSpec &SS,
4496  SourceLocation IdentLoc,
4497  IdentifierInfo *NamespcName,
4498  AttributeList *AttrList);
4499 
4501 
4502  Decl *ActOnNamespaceAliasDef(Scope *CurScope,
4503  SourceLocation NamespaceLoc,
4504  SourceLocation AliasLoc,
4505  IdentifierInfo *Alias,
4506  CXXScopeSpec &SS,
4507  SourceLocation IdentLoc,
4508  IdentifierInfo *Ident);
4509 
4510  void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
4511  bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target,
4512  const LookupResult &PreviousDecls,
4513  UsingShadowDecl *&PrevShadow);
4515  NamedDecl *Target,
4516  UsingShadowDecl *PrevDecl);
4517 
4519  bool HasTypenameKeyword,
4520  const CXXScopeSpec &SS,
4521  SourceLocation NameLoc,
4522  const LookupResult &Previous);
4524  bool HasTypename,
4525  const CXXScopeSpec &SS,
4526  const DeclarationNameInfo &NameInfo,
4527  SourceLocation NameLoc);
4528 
4530  SourceLocation UsingLoc,
4531  bool HasTypenameKeyword,
4532  SourceLocation TypenameLoc,
4533  CXXScopeSpec &SS,
4534  DeclarationNameInfo NameInfo,
4535  SourceLocation EllipsisLoc,
4536  AttributeList *AttrList,
4537  bool IsInstantiation);
4538  NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
4539  ArrayRef<NamedDecl *> Expansions);
4540 
4542 
4543  /// Given a derived-class using shadow declaration for a constructor and the
4544  /// correspnding base class constructor, find or create the implicit
4545  /// synthesized derived class constructor to use for this initialization.
4548  ConstructorUsingShadowDecl *DerivedShadow);
4549 
4550  Decl *ActOnUsingDeclaration(Scope *CurScope,
4551  AccessSpecifier AS,
4552  SourceLocation UsingLoc,
4553  SourceLocation TypenameLoc,
4554  CXXScopeSpec &SS,
4556  SourceLocation EllipsisLoc,
4557  AttributeList *AttrList);
4558  Decl *ActOnAliasDeclaration(Scope *CurScope,
4559  AccessSpecifier AS,
4560  MultiTemplateParamsArg TemplateParams,
4561  SourceLocation UsingLoc,
4563  AttributeList *AttrList,
4564  TypeResult Type,
4565  Decl *DeclFromDeclSpec);
4566 
4567  /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4568  /// including handling of its default argument expressions.
4569  ///
4570  /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4571  ExprResult
4572  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4574  CXXConstructorDecl *Constructor, MultiExprArg Exprs,
4575  bool HadMultipleCandidates, bool IsListInitialization,
4576  bool IsStdInitListInitialization,
4577  bool RequiresZeroInit, unsigned ConstructKind,
4578  SourceRange ParenRange);
4579 
4580  /// Build a CXXConstructExpr whose constructor has already been resolved if
4581  /// it denotes an inherited constructor.
4582  ExprResult
4583  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4584  CXXConstructorDecl *Constructor, bool Elidable,
4585  MultiExprArg Exprs,
4586  bool HadMultipleCandidates, bool IsListInitialization,
4587  bool IsStdInitListInitialization,
4588  bool RequiresZeroInit, unsigned ConstructKind,
4589  SourceRange ParenRange);
4590 
4591  // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4592  // the constructor can be elidable?
4593  ExprResult
4594  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
4596  CXXConstructorDecl *Constructor, bool Elidable,
4597  MultiExprArg Exprs, bool HadMultipleCandidates,
4598  bool IsListInitialization,
4599  bool IsStdInitListInitialization, bool RequiresZeroInit,
4600  unsigned ConstructKind, SourceRange ParenRange);
4601 
4603 
4604 
4605  /// Instantiate or parse a C++ default argument expression as necessary.
4606  /// Return true on error.
4608  ParmVarDecl *Param);
4609 
4610  /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
4611  /// the default expr if needed.
4613  FunctionDecl *FD,
4614  ParmVarDecl *Param);
4615 
4616  /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4617  /// constructed variable.
4618  void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
4619 
4620  /// \brief Helper class that collects exception specifications for
4621  /// implicitly-declared special member functions.
4623  // Pointer to allow copying
4624  Sema *Self;
4625  // We order exception specifications thus:
4626  // noexcept is the most restrictive, but is only used in C++11.
4627  // throw() comes next.
4628  // Then a throw(collected exceptions)
4629  // Finally no specification, which is expressed as noexcept(false).
4630  // throw(...) is used instead if any called function uses it.
4631  ExceptionSpecificationType ComputedEST;
4632  llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
4633  SmallVector<QualType, 4> Exceptions;
4634 
4635  void ClearExceptions() {
4636  ExceptionsSeen.clear();
4637  Exceptions.clear();
4638  }
4639 
4640  public:
4642  : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4643  if (!Self.getLangOpts().CPlusPlus11)
4644  ComputedEST = EST_DynamicNone;
4645  }
4646 
4647  /// \brief Get the computed exception specification type.
4649  assert(ComputedEST != EST_ComputedNoexcept &&
4650  "noexcept(expr) should not be a possible result");
4651  return ComputedEST;
4652  }
4653 
4654  /// \brief The number of exceptions in the exception specification.
4655  unsigned size() const { return Exceptions.size(); }
4656 
4657  /// \brief The set of exceptions in the exception specification.
4658  const QualType *data() const { return Exceptions.data(); }
4659 
4660  /// \brief Integrate another called method into the collected data.
4661  void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
4662 
4663  /// \brief Integrate an invoked expression into the collected data.
4664  void CalledExpr(Expr *E);
4665 
4666  /// \brief Overwrite an EPI's exception specification with this
4667  /// computed exception specification.
4670  ESI.Type = getExceptionSpecType();
4671  if (ESI.Type == EST_Dynamic) {
4672  ESI.Exceptions = Exceptions;
4673  } else if (ESI.Type == EST_None) {
4674  /// C++11 [except.spec]p14:
4675  /// The exception-specification is noexcept(false) if the set of
4676  /// potential exceptions of the special member function contains "any"
4677  ESI.Type = EST_ComputedNoexcept;
4678  ESI.NoexceptExpr = Self->ActOnCXXBoolLiteral(SourceLocation(),
4679  tok::kw_false).get();
4680  }
4681  return ESI;
4682  }
4683  };
4684 
4685  /// \brief Determine what sort of exception specification a defaulted
4686  /// copy constructor of a class will have.
4687  ImplicitExceptionSpecification
4689  CXXMethodDecl *MD);
4690 
4691  /// \brief Determine what sort of exception specification a defaulted
4692  /// default constructor of a class will have, and whether the parameter
4693  /// will be const.
4694  ImplicitExceptionSpecification
4696 
4697  /// \brief Determine what sort of exception specification a defautled
4698  /// copy assignment operator of a class will have, and whether the
4699  /// parameter will be const.
4700  ImplicitExceptionSpecification
4702 
4703  /// \brief Determine what sort of exception specification a defaulted move
4704  /// constructor of a class will have.
4705  ImplicitExceptionSpecification
4707 
4708  /// \brief Determine what sort of exception specification a defaulted move
4709  /// assignment operator of a class will have.
4710  ImplicitExceptionSpecification
4712 
4713  /// \brief Determine what sort of exception specification a defaulted
4714  /// destructor of a class will have.
4715  ImplicitExceptionSpecification
4717 
4718  /// \brief Determine what sort of exception specification an inheriting
4719  /// constructor of a class will have.
4720  ImplicitExceptionSpecification
4722  CXXConstructorDecl *CD);
4723 
4724  /// \brief Evaluate the implicit exception specification for a defaulted
4725  /// special member function.
4727 
4728  /// \brief Check the given exception-specification and update the
4729  /// exception specification information with the results.
4730  void checkExceptionSpecification(bool IsTopLevel,
4732  ArrayRef<ParsedType> DynamicExceptions,
4733  ArrayRef<SourceRange> DynamicExceptionRanges,
4734  Expr *NoexceptExpr,
4735  SmallVectorImpl<QualType> &Exceptions,
4737 
4738  /// \brief Determine if we're in a case where we need to (incorrectly) eagerly
4739  /// parse an exception specification to work around a libstdc++ bug.
4741 
4742  /// \brief Add an exception-specification to the given member function
4743  /// (or member function template). The exception-specification was parsed
4744  /// after the method itself was declared.
4747  SourceRange SpecificationRange,
4748  ArrayRef<ParsedType> DynamicExceptions,
4749  ArrayRef<SourceRange> DynamicExceptionRanges,
4750  Expr *NoexceptExpr);
4751 
4752  class InheritedConstructorInfo;
4753 
4754  /// \brief Determine if a special member function should have a deleted
4755  /// definition when it is defaulted.
4757  InheritedConstructorInfo *ICI = nullptr,
4758  bool Diagnose = false);
4759 
4760  /// \brief Declare the implicit default constructor for the given class.
4761  ///
4762  /// \param ClassDecl The class declaration into which the implicit
4763  /// default constructor will be added.
4764  ///
4765  /// \returns The implicitly-declared default constructor.
4767  CXXRecordDecl *ClassDecl);
4768 
4769  /// DefineImplicitDefaultConstructor - Checks for feasibility of
4770  /// defining this constructor as the default constructor.
4771  void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
4772  CXXConstructorDecl *Constructor);
4773 
4774  /// \brief Declare the implicit destructor for the given class.
4775  ///
4776  /// \param ClassDecl The class declaration into which the implicit
4777  /// destructor will be added.
4778  ///
4779  /// \returns The implicitly-declared destructor.
4781 
4782  /// DefineImplicitDestructor - Checks for feasibility of
4783  /// defining this destructor as the default destructor.
4784  void DefineImplicitDestructor(SourceLocation CurrentLocation,
4785  CXXDestructorDecl *Destructor);
4786 
4787  /// \brief Build an exception spec for destructors that don't have one.
4788  ///
4789  /// C++11 says that user-defined destructors with no exception spec get one
4790  /// that looks as if the destructor was implicitly declared.
4792  CXXDestructorDecl *Destructor);
4793 
4794  /// \brief Define the specified inheriting constructor.
4796  CXXConstructorDecl *Constructor);
4797 
4798  /// \brief Declare the implicit copy constructor for the given class.
4799  ///
4800  /// \param ClassDecl The class declaration into which the implicit
4801  /// copy constructor will be added.
4802  ///
4803  /// \returns The implicitly-declared copy constructor.
4805 
4806  /// DefineImplicitCopyConstructor - Checks for feasibility of
4807  /// defining this constructor as the copy constructor.
4808  void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
4809  CXXConstructorDecl *Constructor);
4810 
4811  /// \brief Declare the implicit move constructor for the given class.
4812  ///
4813  /// \param ClassDecl The Class declaration into which the implicit
4814  /// move constructor will be added.
4815  ///
4816  /// \returns The implicitly-declared move constructor, or NULL if it wasn't
4817  /// declared.
4819 
4820  /// DefineImplicitMoveConstructor - Checks for feasibility of
4821  /// defining this constructor as the move constructor.
4822  void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
4823  CXXConstructorDecl *Constructor);
4824 
4825  /// \brief Declare the implicit copy assignment operator for the given class.
4826  ///
4827  /// \param ClassDecl The class declaration into which the implicit
4828  /// copy assignment operator will be added.
4829  ///
4830  /// \returns The implicitly-declared copy assignment operator.
4832 
4833  /// \brief Defines an implicitly-declared copy assignment operator.
4834  void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
4835  CXXMethodDecl *MethodDecl);
4836 
4837  /// \brief Declare the implicit move assignment operator for the given class.
4838  ///
4839  /// \param ClassDecl The Class declaration into which the implicit
4840  /// move assignment operator will be added.
4841  ///
4842  /// \returns The implicitly-declared move assignment operator, or NULL if it
4843  /// wasn't declared.
4845 
4846  /// \brief Defines an implicitly-declared move assignment operator.
4847  void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
4848  CXXMethodDecl *MethodDecl);
4849 
4850  /// \brief Force the declaration of any implicitly-declared members of this
4851  /// class.
4853 
4854  /// \brief Check a completed declaration of an implicit special member.
4856 
4857  /// \brief Determine whether the given function is an implicitly-deleted
4858  /// special member function.
4860 
4861  /// \brief Check whether 'this' shows up in the type of a static member
4862  /// function after the (naturally empty) cv-qualifier-seq would be.
4863  ///
4864  /// \returns true if an error occurred.
4866 
4867  /// \brief Whether this' shows up in the exception specification of a static
4868  /// member function.
4870 
4871  /// \brief Check whether 'this' shows up in the attributes of the given
4872  /// static member function.
4873  ///
4874  /// \returns true if an error occurred.
4876 
4877  /// MaybeBindToTemporary - If the passed in expression has a record type with
4878  /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
4879  /// it simply returns the passed in expression.
4881 
4882  bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
4883  MultiExprArg ArgsPtr,
4884  SourceLocation Loc,
4885  SmallVectorImpl<Expr*> &ConvertedArgs,
4886  bool AllowExplicit = false,
4887  bool IsListInitialization = false);
4888 
4890  SourceLocation NameLoc,
4891  IdentifierInfo &Name);
4892 
4894  IdentifierInfo &II, SourceLocation NameLoc,
4895  Scope *S, CXXScopeSpec &SS,
4896  ParsedType ObjectType,
4897  bool EnteringContext);
4898 
4900  ParsedType ObjectType);
4901 
4902  // Checks that reinterpret casts don't have undefined behavior.
4903  void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
4904  bool IsDereference, SourceRange Range);
4905 
4906  /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
4909  SourceLocation LAngleBracketLoc,
4910  Declarator &D,
4911  SourceLocation RAngleBracketLoc,
4912  SourceLocation LParenLoc,
4913  Expr *E,
4914  SourceLocation RParenLoc);
4915 
4918  TypeSourceInfo *Ty,
4919  Expr *E,
4920  SourceRange AngleBrackets,
4921  SourceRange Parens);
4922 
4923  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4924  SourceLocation TypeidLoc,
4925  TypeSourceInfo *Operand,
4926  SourceLocation RParenLoc);
4927  ExprResult BuildCXXTypeId(QualType TypeInfoType,
4928  SourceLocation TypeidLoc,
4929  Expr *Operand,
4930  SourceLocation RParenLoc);
4931 
4932  /// ActOnCXXTypeid - Parse typeid( something ).
4934  SourceLocation LParenLoc, bool isType,
4935  void *TyOrExpr,
4936  SourceLocation RParenLoc);
4937 
4938  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4939  SourceLocation TypeidLoc,
4940  TypeSourceInfo *Operand,
4941  SourceLocation RParenLoc);
4942  ExprResult BuildCXXUuidof(QualType TypeInfoType,
4943  SourceLocation TypeidLoc,
4944  Expr *Operand,
4945  SourceLocation RParenLoc);
4946 
4947  /// ActOnCXXUuidof - Parse __uuidof( something ).
4949  SourceLocation LParenLoc, bool isType,
4950  void *TyOrExpr,
4951  SourceLocation RParenLoc);
4952 
4953  /// \brief Handle a C++1z fold-expression: ( expr op ... op expr ).
4955  tok::TokenKind Operator,
4956  SourceLocation EllipsisLoc, Expr *RHS,
4957  SourceLocation RParenLoc);
4959  BinaryOperatorKind Operator,
4960  SourceLocation EllipsisLoc, Expr *RHS,
4961  SourceLocation RParenLoc);
4963  BinaryOperatorKind Operator);
4964 
4965  //// ActOnCXXThis - Parse 'this' pointer.
4967 
4968  /// \brief Try to retrieve the type of the 'this' pointer.
4969  ///
4970  /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
4972 
4973  /// \brief When non-NULL, the C++ 'this' expression is allowed despite the
4974  /// current context not being a non-static member function. In such cases,
4975  /// this provides the type used for 'this'.
4977 
4978  /// \brief RAII object used to temporarily allow the C++ 'this' expression
4979  /// to be used, with the given qualifiers on the current class type.
4981  Sema &S;
4982  QualType OldCXXThisTypeOverride;
4983  bool Enabled;
4984 
4985  public:
4986  /// \brief Introduce a new scope where 'this' may be allowed (when enabled),
4987  /// using the given declaration (which is either a class template or a
4988  /// class) along with the given qualifiers.
4989  /// along with the qualifiers placed on '*this'.
4990  CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals,
4991  bool Enabled = true);
4992 
4993  ~CXXThisScopeRAII();
4994  };
4995 
4996  /// \brief Make sure the value of 'this' is actually available in the current
4997  /// context, if it is a potentially evaluated context.
4998  ///
4999  /// \param Loc The location at which the capture of 'this' occurs.
5000  ///
5001  /// \param Explicit Whether 'this' is explicitly captured in a lambda
5002  /// capture list.
5003  ///
5004  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5005  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5006  /// This is useful when enclosing lambdas must speculatively capture
5007  /// 'this' that may or may not be used in certain specializations of
5008  /// a nested generic lambda (depending on whether the name resolves to
5009  /// a non-static member function or a static function).
5010  /// \return returns 'true' if failed, 'false' if success.
5011  bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
5012  bool BuildAndDiagnose = true,
5013  const unsigned *const FunctionScopeIndexToStopAt = nullptr,
5014  bool ByCopy = false);
5015 
5016  /// \brief Determine whether the given type is the type of *this that is used
5017  /// outside of the body of a member function for a type that is currently
5018  /// being defined.
5020 
5021  /// ActOnCXXBoolLiteral - Parse {true,false} literals.
5023 
5024 
5025  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
5027 
5028  ExprResult
5030  SourceLocation AtLoc, SourceLocation RParen);
5031 
5032  /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
5034 
5035  //// ActOnCXXThrow - Parse throw expressions.
5038  bool IsThrownVarInScope);
5039  bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
5040 
5041  /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
5042  /// Can be interpreted either as function-style casting ("int(x)")
5043  /// or class type construction ("ClassType(x,y,z)")
5044  /// or creation of a value-initialized type ("int()").
5046  SourceLocation LParenLoc,
5047  MultiExprArg Exprs,
5048  SourceLocation RParenLoc);
5049 
5051  SourceLocation LParenLoc,
5052  MultiExprArg Exprs,
5053  SourceLocation RParenLoc);
5054 
5055  /// ActOnCXXNew - Parsed a C++ 'new' expression.
5056  ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
5057  SourceLocation PlacementLParen,
5058  MultiExprArg PlacementArgs,
5059  SourceLocation PlacementRParen,
5060  SourceRange TypeIdParens, Declarator &D,
5061  Expr *Initializer);
5062  ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal,
5063  SourceLocation PlacementLParen,
5064  MultiExprArg PlacementArgs,
5065  SourceLocation PlacementRParen,
5066  SourceRange TypeIdParens,
5067  QualType AllocType,
5068  TypeSourceInfo *AllocTypeInfo,
5069  Expr *ArraySize,
5070  SourceRange DirectInitRange,
5071  Expr *Initializer);
5072 
5073  bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
5074  SourceRange R);
5075  bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
5076  bool UseGlobal, QualType AllocType, bool IsArray,
5077  bool &PassAlignment, MultiExprArg PlaceArgs,
5078  FunctionDecl *&OperatorNew,
5079  FunctionDecl *&OperatorDelete);
5080  void DeclareGlobalNewDelete();
5082  ArrayRef<QualType> Params);
5083 
5085  DeclarationName Name, FunctionDecl* &Operator,
5086  bool Diagnose = true);
5088  bool CanProvideSize,
5089  bool Overaligned,
5092  CXXRecordDecl *RD);
5093 
5094  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
5096  bool UseGlobal, bool ArrayForm,
5097  Expr *Operand);
5099  bool IsDelete, bool CallCanBeVirtual,
5100  bool WarnOnNonAbstractTypes,
5101  SourceLocation DtorLoc);
5102 
5104  Expr *Operand, SourceLocation RParen);
5106  SourceLocation RParen);
5107 
5108  /// \brief Parsed one of the type trait support pseudo-functions.
5110  ArrayRef<ParsedType> Args,
5111  SourceLocation RParenLoc);
5114  SourceLocation RParenLoc);
5115 
5116  /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
5117  /// pseudo-functions.
5119  SourceLocation KWLoc,
5120  ParsedType LhsTy,
5121  Expr *DimExpr,
5122  SourceLocation RParen);
5123 
5125  SourceLocation KWLoc,
5126  TypeSourceInfo *TSInfo,
5127  Expr *DimExpr,
5128  SourceLocation RParen);
5129 
5130  /// ActOnExpressionTrait - Parsed one of the unary type trait support
5131  /// pseudo-functions.
5133  SourceLocation KWLoc,
5134  Expr *Queried,
5135  SourceLocation RParen);
5136 
5138  SourceLocation KWLoc,
5139  Expr *Queried,
5140  SourceLocation RParen);
5141 
5143  Expr *Base,
5144  SourceLocation OpLoc,
5145  tok::TokenKind OpKind,
5146  ParsedType &ObjectType,
5147  bool &MayBePseudoDestructor);
5148 
5150  SourceLocation OpLoc,
5151  tok::TokenKind OpKind,
5152  const CXXScopeSpec &SS,
5153  TypeSourceInfo *ScopeType,
5154  SourceLocation CCLoc,
5155  SourceLocation TildeLoc,
5156  PseudoDestructorTypeStorage DestroyedType);
5157 
5159  SourceLocation OpLoc,
5160  tok::TokenKind OpKind,
5161  CXXScopeSpec &SS,
5162  UnqualifiedId &FirstTypeName,
5163  SourceLocation CCLoc,
5164  SourceLocation TildeLoc,
5165  UnqualifiedId &SecondTypeName);
5166 
5168  SourceLocation OpLoc,
5169  tok::TokenKind OpKind,
5170  SourceLocation TildeLoc,
5171  const DeclSpec& DS);
5172 
5173  /// MaybeCreateExprWithCleanups - If the current full-expression
5174  /// requires any cleanups, surround it with a ExprWithCleanups node.
5175  /// Otherwise, just returns the passed-in expression.
5179 
5182  bool BoundToLvalueReference);
5183 
5185  return ActOnFinishFullExpr(Expr, Expr ? Expr->getExprLoc()
5186  : SourceLocation());
5187  }
5189  bool DiscardedValue = false,
5190  bool IsConstexpr = false,
5191  bool IsLambdaInitCaptureInitializer = false);
5193 
5194  // Marks SS invalid if it represents an incomplete type.
5196 
5199  bool EnteringContext = false);
5200  bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
5202 
5203  /// \brief The parser has parsed a global nested-name-specifier '::'.
5204  ///
5205  /// \param CCLoc The location of the '::'.
5206  ///
5207  /// \param SS The nested-name-specifier, which will be updated in-place
5208  /// to reflect the parsed nested-name-specifier.
5209  ///
5210  /// \returns true if an error occurred, false otherwise.
5212 
5213  /// \brief The parser has parsed a '__super' nested-name-specifier.
5214  ///
5215  /// \param SuperLoc The location of the '__super' keyword.
5216  ///
5217  /// \param ColonColonLoc The location of the '::'.
5218  ///
5219  /// \param SS The nested-name-specifier, which will be updated in-place
5220  /// to reflect the parsed nested-name-specifier.
5221  ///
5222  /// \returns true if an error occurred, false otherwise.
5224  SourceLocation ColonColonLoc, CXXScopeSpec &SS);
5225 
5227  bool *CanCorrect = nullptr);
5229 
5230  /// \brief Keeps information about an identifier in a nested-name-spec.
5231  ///
5233  /// \brief The type of the object, if we're parsing nested-name-specifier in
5234  /// a member access expression.
5236 
5237  /// \brief The identifier preceding the '::'.
5239 
5240  /// \brief The location of the identifier.
5242 
5243  /// \brief The location of the '::'.
5245 
5246  /// \brief Creates info object for the most typical case.
5248  SourceLocation ColonColonLoc, ParsedType ObjectType = ParsedType())
5249  : ObjectType(ObjectType), Identifier(II), IdentifierLoc(IdLoc),
5250  CCLoc(ColonColonLoc) {
5251  }
5252 
5254  SourceLocation ColonColonLoc, QualType ObjectType)
5255  : ObjectType(ParsedType::make(ObjectType)), Identifier(II),
5256  IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {
5257  }
5258  };
5259 
5261  NestedNameSpecInfo &IdInfo);
5262 
5264  NestedNameSpecInfo &IdInfo,
5265  bool EnteringContext,
5266  CXXScopeSpec &SS,
5267  NamedDecl *ScopeLookupResult,
5268  bool ErrorRecoveryLookup,
5269  bool *IsCorrectedToColon = nullptr,
5270  bool OnlyNamespace = false);
5271 
5272  /// \brief The parser has parsed a nested-name-specifier 'identifier::'.
5273  ///
5274  /// \param S The scope in which this nested-name-specifier occurs.
5275  ///
5276  /// \param IdInfo Parser information about an identifier in the
5277  /// nested-name-spec.
5278  ///
5279  /// \param EnteringContext Whether we're entering the context nominated by
5280  /// this nested-name-specifier.
5281  ///
5282  /// \param SS The nested-name-specifier, which is both an input
5283  /// parameter (the nested-name-specifier before this type) and an
5284  /// output parameter (containing the full nested-name-specifier,
5285  /// including this new type).
5286  ///
5287  /// \param ErrorRecoveryLookup If true, then this method is called to improve
5288  /// error recovery. In this case do not emit error message.
5289  ///
5290  /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
5291  /// are allowed. The bool value pointed by this parameter is set to 'true'
5292  /// if the identifier is treated as if it was followed by ':', not '::'.
5293  ///
5294  /// \param OnlyNamespace If true, only considers namespaces in lookup.
5295  ///
5296  /// \returns true if an error occurred, false otherwise.
5298  NestedNameSpecInfo &IdInfo,
5299  bool EnteringContext,
5300  CXXScopeSpec &SS,
5301  bool ErrorRecoveryLookup = false,
5302  bool *IsCorrectedToColon = nullptr,
5303  bool OnlyNamespace = false);
5304 
5306 
5308  const DeclSpec &DS,
5309  SourceLocation ColonColonLoc);
5310 
5312  NestedNameSpecInfo &IdInfo,
5313  bool EnteringContext);
5314 
5315  /// \brief The parser has parsed a nested-name-specifier
5316  /// 'template[opt] template-name < template-args >::'.
5317  ///
5318  /// \param S The scope in which this nested-name-specifier occurs.
5319  ///
5320  /// \param SS The nested-name-specifier, which is both an input
5321  /// parameter (the nested-name-specifier before this type) and an
5322  /// output parameter (containing the full nested-name-specifier,
5323  /// including this new type).
5324  ///
5325  /// \param TemplateKWLoc the location of the 'template' keyword, if any.
5326  /// \param TemplateName the template name.
5327  /// \param TemplateNameLoc The location of the template name.
5328  /// \param LAngleLoc The location of the opening angle bracket ('<').
5329  /// \param TemplateArgs The template arguments.
5330  /// \param RAngleLoc The location of the closing angle bracket ('>').
5331  /// \param CCLoc The location of the '::'.
5332  ///
5333  /// \param EnteringContext Whether we're entering the context of the
5334  /// nested-name-specifier.
5335  ///
5336  ///
5337  /// \returns true if an error occurred, false otherwise.
5339  CXXScopeSpec &SS,
5340  SourceLocation TemplateKWLoc,
5342  SourceLocation TemplateNameLoc,
5343  SourceLocation LAngleLoc,
5344  ASTTemplateArgsPtr TemplateArgs,
5345  SourceLocation RAngleLoc,
5346  SourceLocation CCLoc,
5347  bool EnteringContext);
5348 
5349  /// \brief Given a C++ nested-name-specifier, produce an annotation value
5350  /// that the parser can use later to reconstruct the given
5351  /// nested-name-specifier.
5352  ///
5353  /// \param SS A nested-name-specifier.
5354  ///
5355  /// \returns A pointer containing all of the information in the
5356  /// nested-name-specifier \p SS.
5358 
5359  /// \brief Given an annotation pointer for a nested-name-specifier, restore
5360  /// the nested-name-specifier structure.
5361  ///
5362  /// \param Annotation The annotation pointer, produced by
5363  /// \c SaveNestedNameSpecifierAnnotation().
5364  ///
5365  /// \param AnnotationRange The source range corresponding to the annotation.
5366  ///
5367  /// \param SS The nested-name-specifier that will be updated with the contents
5368  /// of the annotation pointer.
5369  void RestoreNestedNameSpecifierAnnotation(void *Annotation,
5370  SourceRange AnnotationRange,
5371  CXXScopeSpec &SS);
5372 
5373  bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
5374 
5375  /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
5376  /// scope or nested-name-specifier) is parsed, part of a declarator-id.
5377  /// After this method is called, according to [C++ 3.4.3p3], names should be
5378  /// looked up in the declarator-id's scope, until the declarator is parsed and
5379  /// ActOnCXXExitDeclaratorScope is called.
5380  /// The 'SS' should be a non-empty valid CXXScopeSpec.
5382 
5383  /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
5384  /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
5385  /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
5386  /// Used to indicate that names should revert to being looked up in the
5387  /// defining scope.
5388  void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
5389 
5390  /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
5391  /// initializer for the declaration 'Dcl'.
5392  /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
5393  /// static data member of class X, names should be looked up in the scope of
5394  /// class X.
5396 
5397  /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
5398  /// initializer for the declaration 'Dcl'.
5399  void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
5400 
5401  /// \brief Create a new lambda closure type.
5403  TypeSourceInfo *Info,
5404  bool KnownDependent,
5405  LambdaCaptureDefault CaptureDefault);
5406 
5407  /// \brief Start the definition of a lambda expression.
5409  SourceRange IntroducerRange,
5410  TypeSourceInfo *MethodType,
5411  SourceLocation EndLoc,
5412  ArrayRef<ParmVarDecl *> Params,
5413  bool IsConstexprSpecified);
5414 
5415  /// \brief Endow the lambda scope info with the relevant properties.
5417  CXXMethodDecl *CallOperator,
5418  SourceRange IntroducerRange,
5419  LambdaCaptureDefault CaptureDefault,
5420  SourceLocation CaptureDefaultLoc,
5421  bool ExplicitParams,
5422  bool ExplicitResultType,
5423  bool Mutable);
5424 
5425  /// \brief Perform initialization analysis of the init-capture and perform
5426  /// any implicit conversions such as an lvalue-to-rvalue conversion if
5427  /// not being used to initialize a reference.
5429  SourceLocation Loc, bool ByRef, IdentifierInfo *Id,
5430  LambdaCaptureInitKind InitKind, Expr *&Init) {
5432  Loc, ByRef, Id, InitKind != LambdaCaptureInitKind::CopyInit, Init));
5433  }
5435  IdentifierInfo *Id,
5436  bool DirectInit, Expr *&Init);
5437 
5438  /// \brief Create a dummy variable within the declcontext of the lambda's
5439  /// call operator, for name lookup purposes for a lambda init capture.
5440  ///
5441  /// CodeGen handles emission of lambda captures, ignoring these dummy
5442  /// variables appropriately.
5444  QualType InitCaptureType,
5445  IdentifierInfo *Id,
5446  unsigned InitStyle, Expr *Init);
5447 
5448  /// \brief Build the implicit field for an init-capture.
5450 
5451  /// \brief Note that we have finished the explicit captures for the
5452  /// given lambda.
5454 
5455  /// \brief Introduce the lambda parameters into scope.
5456  void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope);
5457 
5458  /// \brief Deduce a block or lambda's return type based on the return
5459  /// statements present in the body.
5461 
5462  /// ActOnStartOfLambdaDefinition - This is called just before we start
5463  /// parsing the body of a lambda; it analyzes the explicit captures and
5464  /// arguments, and sets up various data-structures for the body of the
5465  /// lambda.
5467  Declarator &ParamInfo, Scope *CurScope);
5468 
5469  /// ActOnLambdaError - If there is an error parsing a lambda, this callback
5470  /// is invoked to pop the information about the lambda.
5471  void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
5472  bool IsInstantiation = false);
5473 
5474  /// ActOnLambdaExpr - This is called when the body of a lambda expression
5475  /// was successfully completed.
5477  Scope *CurScope);
5478 
5479  /// \brief Does copying/destroying the captured variable have side effects?
5481 
5482  /// \brief Diagnose if an explicit lambda capture is unused.
5484 
5485  /// \brief Complete a lambda-expression having processed and attached the
5486  /// lambda body.
5488  sema::LambdaScopeInfo *LSI);
5489 
5490  /// \brief Define the "body" of the conversion from a lambda object to a
5491  /// function pointer.
5492  ///
5493  /// This routine doesn't actually define a sensible body; rather, it fills
5494  /// in the initialization expression needed to copy the lambda object into
5495  /// the block, and IR generation actually generates the real body of the
5496  /// block pointer conversion.
5498  SourceLocation CurrentLoc, CXXConversionDecl *Conv);
5499 
5500  /// \brief Define the "body" of the conversion from a lambda object to a
5501  /// block pointer.
5502  ///
5503  /// This routine doesn't actually define a sensible body; rather, it fills
5504  /// in the initialization expression needed to copy the lambda object into
5505  /// the block, and IR generation actually generates the real body of the
5506  /// block pointer conversion.
5508  CXXConversionDecl *Conv);
5509 
5511  SourceLocation ConvLocation,
5512  CXXConversionDecl *Conv,
5513  Expr *Src);
5514 
5515  // ParseObjCStringLiteral - Parse Objective-C string literals.
5517  ArrayRef<Expr *> Strings);
5518 
5520 
5521  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
5522  /// numeric literal expression. Type of the expression will be "NSNumber *"
5523  /// or "id" if NSNumber is unavailable.
5526  bool Value);
5528 
5529  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
5530  /// '@' prefixed parenthesized expression. The type of the expression will
5531  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
5532  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
5533  /// "const char *" or C structure with attribute 'objc_boxable'.
5535 
5537  Expr *IndexExpr,
5538  ObjCMethodDecl *getterMethod,
5539  ObjCMethodDecl *setterMethod);
5540 
5543 
5545  TypeSourceInfo *EncodedTypeInfo,
5546  SourceLocation RParenLoc);
5548  CXXConversionDecl *Method,
5549  bool HadMultipleCandidates);
5550 
5552  SourceLocation EncodeLoc,
5553  SourceLocation LParenLoc,
5554  ParsedType Ty,
5555  SourceLocation RParenLoc);
5556 
5557  /// ParseObjCSelectorExpression - Build selector expression for \@selector
5559  SourceLocation AtLoc,
5560  SourceLocation SelLoc,
5561  SourceLocation LParenLoc,
5562  SourceLocation RParenLoc,
5563  bool WarnMultipleSelectors);
5564 
5565  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
5567  SourceLocation AtLoc,
5568  SourceLocation ProtoLoc,
5569  SourceLocation LParenLoc,
5570  SourceLocation ProtoIdLoc,
5571  SourceLocation RParenLoc);
5572 
5573  //===--------------------------------------------------------------------===//
5574  // C++ Declarations
5575  //
5577  SourceLocation ExternLoc,
5578  Expr *LangStr,
5579  SourceLocation LBraceLoc);
5581  Decl *LinkageSpec,
5582  SourceLocation RBraceLoc);
5583 
5584 
5585  //===--------------------------------------------------------------------===//
5586  // C++ Classes
5587  //
5588  bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
5589  const CXXScopeSpec *SS = nullptr);
5590  bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS);
5591 
5593  SourceLocation ASLoc,
5595  AttributeList *Attrs = nullptr);
5596 
5598  Declarator &D,
5599  MultiTemplateParamsArg TemplateParameterLists,
5600  Expr *BitfieldWidth, const VirtSpecifiers &VS,
5601  InClassInitStyle InitStyle);
5602 
5605  SourceLocation EqualLoc,
5606  Expr *Init);
5607 
5608  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5609  Scope *S,
5610  CXXScopeSpec &SS,
5611  IdentifierInfo *MemberOrBase,
5612  ParsedType TemplateTypeTy,
5613  const DeclSpec &DS,
5614  SourceLocation IdLoc,
5615  SourceLocation LParenLoc,
5616  ArrayRef<Expr *> Args,
5617  SourceLocation RParenLoc,
5618  SourceLocation EllipsisLoc);
5619 
5620  MemInitResult ActOnMemInitializer(Decl *ConstructorD,
5621  Scope *S,
5622  CXXScopeSpec &SS,
5623  IdentifierInfo *MemberOrBase,
5624  ParsedType TemplateTypeTy,
5625  const DeclSpec &DS,
5626  SourceLocation IdLoc,
5627  Expr *InitList,
5628  SourceLocation EllipsisLoc);
5629 
5630  MemInitResult BuildMemInitializer(Decl *ConstructorD,
5631  Scope *S,
5632  CXXScopeSpec &SS,
5633  IdentifierInfo *MemberOrBase,
5634  ParsedType TemplateTypeTy,
5635  const DeclSpec &DS,
5636  SourceLocation IdLoc,
5637  Expr *Init,
5638  SourceLocation EllipsisLoc);
5639 
5641  Expr *Init,
5642  SourceLocation IdLoc);
5643 
5645  TypeSourceInfo *BaseTInfo,
5646  Expr *Init,
5647  CXXRecordDecl *ClassDecl,
5648  SourceLocation EllipsisLoc);
5649 
5651  Expr *Init,
5652  CXXRecordDecl *ClassDecl);
5653 
5654  bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
5655  CXXCtorInitializer *Initializer);
5656 
5657  bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
5658  ArrayRef<CXXCtorInitializer *> Initializers = None);
5659 
5660  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
5661 
5662 
5663  /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
5664  /// mark all the non-trivial destructors of its members and bases as
5665  /// referenced.
5667  CXXRecordDecl *Record);
5668 
5669  /// \brief The list of classes whose vtables have been used within
5670  /// this translation unit, and the source locations at which the
5671  /// first use occurred.
5672  typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
5673 
5674  /// \brief The list of vtables that are required but have not yet been
5675  /// materialized.
5677 
5678  /// \brief The set of classes whose vtables have been used within
5679  /// this translation unit, and a bit that will be true if the vtable is
5680  /// required to be emitted (otherwise, it should be emitted only if needed
5681  /// by code generation).
5682  llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
5683 
5684  /// \brief Load any externally-stored vtable uses.
5685  void LoadExternalVTableUses();
5686 
5687  /// \brief Note that the vtable for the given class was used at the
5688  /// given location.
5689  void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
5690  bool DefinitionRequired = false);
5691 
5692  /// \brief Mark the exception specifications of all virtual member functions
5693  /// in the given class as needed.
5695  const CXXRecordDecl *RD);
5696 
5697  /// MarkVirtualMembersReferenced - Will mark all members of the given
5698  /// CXXRecordDecl referenced.
5700  const CXXRecordDecl *RD);
5701 
5702  /// \brief Define all of the vtables that have been used in this
5703  /// translation unit and reference any virtual members used by those
5704  /// vtables.
5705  ///
5706  /// \returns true if any work was done, false otherwise.
5707  bool DefineUsedVTables();
5708 
5710 
5711  void ActOnMemInitializers(Decl *ConstructorDecl,
5714  bool AnyErrors);
5715 
5716  /// \brief Check class-level dllimport/dllexport attribute. The caller must
5717  /// ensure that referenceDLLExportedClassMethods is called some point later
5718  /// when all outer classes of Class are complete.
5720 
5722 
5724  CXXRecordDecl *Class, Attr *ClassAttr,
5725  ClassTemplateSpecializationDecl *BaseTemplateSpec,
5726  SourceLocation BaseLoc);
5727 
5728  void CheckCompletedCXXClass(CXXRecordDecl *Record);
5730  Decl *TagDecl,
5731  SourceLocation LBrac,
5732  SourceLocation RBrac,
5733  AttributeList *AttrList);
5736 
5738  unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template);
5741  void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
5746  CachedTokens &Toks);
5749 
5751  Expr *AssertExpr,
5752  Expr *AssertMessageExpr,
5753  SourceLocation RParenLoc);
5755  Expr *AssertExpr,
5756  StringLiteral *AssertMessageExpr,
5757  SourceLocation RParenLoc,
5758  bool Failed);
5759 
5761  SourceLocation FriendLoc,
5762  TypeSourceInfo *TSInfo);
5763  Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
5764  MultiTemplateParamsArg TemplateParams);
5766  MultiTemplateParamsArg TemplateParams);
5767 
5769  StorageClass& SC);
5770  void CheckConstructor(CXXConstructorDecl *Constructor);
5772  StorageClass& SC);
5773  bool CheckDestructor(CXXDestructorDecl *Destructor);
5775  StorageClass& SC);
5778  StorageClass &SC);
5780 
5783  const FunctionProtoType *T);
5785 
5786  //===--------------------------------------------------------------------===//
5787  // C++ Derived Classes
5788  //
5789 
5790  /// ActOnBaseSpecifier - Parsed a base specifier
5792  SourceRange SpecifierRange,
5793  bool Virtual, AccessSpecifier Access,
5794  TypeSourceInfo *TInfo,
5795  SourceLocation EllipsisLoc);
5796 
5797  BaseResult ActOnBaseSpecifier(Decl *classdecl,
5798  SourceRange SpecifierRange,
5799  ParsedAttributes &Attrs,
5800  bool Virtual, AccessSpecifier Access,
5801  ParsedType basetype,
5802  SourceLocation BaseLoc,
5803  SourceLocation EllipsisLoc);
5804 
5805  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
5807  void ActOnBaseSpecifiers(Decl *ClassDecl,
5809 
5810  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base);
5811  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
5812  CXXBasePaths &Paths);
5813 
5814  // FIXME: I don't like this name.
5815  void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
5816 
5818  SourceLocation Loc, SourceRange Range,
5819  CXXCastPath *BasePath = nullptr,
5820  bool IgnoreAccess = false);
5822  unsigned InaccessibleBaseID,
5823  unsigned AmbigiousBaseConvID,
5824  SourceLocation Loc, SourceRange Range,
5826  CXXCastPath *BasePath,
5827  bool IgnoreAccess = false);
5828 
5829  std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
5830 
5832  const CXXMethodDecl *Old);
5833 
5834  /// CheckOverridingFunctionReturnType - Checks whether the return types are
5835  /// covariant, according to C++ [class.virtual]p5.
5837  const CXXMethodDecl *Old);
5838 
5839  /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
5840  /// spec is a subset of base spec.
5842  const CXXMethodDecl *Old);
5843 
5844  bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
5845 
5846  /// CheckOverrideControl - Check C++11 override control semantics.
5848 
5849  /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
5850  /// not used in the declaration of an overriding method.
5852 
5853  /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
5854  /// overrides a virtual member function marked 'final', according to
5855  /// C++11 [class.virtual]p4.
5857  const CXXMethodDecl *Old);
5858 
5859 
5860  //===--------------------------------------------------------------------===//
5861  // C++ Access Control
5862  //
5863 
5869  };
5870 
5871  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
5872  NamedDecl *PrevMemberDecl,
5873  AccessSpecifier LexicalAS);
5874 
5880  SourceRange PlacementRange,
5881  CXXRecordDecl *NamingClass,
5883  bool Diagnose = true);
5885  CXXConstructorDecl *D,
5887  const InitializedEntity &Entity,
5888  bool IsCopyBindingRefToTemp = false);
5890  CXXConstructorDecl *D,
5892  const InitializedEntity &Entity,
5893  const PartialDiagnostic &PDiag);
5895  CXXDestructorDecl *Dtor,
5896  const PartialDiagnostic &PDiag,
5897  QualType objectType = QualType());
5900  CXXRecordDecl *NamingClass,
5901  DeclAccessPair Found);
5903  Expr *ObjectExpr,
5904  Expr *ArgExpr,
5909  QualType Base, QualType Derived,
5910  const CXXBasePath &Path,
5911  unsigned DiagID,
5912  bool ForceCheck = false,
5913  bool ForceUnprivileged = false);
5914  void CheckLookupAccess(const LookupResult &R);
5917  AccessSpecifier access,
5918  QualType objectType);
5919 
5921  const MultiLevelTemplateArgumentList &TemplateArgs);
5922  void PerformDependentDiagnostics(const DeclContext *Pattern,
5923  const MultiLevelTemplateArgumentList &TemplateArgs);
5924 
5926 
5927  /// \brief When true, access checking violations are treated as SFINAE
5928  /// failures rather than hard errors.
5930 
5940  };
5941 
5942  bool isAbstractType(SourceLocation Loc, QualType T);
5944  TypeDiagnoser &Diagnoser);
5945  template <typename... Ts>
5946  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
5947  const Ts &...Args) {
5948  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
5949  return RequireNonAbstractType(Loc, T, Diagnoser);
5950  }
5951 
5952  void DiagnoseAbstractType(const CXXRecordDecl *RD);
5953 
5954  //===--------------------------------------------------------------------===//
5955  // C++ Overloaded Operators [C++ 13.5]
5956  //
5957 
5959 
5961 
5962  //===--------------------------------------------------------------------===//
5963  // C++ Templates [C++ 14]
5964  //
5966  bool AllowFunctionTemplates = true);
5968  bool AllowFunctionTemplates = true);
5969 
5971  QualType ObjectType, bool EnteringContext,
5972  bool &MemberOfUnknownSpecialization);
5973 
5975  CXXScopeSpec &SS,
5976  bool hasTemplateKeyword,
5978  ParsedType ObjectType,
5979  bool EnteringContext,
5980  TemplateTy &Template,
5981  bool &MemberOfUnknownSpecialization);
5982 
5983  /// Determine whether a particular identifier might be the name in a C++1z
5984  /// deduction-guide declaration.
5986  SourceLocation NameLoc,
5987  ParsedTemplateTy *Template = nullptr);
5988 
5990  SourceLocation IILoc,
5991  Scope *S,
5992  const CXXScopeSpec *SS,
5993  TemplateTy &SuggestedTemplate,
5994  TemplateNameKind &SuggestedKind);
5995 
5996  bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
5997  NamedDecl *Instantiation,
5998  bool InstantiatedFromMember,
5999  const NamedDecl *Pattern,
6000  const NamedDecl *PatternDef,
6002  bool Complain = true);
6003 
6006 
6007  Decl *ActOnTypeParameter(Scope *S, bool Typename,
6008  SourceLocation EllipsisLoc,
6009  SourceLocation KeyLoc,
6010  IdentifierInfo *ParamName,
6011  SourceLocation ParamNameLoc,
6012  unsigned Depth, unsigned Position,
6013  SourceLocation EqualLoc,
6014  ParsedType DefaultArg);
6015 
6017  SourceLocation Loc);
6019 
6021  unsigned Depth,
6022  unsigned Position,
6023  SourceLocation EqualLoc,
6024  Expr *DefaultArg);
6026  SourceLocation TmpLoc,
6027  TemplateParameterList *Params,
6028  SourceLocation EllipsisLoc,
6029  IdentifierInfo *ParamName,
6030  SourceLocation ParamNameLoc,
6031  unsigned Depth,
6032  unsigned Position,
6033  SourceLocation EqualLoc,
6034  ParsedTemplateArgument DefaultArg);
6035 
6038  SourceLocation ExportLoc,
6039  SourceLocation TemplateLoc,
6040  SourceLocation LAngleLoc,
6041  ArrayRef<Decl *> Params,
6042  SourceLocation RAngleLoc,
6043  Expr *RequiresClause);
6044 
6045  /// \brief The context in which we are checking a template parameter list.
6055  };
6056 
6058  TemplateParameterList *OldParams,
6061  SourceLocation DeclStartLoc, SourceLocation DeclLoc,
6062  const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
6064  bool IsFriend, bool &IsMemberSpecialization, bool &Invalid);
6065 
6066  DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
6067  SourceLocation KWLoc, CXXScopeSpec &SS,
6070  TemplateParameterList *TemplateParams,
6071  AccessSpecifier AS,
6072  SourceLocation ModulePrivateLoc,
6073  SourceLocation FriendLoc,
6074  unsigned NumOuterTemplateParamLists,
6075  TemplateParameterList **OuterTemplateParamLists,
6076  SkipBodyInfo *SkipBody = nullptr);
6077 
6079  QualType NTTPType,
6080  SourceLocation Loc);
6081 
6084 
6086 
6088  SourceLocation TemplateLoc,
6089  TemplateArgumentListInfo &TemplateArgs);
6090 
6091  TypeResult
6092  ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
6093  TemplateTy Template, IdentifierInfo *TemplateII,
6094  SourceLocation TemplateIILoc,
6095  SourceLocation LAngleLoc,
6096  ASTTemplateArgsPtr TemplateArgs,
6097  SourceLocation RAngleLoc,
6098  bool IsCtorOrDtorName = false,
6099  bool IsClassName = false);
6100 
6101  /// \brief Parsed an elaborated-type-specifier that refers to a template-id,
6102  /// such as \c class T::template apply<U>.
6104  TypeSpecifierType TagSpec,
6105  SourceLocation TagLoc,
6106  CXXScopeSpec &SS,
6107  SourceLocation TemplateKWLoc,
6108  TemplateTy TemplateD,
6109  SourceLocation TemplateLoc,
6110  SourceLocation LAngleLoc,
6111  ASTTemplateArgsPtr TemplateArgsIn,
6112  SourceLocation RAngleLoc);
6113 
6115  Scope *S, Declarator &D, TypeSourceInfo *DI,
6116  SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
6118 
6120  SourceLocation TemplateLoc,
6121  SourceLocation TemplateNameLoc,
6122  const TemplateArgumentListInfo &TemplateArgs);
6123 
6125  const DeclarationNameInfo &NameInfo,
6126  VarTemplateDecl *Template,
6127  SourceLocation TemplateLoc,
6128  const TemplateArgumentListInfo *TemplateArgs);
6129 
6131  SourceLocation TemplateKWLoc,
6132  LookupResult &R,
6133  bool RequiresADL,
6134  const TemplateArgumentListInfo *TemplateArgs);
6135 
6137  SourceLocation TemplateKWLoc,
6138  const DeclarationNameInfo &NameInfo,
6139  const TemplateArgumentListInfo *TemplateArgs);
6140 
6142  Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
6143  UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext,
6144  TemplateTy &Template, bool AllowInjectedClassName = false);
6145 
6146  DeclResult
6147  ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK,
6148  SourceLocation KWLoc,
6149  SourceLocation ModulePrivateLoc,
6150  TemplateIdAnnotation &TemplateId,
6152  MultiTemplateParamsArg TemplateParameterLists,
6153  SkipBodyInfo *SkipBody = nullptr);
6154 
6156  TemplateDecl *PrimaryTemplate,
6157  unsigned NumExplicitArgs,
6163 
6165  MultiTemplateParamsArg TemplateParameterLists,
6166  Declarator &D);
6167 
6168  bool
6171  NamedDecl *PrevDecl,
6173  SourceLocation PrevPtOfInstantiation,
6174  bool &SuppressNew);
6175 
6177  const TemplateArgumentListInfo &ExplicitTemplateArgs,
6179 
6181  TemplateArgumentListInfo *ExplicitTemplateArgs,
6185 
6186  DeclResult
6188  SourceLocation ExternLoc,
6189  SourceLocation TemplateLoc,
6190  unsigned TagSpec,
6191  SourceLocation KWLoc,
6192  const CXXScopeSpec &SS,
6193  TemplateTy Template,
6194  SourceLocation TemplateNameLoc,
6195  SourceLocation LAngleLoc,
6196  ASTTemplateArgsPtr TemplateArgs,
6197  SourceLocation RAngleLoc,
6198  AttributeList *Attr);
6199 
6200  DeclResult
6202  SourceLocation ExternLoc,
6203  SourceLocation TemplateLoc,
6204  unsigned TagSpec,
6205  SourceLocation KWLoc,
6206  CXXScopeSpec &SS,
6208  SourceLocation NameLoc,
6209  AttributeList *Attr);
6210 
6212  SourceLocation ExternLoc,
6213  SourceLocation TemplateLoc,
6214  Declarator &D);
6215 
6218  SourceLocation TemplateLoc,
6219  SourceLocation RAngleLoc,
6220  Decl *Param,
6222  &Converted,
6223  bool &HasDefaultArg);
6224 
6225  /// \brief Specifies the context in which a particular template
6226  /// argument is being checked.
6228  /// \brief The template argument was specified in the code or was
6229  /// instantiated with some deduced template arguments.
6231 
6232  /// \brief The template argument was deduced via template argument
6233  /// deduction.
6235 
6236  /// \brief The template argument was deduced from an array bound
6237  /// via template argument deduction.
6239  };
6240 
6241  bool CheckTemplateArgument(NamedDecl *Param,
6242  TemplateArgumentLoc &Arg,
6243  NamedDecl *Template,
6244  SourceLocation TemplateLoc,
6245  SourceLocation RAngleLoc,
6246  unsigned ArgumentPackIndex,
6249 
6250  /// \brief Check that the given template arguments can be be provided to
6251  /// the given template, converting the arguments along the way.
6252  ///
6253  /// \param Template The template to which the template arguments are being
6254  /// provided.
6255  ///
6256  /// \param TemplateLoc The location of the template name in the source.
6257  ///
6258  /// \param TemplateArgs The list of template arguments. If the template is
6259  /// a template template parameter, this function may extend the set of
6260  /// template arguments to also include substituted, defaulted template
6261  /// arguments.
6262  ///
6263  /// \param PartialTemplateArgs True if the list of template arguments is
6264  /// intentionally partial, e.g., because we're checking just the initial
6265  /// set of template arguments.
6266  ///
6267  /// \param Converted Will receive the converted, canonicalized template
6268  /// arguments.
6269  ///
6270  /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
6271  /// contain the converted forms of the template arguments as written.
6272  /// Otherwise, \p TemplateArgs will not be modified.
6273  ///
6274  /// \returns true if an error occurred, false otherwise.
6275  bool CheckTemplateArgumentList(TemplateDecl *Template,
6276  SourceLocation TemplateLoc,
6277  TemplateArgumentListInfo &TemplateArgs,
6278  bool PartialTemplateArgs,
6280  bool UpdateArgsWithConversions = true);
6281 
6283  TemplateArgumentLoc &Arg,
6285 
6287  TypeSourceInfo *Arg);
6289  QualType InstantiatedParamType, Expr *Arg,
6290  TemplateArgument &Converted,
6293  TemplateArgumentLoc &Arg,
6294  unsigned ArgumentPackIndex);
6295 
6296  ExprResult
6298  QualType ParamType,
6299  SourceLocation Loc);
6300  ExprResult
6302  SourceLocation Loc);
6303 
6304  /// \brief Enumeration describing how template parameter lists are compared
6305  /// for equality.
6307  /// \brief We are matching the template parameter lists of two templates
6308  /// that might be redeclarations.
6309  ///
6310  /// \code
6311  /// template<typename T> struct X;
6312  /// template<typename T> struct X;
6313  /// \endcode
6315 
6316  /// \brief We are matching the template parameter lists of two template
6317  /// template parameters as part of matching the template parameter lists
6318  /// of two templates that might be redeclarations.
6319  ///
6320  /// \code
6321  /// template<template<int I> class TT> struct X;
6322  /// template<template<int Value> class Other> struct X;
6323  /// \endcode
6325 
6326  /// \brief We are matching the template parameter lists of a template
6327  /// template argument against the template parameter lists of a template
6328  /// template parameter.
6329  ///
6330  /// \code
6331  /// template<template<int Value> class Metafun> struct X;
6332  /// template<int Value> struct integer_c;
6333  /// X<integer_c> xic;
6334  /// \endcode
6336  };
6337 
6339  TemplateParameterList *Old,
6340  bool Complain,
6342  SourceLocation TemplateArgLoc
6343  = SourceLocation());
6344 
6345  bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
6346 
6347  /// \brief Called when the parser has parsed a C++ typename
6348  /// specifier, e.g., "typename T::type".
6349  ///
6350  /// \param S The scope in which this typename type occurs.
6351  /// \param TypenameLoc the location of the 'typename' keyword
6352  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6353  /// \param II the identifier we're retrieving (e.g., 'type' in the example).
6354  /// \param IdLoc the location of the identifier.
6355  TypeResult
6356  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
6357  const CXXScopeSpec &SS, const IdentifierInfo &II,
6358  SourceLocation IdLoc);
6359 
6360  /// \brief Called when the parser has parsed a C++ typename
6361  /// specifier that ends in a template-id, e.g.,
6362  /// "typename MetaFun::template apply<T1, T2>".
6363  ///
6364  /// \param S The scope in which this typename type occurs.
6365  /// \param TypenameLoc the location of the 'typename' keyword
6366  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
6367  /// \param TemplateLoc the location of the 'template' keyword, if any.
6368  /// \param TemplateName The template name.
6369  /// \param TemplateII The identifier used to name the template.
6370  /// \param TemplateIILoc The location of the template name.
6371  /// \param LAngleLoc The location of the opening angle bracket ('<').
6372  /// \param TemplateArgs The template arguments.
6373  /// \param RAngleLoc The location of the closing angle bracket ('>').
6374  TypeResult
6375  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
6376  const CXXScopeSpec &SS,
6377  SourceLocation TemplateLoc,
6379  IdentifierInfo *TemplateII,
6380  SourceLocation TemplateIILoc,
6381  SourceLocation LAngleLoc,
6382  ASTTemplateArgsPtr TemplateArgs,
6383  SourceLocation RAngleLoc);
6384 
6386  SourceLocation KeywordLoc,
6387  NestedNameSpecifierLoc QualifierLoc,
6388  const IdentifierInfo &II,
6389  SourceLocation IILoc);
6390 
6392  SourceLocation Loc,
6395 
6398  TemplateParameterList *Params);
6399 
6400  std::string
6402  const TemplateArgumentList &Args);
6403 
6404  std::string
6406  const TemplateArgument *Args,
6407  unsigned NumArgs);
6408 
6409  //===--------------------------------------------------------------------===//
6410  // C++ Variadic Templates (C++0x [temp.variadic])
6411  //===--------------------------------------------------------------------===//
6412 
6413  /// Determine whether an unexpanded parameter pack might be permitted in this
6414  /// location. Useful for error recovery.
6416 
6417  /// \brief The context in which an unexpanded parameter pack is
6418  /// being diagnosed.
6419  ///
6420  /// Note that the values of this enumeration line up with the first
6421  /// argument to the \c err_unexpanded_parameter_pack diagnostic.
6423  /// \brief An arbitrary expression.
6425 
6426  /// \brief The base type of a class type.
6428 
6429  /// \brief The type of an arbitrary declaration.
6431 
6432  /// \brief The type of a data member.
6434 
6435  /// \brief The size of a bit-field.
6437 
6438  /// \brief The expression in a static assertion.
6440 
6441  /// \brief The fixed underlying type of an enumeration.
6443 
6444  /// \brief The enumerator value.
6446 
6447  /// \brief A using declaration.
6449 
6450  /// \brief A friend declaration.
6452 
6453  /// \brief A declaration qualifier.
6455 
6456  /// \brief An initializer.
6458 
6459  /// \brief A default argument.
6461 
6462  /// \brief The type of a non-type template parameter.
6464 
6465  /// \brief The type of an exception.
6467 
6468  /// \brief Partial specialization.
6470 
6471  /// \brief Microsoft __if_exists.
6473 
6474  /// \brief Microsoft __if_not_exists.
6476 
6477  /// \brief Lambda expression.
6479 
6480  /// \brief Block expression,
6482  };
6483 
6484  /// \brief Diagnose unexpanded parameter packs.
6485  ///
6486  /// \param Loc The location at which we should emit the diagnostic.
6487  ///
6488  /// \param UPPC The context in which we are diagnosing unexpanded
6489  /// parameter packs.
6490  ///
6491  /// \param Unexpanded the set of unexpanded parameter packs.
6492  ///
6493  /// \returns true if an error occurred, false otherwise.
6497 
6498  /// \brief If the given type contains an unexpanded parameter pack,
6499  /// diagnose the error.
6500  ///
6501  /// \param Loc The source location where a diagnostc should be emitted.
6502  ///
6503  /// \param T The type that is being checked for unexpanded parameter
6504  /// packs.
6505  ///
6506  /// \returns true if an error occurred, false otherwise.
6509 
6510  /// \brief If the given expression contains an unexpanded parameter
6511  /// pack, diagnose the error.
6512  ///
6513  /// \param E The expression that is being checked for unexpanded
6514  /// parameter packs.
6515  ///
6516  /// \returns true if an error occurred, false otherwise.
6519 
6520  /// \brief If the given nested-name-specifier contains an unexpanded
6521  /// parameter pack, diagnose the error.
6522  ///
6523  /// \param SS The nested-name-specifier that is being checked for
6524  /// unexpanded parameter packs.
6525  ///
6526  /// \returns true if an error occurred, false otherwise.
6529 
6530  /// \brief If the given name contains an unexpanded parameter pack,
6531  /// diagnose the error.
6532  ///
6533  /// \param NameInfo The name (with source location information) that
6534  /// is being checked for unexpanded parameter packs.
6535  ///
6536  /// \returns true if an error occurred, false otherwise.
6539 
6540  /// \brief If the given template name contains an unexpanded parameter pack,
6541  /// diagnose the error.
6542  ///
6543  /// \param Loc The location of the template name.
6544  ///
6545  /// \param Template The template name that is being checked for unexpanded
6546  /// parameter packs.
6547  ///
6548  /// \returns true if an error occurred, false otherwise.
6550  TemplateName Template,
6552 
6553  /// \brief If the given template argument contains an unexpanded parameter
6554  /// pack, diagnose the error.
6555  ///
6556  /// \param Arg The template argument that is being checked for unexpanded
6557  /// parameter packs.
6558  ///
6559  /// \returns true if an error occurred, false otherwise.
6562 
6563  /// \brief Collect the set of unexpanded parameter packs within the given
6564  /// template argument.
6565  ///
6566  /// \param Arg The template argument that will be traversed to find
6567  /// unexpanded parameter packs.
6570 
6571  /// \brief Collect the set of unexpanded parameter packs within the given
6572  /// template argument.
6573  ///
6574  /// \param Arg The template argument that will be traversed to find
6575  /// unexpanded parameter packs.
6578 
6579  /// \brief Collect the set of unexpanded parameter packs within the given
6580  /// type.
6581  ///
6582  /// \param T The type that will be traversed to find
6583  /// unexpanded parameter packs.
6586 
6587  /// \brief Collect the set of unexpanded parameter packs within the given
6588  /// type.
6589  ///
6590  /// \param TL The type that will be traversed to find
6591  /// unexpanded parameter packs.
6594 
6595  /// \brief Collect the set of unexpanded parameter packs within the given
6596  /// nested-name-specifier.
6597  ///
6598  /// \param NNS The nested-name-specifier that will be traversed to find
6599  /// unexpanded parameter packs.
6602 
6603  /// \brief Collect the set of unexpanded parameter packs within the given
6604  /// name.
6605  ///
6606  /// \param NameInfo The name that will be traversed to find
6607  /// unexpanded parameter packs.
6610 
6611  /// \brief Invoked when parsing a template argument followed by an
6612  /// ellipsis, which creates a pack expansion.
6613  ///
6614  /// \param Arg The template argument preceding the ellipsis, which
6615  /// may already be invalid.
6616  ///
6617  /// \param EllipsisLoc The location of the ellipsis.
6619  SourceLocation EllipsisLoc);
6620 
6621  /// \brief Invoked when parsing a type followed by an ellipsis, which
6622  /// creates a pack expansion.
6623  ///
6624  /// \param Type The type preceding the ellipsis, which will become
6625  /// the pattern of the pack expansion.
6626  ///
6627  /// \param EllipsisLoc The location of the ellipsis.
6629 
6630  /// \brief Construct a pack expansion type from the pattern of the pack
6631  /// expansion.
6633  SourceLocation EllipsisLoc,
6634  Optional<unsigned> NumExpansions);
6635 
6636  /// \brief Construct a pack expansion type from the pattern of the pack
6637  /// expansion.
6639  SourceRange PatternRange,
6640  SourceLocation EllipsisLoc,
6641  Optional<unsigned> NumExpansions);
6642 
6643  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6644  /// creates a pack expansion.
6645  ///
6646  /// \param Pattern The expression preceding the ellipsis, which will become
6647  /// the pattern of the pack expansion.
6648  ///
6649  /// \param EllipsisLoc The location of the ellipsis.
6650  ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
6651 
6652  /// \brief Invoked when parsing an expression followed by an ellipsis, which
6653  /// creates a pack expansion.
6654  ///
6655  /// \param Pattern The expression preceding the ellipsis, which will become
6656  /// the pattern of the pack expansion.
6657  ///
6658  /// \param EllipsisLoc The location of the ellipsis.
6659  ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
6660  Optional<unsigned> NumExpansions);
6661 
6662  /// \brief Determine whether we could expand a pack expansion with the
6663  /// given set of parameter packs into separate arguments by repeatedly
6664  /// transforming the pattern.
6665  ///
6666  /// \param EllipsisLoc The location of the ellipsis that identifies the
6667  /// pack expansion.
6668  ///
6669  /// \param PatternRange The source range that covers the entire pattern of
6670  /// the pack expansion.
6671  ///
6672  /// \param Unexpanded The set of unexpanded parameter packs within the
6673  /// pattern.
6674  ///
6675  /// \param ShouldExpand Will be set to \c true if the transformer should
6676  /// expand the corresponding pack expansions into separate arguments. When
6677  /// set, \c NumExpansions must also be set.
6678  ///
6679  /// \param RetainExpansion Whether the caller should add an unexpanded
6680  /// pack expansion after all of the expanded arguments. This is used
6681  /// when extending explicitly-specified template argument packs per
6682  /// C++0x [temp.arg.explicit]p9.
6683  ///
6684  /// \param NumExpansions The number of separate arguments that will be in
6685  /// the expanded form of the corresponding pack expansion. This is both an
6686  /// input and an output parameter, which can be set by the caller if the
6687  /// number of expansions is known a priori (e.g., due to a prior substitution)
6688  /// and will be set by the callee when the number of expansions is known.
6689  /// The callee must set this value when \c ShouldExpand is \c true; it may
6690  /// set this value in other cases.
6691  ///
6692  /// \returns true if an error occurred (e.g., because the parameter packs
6693  /// are to be instantiated with arguments of different lengths), false
6694  /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
6695  /// must be set.
6697  SourceRange PatternRange,
6699  const MultiLevelTemplateArgumentList &TemplateArgs,
6700  bool &ShouldExpand,
6701  bool &RetainExpansion,
6702  Optional<unsigned> &NumExpansions);
6703 
6704  /// \brief Determine the number of arguments in the given pack expansion
6705  /// type.
6706  ///
6707  /// This routine assumes that the number of arguments in the expansion is
6708  /// consistent across all of the unexpanded parameter packs in its pattern.
6709  ///
6710  /// Returns an empty Optional if the type can't be expanded.
6712  const MultiLevelTemplateArgumentList &TemplateArgs);
6713 
6714  /// \brief Determine whether the given declarator contains any unexpanded
6715  /// parameter packs.
6716  ///
6717  /// This routine is used by the parser to disambiguate function declarators
6718  /// with an ellipsis prior to the ')', e.g.,
6719  ///
6720  /// \code
6721  /// void f(T...);
6722  /// \endcode
6723  ///
6724  /// To determine whether we have an (unnamed) function parameter pack or
6725  /// a variadic function.
6726  ///
6727  /// \returns true if the declarator contains any unexpanded parameter packs,
6728  /// false otherwise.
6730 
6731  /// \brief Returns the pattern of the pack expansion for a template argument.
6732  ///
6733  /// \param OrigLoc The template argument to expand.
6734  ///
6735  /// \param Ellipsis Will be set to the location of the ellipsis.
6736  ///
6737  /// \param NumExpansions Will be set to the number of expansions that will
6738  /// be generated from this pack expansion, if known a priori.
6740  TemplateArgumentLoc OrigLoc,
6741  SourceLocation &Ellipsis,
6742  Optional<unsigned> &NumExpansions) const;
6743 
6744  /// Given a template argument that contains an unexpanded parameter pack, but
6745  /// which has already been substituted, attempt to determine the number of
6746  /// elements that will be produced once this argument is fully-expanded.
6747  ///
6748  /// This is intended for use when transforming 'sizeof...(Arg)' in order to
6749  /// avoid actually expanding the pack where possible.
6751 
6752  //===--------------------------------------------------------------------===//
6753  // C++ Template Argument Deduction (C++ [temp.deduct])
6754  //===--------------------------------------------------------------------===//
6755 
6756  /// Adjust the type \p ArgFunctionType to match the calling convention,
6757  /// noreturn, and optionally the exception specification of \p FunctionType.
6758  /// Deduction often wants to ignore these properties when matching function
6759  /// types.
6761  bool AdjustExceptionSpec = false);
6762 
6763  /// \brief Describes the result of template argument deduction.
6764  ///
6765  /// The TemplateDeductionResult enumeration describes the result of
6766  /// template argument deduction, as returned from
6767  /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
6768  /// structure provides additional information about the results of
6769  /// template argument deduction, e.g., the deduced template argument
6770  /// list (if successful) or the specific template parameters or
6771  /// deduced arguments that were involved in the failure.
6773  /// \brief Template argument deduction was successful.
6775  /// \brief The declaration was invalid; do nothing.
6777  /// \brief Template argument deduction exceeded the maximum template
6778  /// instantiation depth (which has already been diagnosed).
6780  /// \brief Template argument deduction did not deduce a value
6781  /// for every template parameter.
6783  /// \brief Template argument deduction produced inconsistent
6784  /// deduced values for the given template parameter.
6786  /// \brief Template argument deduction failed due to inconsistent
6787  /// cv-qualifiers on a template parameter type that would
6788  /// otherwise be deduced, e.g., we tried to deduce T in "const T"
6789  /// but were given a non-const "X".
6791  /// \brief Substitution of the deduced template argument values
6792  /// resulted in an error.
6794  /// \brief After substituting deduced template arguments, a dependent
6795  /// parameter type did not match the corresponding argument.
6797  /// \brief After substituting deduced template arguments, an element of
6798  /// a dependent parameter type did not match the corresponding element
6799  /// of the corresponding argument (when deducing from an initializer list).
6801  /// \brief A non-depnedent component of the parameter did not match the
6802  /// corresponding component of the argument.
6804  /// \brief When performing template argument deduction for a function
6805  /// template, there were too many call arguments.
6807  /// \brief When performing template argument deduction for a function
6808  /// template, there were too few call arguments.
6810  /// \brief The explicitly-specified template arguments were not valid
6811  /// template arguments for the given template.
6813  /// \brief Checking non-dependent argument conversions failed.
6815  /// \brief Deduction failed; that's all we know.
6817  /// \brief CUDA Target attributes do not match.
6819  };
6820 
6823  const TemplateArgumentList &TemplateArgs,
6825 
6828  const TemplateArgumentList &TemplateArgs,
6830 
6832  FunctionTemplateDecl *FunctionTemplate,
6833  TemplateArgumentListInfo &ExplicitTemplateArgs,
6837 
6838  /// brief A function argument from which we performed template argument
6839  // deduction for a call.
6841  OriginalCallArg(QualType OriginalParamType, bool DecomposedParam,
6842  unsigned ArgIdx, QualType OriginalArgType)
6843  : OriginalParamType(OriginalParamType),
6844  DecomposedParam(DecomposedParam), ArgIdx(ArgIdx),
6845  OriginalArgType(OriginalArgType) {}
6846 
6849  unsigned ArgIdx;
6851  };
6852 
6854  FunctionTemplateDecl *FunctionTemplate,
6856  unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
6858  SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
6859  bool PartialOverloading = false,
6860  llvm::function_ref<bool()> CheckNonDependent = []{ return false; });
6861 
6863  FunctionTemplateDecl *FunctionTemplate,
6864  TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
6865  FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info,
6866  bool PartialOverloading,
6867  llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
6868 
6871  TemplateArgumentListInfo *ExplicitTemplateArgs,
6872  QualType ArgFunctionType,
6873  FunctionDecl *&Specialization,
6875  bool IsAddressOfFunction = false);
6876 
6879  QualType ToType,
6880  CXXConversionDecl *&Specialization,
6882 
6885  TemplateArgumentListInfo *ExplicitTemplateArgs,
6886  FunctionDecl *&Specialization,
6888  bool IsAddressOfFunction = false);
6889 
6890  /// \brief Substitute Replacement for \p auto in \p TypeWithAuto
6892  /// \brief Substitute Replacement for auto in TypeWithAuto
6895  /// \brief Completely replace the \c auto in \p TypeWithAuto by
6896  /// \p Replacement. This does not retain any \c auto type sugar.
6898 
6899  /// \brief Result type of DeduceAutoType.
6904  };
6905 
6908  Optional<unsigned> DependentDeductionDepth = None);
6911  Optional<unsigned> DependentDeductionDepth = None);
6912  void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
6914  bool Diagnose = true);
6915 
6916  /// \brief Declare implicit deduction guides for a class template if we've
6917  /// not already done so.
6919  SourceLocation Loc);
6920 
6922  TypeSourceInfo *TInfo, const InitializedEntity &Entity,
6923  const InitializationKind &Kind, MultiExprArg Init);
6924 
6927  SourceRange Range, bool DirectInit,
6928  Expr *Init);
6929 
6931 
6933  SourceLocation ReturnLoc,
6934  Expr *&RetExpr, AutoType *AT);
6935 
6937  FunctionTemplateDecl *FT2,
6938  SourceLocation Loc,
6940  unsigned NumCallArguments1,
6941  unsigned NumCallArguments2);
6944  TemplateSpecCandidateSet &FailedCandidates,
6945  SourceLocation Loc,
6946  const PartialDiagnostic &NoneDiag,
6947  const PartialDiagnostic &AmbigDiag,
6948  const PartialDiagnostic &CandidateDiag,
6949  bool Complain = true, QualType TargetType = QualType());
6950 
6955  SourceLocation Loc);
6956 
6959 
6963 
6966 
6969 
6970  void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
6971  bool OnlyDeduced,
6972  unsigned Depth,
6973  llvm::SmallBitVector &Used);
6975  const FunctionTemplateDecl *FunctionTemplate,
6976  llvm::SmallBitVector &Deduced) {
6977  return MarkDeducedTemplateParameters(Context, FunctionTemplate, Deduced);
6978  }
6979  static void MarkDeducedTemplateParameters(ASTContext &Ctx,
6980  const FunctionTemplateDecl *FunctionTemplate,
6981  llvm::SmallBitVector &Deduced);
6982 
6983  //===--------------------------------------------------------------------===//
6984  // C++ Template Instantiation
6985  //
6986 
6989  const TemplateArgumentList *Innermost = nullptr,
6990  bool RelativeToPrimary = false,
6991  const FunctionDecl *Pattern = nullptr);
6992 
6993  /// A context in which code is being synthesized (where a source location
6994  /// alone is not sufficient to identify the context). This covers template
6995  /// instantiation and various forms of implicitly-generated functions.
6997  /// \brief The kind of template instantiation we are performing
6999  /// We are instantiating a template declaration. The entity is
7000  /// the declaration we're instantiating (e.g., a CXXRecordDecl).
7002 
7003  /// We are instantiating a default argument for a template
7004  /// parameter. The Entity is the template parameter whose argument is
7005  /// being instantiated, the Template is the template, and the
7006  /// TemplateArgs/NumTemplateArguments provide the template arguments as
7007  /// specified.
7009 
7010  /// We are instantiating a default argument for a function.
7011  /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
7012  /// provides the template arguments as specified.
7014 
7015  /// We are substituting explicit template arguments provided for
7016  /// a function template. The entity is a FunctionTemplateDecl.
7018 
7019  /// We are substituting template argument determined as part of
7020  /// template argument deduction for either a class template
7021  /// partial specialization or a function template. The
7022  /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
7023  /// a TemplateDecl.
7025 
7026  /// We are substituting prior template arguments into a new
7027  /// template parameter. The template parameter itself is either a
7028  /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
7030 
7031  /// We are checking the validity of a default template argument that
7032  /// has been used when naming a template-id.
7034 
7035  /// We are instantiating the exception specification for a function
7036  /// template which was deferred until it was needed.
7038 
7039  /// We are declaring an implicit special member function.
7041 
7042  /// We are defining a synthesized function (such as a defaulted special
7043  /// member).
7045  } Kind;
7046 
7047  /// \brief Was the enclosing context a non-instantiation SFINAE context?
7049 
7050  /// \brief The point of instantiation or synthesis within the source code.
7052 
7053  /// \brief The entity that is being synthesized.
7055 
7056  /// \brief The template (or partial specialization) in which we are
7057  /// performing the instantiation, for substitutions of prior template
7058  /// arguments.
7060 
7061  /// \brief The list of template arguments we are substituting, if they
7062  /// are not part of the entity.
7064 
7065  // FIXME: Wrap this union around more members, or perhaps store the
7066  // kind-specific members in the RAII object owning the context.
7067  union {
7068  /// \brief The number of template arguments in TemplateArgs.
7070 
7071  /// \brief The special member being declared or defined.
7073  };
7074 
7076  assert(Kind != DeclaringSpecialMember);
7077  return {TemplateArgs, NumTemplateArgs};
7078  }
7079 
7080  /// \brief The template deduction info object associated with the
7081  /// substitution or checking of explicit or deduced template arguments.
7083 
7084  /// \brief The source range that covers the construct that cause
7085  /// the instantiation, e.g., the template-id that causes a class
7086  /// template instantiation.
7088 
7090  : Kind(TemplateInstantiation), Entity(nullptr), Template(nullptr),
7091  TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
7092 
7093  /// \brief Determines whether this template is an actual instantiation
7094  /// that should be counted toward the maximum instantiation depth.
7095  bool isInstantiationRecord() const;
7096  };
7097 
7098  /// \brief List of active code synthesis contexts.
7099  ///
7100  /// This vector is treated as a stack. As synthesis of one entity requires
7101  /// synthesis of another, additional contexts are pushed onto the stack.
7103 
7104  /// Specializations whose definitions are currently being instantiated.
7106 
7107  /// Non-dependent types used in templates that have already been instantiated
7108  /// by some template instantiation.
7110 
7111  /// \brief Extra modules inspected when performing a lookup during a template
7112  /// instantiation. Computed lazily.
7114 
7115  /// \brief Cache of additional modules that should be used for name lookup
7116  /// within the current template instantiation. Computed lazily; use
7117  /// getLookupModules() to get a complete set.
7119 
7120  /// \brief Get the set of additional modules that should be checked during
7121  /// name lookup. A module and its imports become visible when instanting a
7122  /// template defined within it.
7124 
7125  /// \brief Map from the most recent declaration of a namespace to the most
7126  /// recent visible declaration of that namespace.
7127  llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
7128 
7129  /// \brief Whether we are in a SFINAE context that is not associated with
7130  /// template instantiation.
7131  ///
7132  /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
7133  /// of a template instantiation or template argument deduction.
7135 
7136  /// \brief The number of \p CodeSynthesisContexts that are not template
7137  /// instantiations and, therefore, should not be counted as part of the
7138  /// instantiation depth.
7139  ///
7140  /// When the instantiation depth reaches the user-configurable limit
7141  /// \p LangOptions::InstantiationDepth we will abort instantiation.
7142  // FIXME: Should we have a similar limit for other forms of synthesis?
7144 
7145  /// \brief The depth of the context stack at the point when the most recent
7146  /// error or warning was produced.
7147  ///
7148  /// This value is used to suppress printing of redundant context stacks
7149  /// when there are multiple errors or warnings in the same instantiation.
7150  // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
7152 
7153  /// \brief The current index into pack expansion arguments that will be
7154  /// used for substitution of parameter packs.
7155  ///
7156  /// The pack expansion index will be -1 to indicate that parameter packs
7157  /// should be instantiated as themselves. Otherwise, the index specifies
7158  /// which argument within the parameter pack will be used for substitution.
7160 
7161  /// \brief RAII object used to change the argument pack substitution index
7162  /// within a \c Sema object.
7163  ///
7164  /// See \c ArgumentPackSubstitutionIndex for more information.
7166  Sema &Self;
7167  int OldSubstitutionIndex;
7168 
7169  public:
7170  ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
7171  : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
7172  Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
7173  }
7174 
7176  Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
7177  }
7178  };
7179 
7181 
7182  /// \brief For each declaration that involved template argument deduction, the
7183  /// set of diagnostics that were suppressed during that template argument
7184  /// deduction.
7185  ///
7186  /// FIXME: Serialize this structure to the AST file.
7187  typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
7190 
7191  /// \brief A stack object to be created when performing template
7192  /// instantiation.
7193  ///
7194  /// Construction of an object of type \c InstantiatingTemplate
7195  /// pushes the current instantiation onto the stack of active
7196  /// instantiations. If the size of this stack exceeds the maximum
7197  /// number of recursive template instantiations, construction
7198  /// produces an error and evaluates true.
7199  ///
7200  /// Destruction of this object will pop the named instantiation off
7201  /// the stack.
7203  /// \brief Note that we are instantiating a class template,
7204  /// function template, variable template, alias template,
7205  /// or a member thereof.
7206  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7207  Decl *Entity,
7208  SourceRange InstantiationRange = SourceRange());
7209 
7211  /// \brief Note that we are instantiating an exception specification
7212  /// of a function template.
7213  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7215  SourceRange InstantiationRange = SourceRange());
7216 
7217  /// \brief Note that we are instantiating a default argument in a
7218  /// template-id.
7219  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7220  TemplateParameter Param, TemplateDecl *Template,
7221  ArrayRef<TemplateArgument> TemplateArgs,
7222  SourceRange InstantiationRange = SourceRange());
7223 
7224  /// \brief Note that we are substituting either explicitly-specified or
7225  /// deduced template arguments during function template argument deduction.
7226  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7227  FunctionTemplateDecl *FunctionTemplate,
7228  ArrayRef<TemplateArgument> TemplateArgs,
7230  sema::TemplateDeductionInfo &DeductionInfo,
7231  SourceRange InstantiationRange = SourceRange());
7232 
7233  /// \brief Note that we are instantiating as part of template
7234  /// argument deduction for a class template declaration.
7235  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7236  TemplateDecl *Template,
7237  ArrayRef<TemplateArgument> TemplateArgs,
7238  sema::TemplateDeductionInfo &DeductionInfo,
7239  SourceRange InstantiationRange = SourceRange());
7240 
7241  /// \brief Note that we are instantiating as part of template
7242  /// argument deduction for a class template partial
7243  /// specialization.
7244  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7246  ArrayRef<TemplateArgument> TemplateArgs,
7247  sema::TemplateDeductionInfo &DeductionInfo,
7248  SourceRange InstantiationRange = SourceRange());
7249 
7250  /// \brief Note that we are instantiating as part of template
7251  /// argument deduction for a variable template partial
7252  /// specialization.
7253  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7255  ArrayRef<TemplateArgument> TemplateArgs,
7256  sema::TemplateDeductionInfo &DeductionInfo,
7257  SourceRange InstantiationRange = SourceRange());
7258 
7259  /// \brief Note that we are instantiating a default argument for a function
7260  /// parameter.
7261  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7262  ParmVarDecl *Param,
7263  ArrayRef<TemplateArgument> TemplateArgs,
7264  SourceRange InstantiationRange = SourceRange());
7265 
7266  /// \brief Note that we are substituting prior template arguments into a
7267  /// non-type parameter.
7268  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7269  NamedDecl *Template,
7270  NonTypeTemplateParmDecl *Param,
7271  ArrayRef<TemplateArgument> TemplateArgs,
7272  SourceRange InstantiationRange);
7273 
7274  /// \brief Note that we are substituting prior template arguments into a
7275  /// template template parameter.
7276  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7277  NamedDecl *Template,
7278  TemplateTemplateParmDecl *Param,
7279  ArrayRef<TemplateArgument> TemplateArgs,
7280  SourceRange InstantiationRange);
7281 
7282  /// \brief Note that we are checking the default template argument
7283  /// against the template parameter for a given template-id.
7284  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
7285  TemplateDecl *Template,
7286  NamedDecl *Param,
7287  ArrayRef<TemplateArgument> TemplateArgs,
7288  SourceRange InstantiationRange);
7289 
7290 
7291  /// \brief Note that we have finished instantiating this template.
7292  void Clear();
7293 
7294  ~InstantiatingTemplate() { Clear(); }
7295 
7296  /// \brief Determines whether we have exceeded the maximum
7297  /// recursive template instantiations.
7298  bool isInvalid() const { return Invalid; }
7299 
7300  /// \brief Determine whether we are already instantiating this
7301  /// specialization in some surrounding active instantiation.
7302  bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
7303 
7304  private:
7305  Sema &SemaRef;
7306  bool Invalid;
7307  bool AlreadyInstantiating;
7308  bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
7309  SourceRange InstantiationRange);
7310 
7313  SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
7314  Decl *Entity, NamedDecl *Template = nullptr,
7315  ArrayRef<TemplateArgument> TemplateArgs = None,
7316  sema::TemplateDeductionInfo *DeductionInfo = nullptr);
7317 
7319 
7321  operator=(const InstantiatingTemplate&) = delete;
7322  };
7323 
7324  void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
7325  void popCodeSynthesisContext();
7326 
7327  /// Determine whether we are currently performing template instantiation.
7330  }
7331 
7333  if (!CodeSynthesisContexts.empty() &&
7337  }
7340  }
7341  void PrintInstantiationStack();
7342 
7344 
7345  /// \brief Determines whether we are currently in a context where
7346  /// template argument substitution failures are not considered
7347  /// errors.
7348  ///
7349  /// \returns An empty \c Optional if we're not in a SFINAE context.
7350  /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
7351  /// template-deduction context object, which can be used to capture
7352  /// diagnostics that will be suppressed.
7354 
7355  /// \brief Determines whether we are currently in a context that
7356  /// is not evaluated as per C++ [expr] p5.
7357  bool isUnevaluatedContext() const {
7358  assert(!ExprEvalContexts.empty() &&
7359  "Must be in an expression evaluation context");
7360  return ExprEvalContexts.back().isUnevaluated();
7361  }
7362 
7363  /// \brief RAII class used to determine whether SFINAE has
7364  /// trapped any errors that occur during template argument
7365  /// deduction.
7366  class SFINAETrap {
7367  Sema &SemaRef;
7368  unsigned PrevSFINAEErrors;
7369  bool PrevInNonInstantiationSFINAEContext;
7370  bool PrevAccessCheckingSFINAE;
7371 
7372  public:
7373  explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
7374  : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
7375  PrevInNonInstantiationSFINAEContext(
7377  PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE)
7378  {
7379  if (!SemaRef.isSFINAEContext())
7380  SemaRef.InNonInstantiationSFINAEContext = true;
7382  }
7383 
7385  SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
7387  = PrevInNonInstantiationSFINAEContext;
7388  SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
7389  }
7390 
7391  /// \brief Determine whether any SFINAE errors have been trapped.
7392  bool hasErrorOccurred() const {
7393  return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
7394  }
7395  };
7396 
7397  /// \brief RAII class used to indicate that we are performing provisional
7398  /// semantic analysis to determine the validity of a construct, so
7399  /// typo-correction and diagnostics in the immediate context (not within
7400  /// implicitly-instantiated templates) should be suppressed.
7402  Sema &SemaRef;
7403  // FIXME: Using a SFINAETrap for this is a hack.
7404  SFINAETrap Trap;
7405  bool PrevDisableTypoCorrection;
7406  public:
7407  explicit TentativeAnalysisScope(Sema &SemaRef)
7408  : SemaRef(SemaRef), Trap(SemaRef, true),
7409  PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
7410  SemaRef.DisableTypoCorrection = true;
7411  }
7413  SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
7414  }
7415  };
7416 
7417  /// \brief The current instantiation scope used to store local
7418  /// variables.
7420 
7421  /// \brief Tracks whether we are in a context where typo correction is
7422  /// disabled.
7424 
7425  /// \brief The number of typos corrected by CorrectTypo.
7426  unsigned TyposCorrected;
7427 
7428  typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
7429  typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
7430 
7431  /// \brief A cache containing identifiers for which typo correction failed and
7432  /// their locations, so that repeated attempts to correct an identifier in a
7433  /// given location are ignored if typo correction already failed for it.
7435 
7436  /// \brief Worker object for performing CFG-based warnings.
7439 
7440  /// \brief An entity for which implicit template instantiation is required.
7441  ///
7442  /// The source location associated with the declaration is the first place in
7443  /// the source code where the declaration was "used". It is not necessarily
7444  /// the point of instantiation (which will be either before or after the
7445  /// namespace-scope declaration that triggered this implicit instantiation),
7446  /// However, it is the location that diagnostics should generally refer to,
7447  /// because users will need to know what code triggered the instantiation.
7448  typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
7449 
7450  /// \brief The queue of implicit template instantiations that are required
7451  /// but have not yet been performed.
7452  std::deque<PendingImplicitInstantiation> PendingInstantiations;
7453 
7455  public:
7457  : S(S), Enabled(Enabled) {
7458  if (!Enabled) return;
7459 
7460  SavedPendingInstantiations.swap(S.PendingInstantiations);
7461  SavedVTableUses.swap(S.VTableUses);
7462  }
7463 
7464  void perform() {
7465  if (Enabled) {
7466  S.DefineUsedVTables();
7467  S.PerformPendingInstantiations();
7468  }
7469  }
7470 
7472  if (!Enabled) return;
7473 
7474  // Restore the set of pending vtables.
7475  assert(S.VTableUses.empty() &&
7476  "VTableUses should be empty before it is discarded.");
7477  S.VTableUses.swap(SavedVTableUses);
7478 
7479  // Restore the set of pending implicit instantiations.
7480  assert(S.PendingInstantiations.empty() &&
7481  "PendingInstantiations should be empty before it is discarded.");
7482  S.PendingInstantiations.swap(SavedPendingInstantiations);
7483  }
7484 
7485  private:
7486  Sema &S;
7487  SmallVector<VTableUse, 16> SavedVTableUses;
7488  std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
7489  bool Enabled;
7490  };
7491 
7492  /// \brief The queue of implicit template instantiations that are required
7493  /// and must be performed within the current local scope.
7494  ///
7495  /// This queue is only used for member functions of local classes in
7496  /// templates, which must be instantiated in the same scope as their
7497  /// enclosing function, so that they can reference function-local
7498  /// types, static variables, enumerators, etc.
7499  std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
7500 
7502  public:
7504  SavedPendingLocalImplicitInstantiations.swap(
7506  }
7507 
7508  void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
7509 
7511  assert(S.PendingLocalImplicitInstantiations.empty() &&
7512  "there shouldn't be any pending local implicit instantiations");
7513  SavedPendingLocalImplicitInstantiations.swap(
7514  S.PendingLocalImplicitInstantiations);
7515  }
7516 
7517  private:
7518  Sema &S;
7519  std::deque<PendingImplicitInstantiation>
7520  SavedPendingLocalImplicitInstantiations;
7521  };
7522 
7523  /// A helper class for building up ExtParameterInfos.
7526  bool HasInteresting = false;
7527 
7528  public:
7529  /// Set the ExtParameterInfo for the parameter at the given index,
7530  ///
7531  void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
7532  assert(Infos.size() <= index);
7533  Infos.resize(index);
7534  Infos.push_back(info);
7535 
7536  if (!HasInteresting)
7537  HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
7538  }
7539 
7540  /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
7541  /// ExtParameterInfo array we've built up.
7543  getPointerOrNull(unsigned numParams) {
7544  if (!HasInteresting) return nullptr;
7545  Infos.resize(numParams);
7546  return Infos.data();
7547  }
7548  };
7549 
7550  void PerformPendingInstantiations(bool LocalOnly = false);
7551 
7553  const MultiLevelTemplateArgumentList &TemplateArgs,
7554  SourceLocation Loc, DeclarationName Entity,
7555  bool AllowDeducedTST = false);
7556 
7558  const MultiLevelTemplateArgumentList &TemplateArgs,
7559  SourceLocation Loc, DeclarationName Entity);
7560 
7562  const MultiLevelTemplateArgumentList &TemplateArgs,
7563  SourceLocation Loc, DeclarationName Entity);
7564 
7566  const MultiLevelTemplateArgumentList &TemplateArgs,
7567  SourceLocation Loc,
7568  DeclarationName Entity,
7569  CXXRecordDecl *ThisContext,
7570  unsigned ThisTypeQuals);
7571  void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
7572  const MultiLevelTemplateArgumentList &Args);
7575  SmallVectorImpl<QualType> &ExceptionStorage,
7576  const MultiLevelTemplateArgumentList &Args);
7578  const MultiLevelTemplateArgumentList &TemplateArgs,
7579  int indexAdjustment,
7580  Optional<unsigned> NumExpansions,
7581  bool ExpectParameterPack);
7583  const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
7584  const MultiLevelTemplateArgumentList &TemplateArgs,
7585  SmallVectorImpl<QualType> &ParamTypes,
7586  SmallVectorImpl<ParmVarDecl *> *OutParams,
7587  ExtParameterInfoBuilder &ParamInfos);
7589  const MultiLevelTemplateArgumentList &TemplateArgs);
7590 
7591  /// \brief Substitute the given template arguments into a list of
7592  /// expressions, expanding pack expansions if required.
7593  ///
7594  /// \param Exprs The list of expressions to substitute into.
7595  ///
7596  /// \param IsCall Whether this is some form of call, in which case
7597  /// default arguments will be dropped.
7598  ///
7599  /// \param TemplateArgs The set of template arguments to substitute.
7600  ///
7601  /// \param Outputs Will receive all of the substituted arguments.
7602  ///
7603  /// \returns true if an error occurred, false otherwise.
7604  bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
7605  const MultiLevelTemplateArgumentList &TemplateArgs,
7606  SmallVectorImpl<Expr *> &Outputs);
7607 
7609  const MultiLevelTemplateArgumentList &TemplateArgs);
7610 
7611  Decl *SubstDecl(Decl *D, DeclContext *Owner,
7612  const MultiLevelTemplateArgumentList &TemplateArgs);
7613 
7615  const MultiLevelTemplateArgumentList &TemplateArgs,
7616  bool CXXDirectInit);
7617 
7618  bool
7619  SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
7620  CXXRecordDecl *Pattern,
7621  const MultiLevelTemplateArgumentList &TemplateArgs);
7622 
7623  bool
7624  InstantiateClass(SourceLocation PointOfInstantiation,
7625  CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
7626  const MultiLevelTemplateArgumentList &TemplateArgs,
7628  bool Complain = true);
7629 
7630  bool InstantiateEnum(SourceLocation PointOfInstantiation,
7631  EnumDecl *Instantiation, EnumDecl *Pattern,
7632  const MultiLevelTemplateArgumentList &TemplateArgs,
7634 
7636  SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
7637  FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
7638 
7640  const Attr *TmplAttr;
7643 
7645  Decl *D)
7646  : TmplAttr(A), Scope(S), NewDecl(D)
7647  { }
7648  };
7650 
7651  void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
7652  const Decl *Pattern, Decl *Inst,
7653  LateInstantiatedAttrVec *LateAttrs = nullptr,
7654  LocalInstantiationScope *OuterMostScope = nullptr);
7655 
7656  void
7658  const Decl *Pattern, Decl *Inst,
7659  LateInstantiatedAttrVec *LateAttrs = nullptr,
7660  LocalInstantiationScope *OuterMostScope = nullptr);
7661 
7663  SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
7664 
7665  bool
7667  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7669  bool Complain = true);
7670 
7671  void InstantiateClassMembers(SourceLocation PointOfInstantiation,
7672  CXXRecordDecl *Instantiation,
7673  const MultiLevelTemplateArgumentList &TemplateArgs,
7675 
7677  SourceLocation PointOfInstantiation,
7678  ClassTemplateSpecializationDecl *ClassTemplateSpec,
7680 
7683  const MultiLevelTemplateArgumentList &TemplateArgs);
7684 
7687  const MultiLevelTemplateArgumentList &TemplateArgs);
7688  TemplateName
7690  SourceLocation Loc,
7691  const MultiLevelTemplateArgumentList &TemplateArgs);
7692  bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
7694  const MultiLevelTemplateArgumentList &TemplateArgs);
7695 
7696  void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
7697  FunctionDecl *Function);
7698  void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
7699  FunctionDecl *Function,
7700  bool Recursive = false,
7701  bool DefinitionRequired = false,
7702  bool AtEndOfTU = false);
7704  VarTemplateDecl *VarTemplate, VarDecl *FromVar,
7705  const TemplateArgumentList &TemplateArgList,
7706  const TemplateArgumentListInfo &TemplateArgsInfo,
7708  SourceLocation PointOfInstantiation, void *InsertPos,
7709  LateInstantiatedAttrVec *LateAttrs = nullptr,
7710  LocalInstantiationScope *StartingScope = nullptr);
7712  VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
7713  const MultiLevelTemplateArgumentList &TemplateArgs);
7714  void
7715  BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar,
7716  const MultiLevelTemplateArgumentList &TemplateArgs,
7717  LateInstantiatedAttrVec *LateAttrs,
7718  DeclContext *Owner,
7719  LocalInstantiationScope *StartingScope,
7720  bool InstantiatingVarTemplate = false);
7722  VarDecl *Var, VarDecl *OldVar,
7723  const MultiLevelTemplateArgumentList &TemplateArgs);
7724  void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
7725  VarDecl *Var, bool Recursive = false,
7726  bool DefinitionRequired = false,
7727  bool AtEndOfTU = false);
7729  SourceLocation PointOfInstantiation,
7730  VarDecl *Var,
7731  bool Recursive = false,
7732  bool DefinitionRequired = false);
7733 
7735  const CXXConstructorDecl *Tmpl,
7736  const MultiLevelTemplateArgumentList &TemplateArgs);
7737 
7739  const MultiLevelTemplateArgumentList &TemplateArgs,
7740  bool FindingInstantiatedContext = false);
7742  const MultiLevelTemplateArgumentList &TemplateArgs);
7743 
7744  // Objective-C declarations.
7746  OCK_None = -1,
7753  };
7755 
7757  ObjCTypeParamVariance variance,
7758  SourceLocation varianceLoc,
7759  unsigned index,
7760  IdentifierInfo *paramName,
7761  SourceLocation paramLoc,
7762  SourceLocation colonLoc,
7763  ParsedType typeBound);
7764 
7766  ArrayRef<Decl *> typeParams,
7767  SourceLocation rAngleLoc);
7768  void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
7769 
7771  SourceLocation AtInterfaceLoc,
7772  IdentifierInfo *ClassName,
7773  SourceLocation ClassLoc,
7774  ObjCTypeParamList *typeParamList,
7775  IdentifierInfo *SuperName,
7776  SourceLocation SuperLoc,
7777  ArrayRef<ParsedType> SuperTypeArgs,
7778  SourceRange SuperTypeArgsRange,
7779  Decl * const *ProtoRefs,
7780  unsigned NumProtoRefs,
7781  const SourceLocation *ProtoLocs,
7782  SourceLocation EndProtoLoc,
7783  AttributeList *AttrList);
7784 
7786  SourceLocation AtInterfaceLoc,
7787  ObjCInterfaceDecl *IDecl,
7788  IdentifierInfo *ClassName,
7789  SourceLocation ClassLoc,
7790  IdentifierInfo *SuperName,
7791  SourceLocation SuperLoc,
7792  ArrayRef<ParsedType> SuperTypeArgs,
7793  SourceRange SuperTypeArgsRange);
7794 
7796  SmallVectorImpl<SourceLocation> &ProtocolLocs,
7797  IdentifierInfo *SuperName,
7798  SourceLocation SuperLoc);
7799 
7801  SourceLocation AtCompatibilityAliasLoc,
7802  IdentifierInfo *AliasName, SourceLocation AliasLocation,
7803  IdentifierInfo *ClassName, SourceLocation ClassLocation);
7804 
7806  IdentifierInfo *PName,
7807  SourceLocation &PLoc, SourceLocation PrevLoc,
7808  const ObjCList<ObjCProtocolDecl> &PList);
7809 
7811  SourceLocation AtProtoInterfaceLoc,
7812  IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
7813  Decl * const *ProtoRefNames, unsigned NumProtoRefs,
7814  const SourceLocation *ProtoLocs,
7815  SourceLocation EndProtoLoc,
7816  AttributeList *AttrList);
7817 
7819  IdentifierInfo *ClassName,
7820  SourceLocation ClassLoc,
7821  ObjCTypeParamList *typeParamList,
7822  IdentifierInfo *CategoryName,
7823  SourceLocation CategoryLoc,
7824  Decl * const *ProtoRefs,
7825  unsigned NumProtoRefs,
7826  const SourceLocation *ProtoLocs,
7827  SourceLocation EndProtoLoc,
7828  AttributeList *AttrList);
7829 
7831  SourceLocation AtClassImplLoc,
7832  IdentifierInfo *ClassName, SourceLocation ClassLoc,
7833  IdentifierInfo *SuperClassname,
7834  SourceLocation SuperClassLoc);
7835 
7837  IdentifierInfo *ClassName,
7838  SourceLocation ClassLoc,
7839  IdentifierInfo *CatName,
7840  SourceLocation CatLoc);
7841 
7843  ArrayRef<Decl *> Decls);
7844 
7846  IdentifierInfo **IdentList,
7847  SourceLocation *IdentLocs,
7848  ArrayRef<ObjCTypeParamList *> TypeParamLists,
7849  unsigned NumElts);
7850 
7852  ArrayRef<IdentifierLocPair> IdentList,
7853  AttributeList *attrList);
7854 
7855  void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
7856  ArrayRef<IdentifierLocPair> ProtocolId,
7857  SmallVectorImpl<Decl *> &Protocols);
7858 
7860  SourceLocation ProtocolLoc,
7861  IdentifierInfo *TypeArgId,
7862  SourceLocation TypeArgLoc,
7863  bool SelectProtocolFirst = false);
7864 
7865  /// Given a list of identifiers (and their locations), resolve the
7866  /// names to either Objective-C protocol qualifiers or type
7867  /// arguments, as appropriate.
7869  Scope *S,
7870  ParsedType baseType,
7871  SourceLocation lAngleLoc,
7872  ArrayRef<IdentifierInfo *> identifiers,
7873  ArrayRef<SourceLocation> identifierLocs,
7874  SourceLocation rAngleLoc,
7875  SourceLocation &typeArgsLAngleLoc,
7876  SmallVectorImpl<ParsedType> &typeArgs,
7877  SourceLocation &typeArgsRAngleLoc,
7878  SourceLocation &protocolLAngleLoc,
7879  SmallVectorImpl<Decl *> &protocols,
7880  SourceLocation &protocolRAngleLoc,
7881  bool warnOnIncompleteProtocols);
7882 
7883  /// Build a an Objective-C protocol-qualified 'id' type where no
7884  /// base type was specified.
7886  SourceLocation lAngleLoc,
7887  ArrayRef<Decl *> protocols,
7888  ArrayRef<SourceLocation> protocolLocs,
7889  SourceLocation rAngleLoc);
7890 
7891  /// Build a specialized and/or protocol-qualified Objective-C type.
7893  Scope *S,
7894  SourceLocation Loc,
7895  ParsedType BaseType,
7896  SourceLocation TypeArgsLAngleLoc,
7897  ArrayRef<ParsedType> TypeArgs,
7898  SourceLocation TypeArgsRAngleLoc,
7899  SourceLocation ProtocolLAngleLoc,
7900  ArrayRef<Decl *> Protocols,
7901  ArrayRef<SourceLocation> ProtocolLocs,
7902  SourceLocation ProtocolRAngleLoc);
7903 
7904  /// Build an Objective-C type parameter type.
7906  SourceLocation ProtocolLAngleLoc,
7907  ArrayRef<ObjCProtocolDecl *> Protocols,
7908  ArrayRef<SourceLocation> ProtocolLocs,
7909  SourceLocation ProtocolRAngleLoc,
7910  bool FailOnError = false);
7911 
7912  /// Build an Objective-C object pointer type.
7914  SourceLocation Loc,
7915  SourceLocation TypeArgsLAngleLoc,
7916  ArrayRef<TypeSourceInfo *> TypeArgs,
7917  SourceLocation TypeArgsRAngleLoc,
7918  SourceLocation ProtocolLAngleLoc,
7919  ArrayRef<ObjCProtocolDecl *> Protocols,
7920  ArrayRef<SourceLocation> ProtocolLocs,
7921  SourceLocation ProtocolRAngleLoc,
7922  bool FailOnError = false);
7923 
7924  /// Check the application of the Objective-C '__kindof' qualifier to
7925  /// the given type.
7927 
7928  /// Ensure attributes are consistent with type.
7929  /// \param [in, out] Attributes The attributes to check; they will
7930  /// be modified to be consistent with \p PropertyTy.
7931  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
7932  SourceLocation Loc,
7933  unsigned &Attributes,
7934  bool propertyInPrimaryClass);
7935 
7936  /// Process the specified property declaration and create decls for the
7937  /// setters and getters as needed.
7938  /// \param property The property declaration being processed
7939  void ProcessPropertyDecl(ObjCPropertyDecl *property);
7940 
7941 
7943  ObjCPropertyDecl *SuperProperty,
7944  const IdentifierInfo *Name,
7945  bool OverridingProtocolProperty);
7946 
7949 
7950  Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
7951  ArrayRef<Decl *> allMethods = None,
7952  ArrayRef<DeclGroupPtrTy> allTUVars = None);
7953 
7955  SourceLocation LParenLoc,
7956  FieldDeclarator &FD, ObjCDeclSpec &ODS,
7957  Selector GetterSel, Selector SetterSel,
7958  tok::ObjCKeywordKind MethodImplKind,
7959  DeclContext *lexicalDC = nullptr);
7960 
7962  SourceLocation AtLoc,
7963  SourceLocation PropertyLoc,
7964  bool ImplKind,
7965  IdentifierInfo *PropertyId,
7966  IdentifierInfo *PropertyIvar,
7967  SourceLocation PropertyIvarLoc,
7968  ObjCPropertyQueryKind QueryKind);
7969 
7977  };
7978 
7979  struct ObjCArgInfo {
7982  // The Type is null if no type was specified, and the DeclSpec is invalid
7983  // in this case.
7986 
7987  /// ArgAttrs - Attribute list for this argument.
7989  };
7990 
7992  Scope *S,
7993  SourceLocation BeginLoc, // location of the + or -.
7994  SourceLocation EndLoc, // location of the ; or {.
7995  tok::TokenKind MethodType,
7996  ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
7997  ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
7998  // optional arguments. The number of types/arguments is obtained
7999  // from the Sel.getNumArgs().
8000  ObjCArgInfo *ArgInfo,
8001  DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, // c-style args
8002  AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind,
8003  bool isVariadic, bool MethodDefinition);
8004 
8006  const ObjCObjectPointerType *OPT,
8007  bool IsInstance);
8009  bool IsInstance);
8010 
8011  bool CheckARCMethodDecl(ObjCMethodDecl *method);
8013 
8014  ExprResult
8016  Expr *BaseExpr,
8017  SourceLocation OpLoc,
8018  DeclarationName MemberName,
8019  SourceLocation MemberLoc,
8020  SourceLocation SuperLoc, QualType SuperType,
8021  bool Super);
8022 
8023  ExprResult
8025  IdentifierInfo &propertyName,
8026  SourceLocation receiverNameLoc,
8027  SourceLocation propertyNameLoc);
8028 
8030 
8031  /// \brief Describes the kind of message expression indicated by a message
8032  /// send that starts with an identifier.
8034  /// \brief The message is sent to 'super'.
8036  /// \brief The message is an instance message.
8038  /// \brief The message is a class message, and the identifier is a type
8039  /// name.
8041  };
8042 
8045  SourceLocation NameLoc,
8046  bool IsSuper,
8047  bool HasTrailingDot,
8048  ParsedType &ReceiverType);
8049 
8051  Selector Sel,
8052  SourceLocation LBracLoc,
8053  ArrayRef<SourceLocation> SelectorLocs,
8054  SourceLocation RBracLoc,
8055  MultiExprArg Args);
8056 
8057  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
8058  QualType ReceiverType,
8059  SourceLocation SuperLoc,
8060  Selector Sel,
8061  ObjCMethodDecl *Method,
8062  SourceLocation LBracLoc,
8063  ArrayRef<SourceLocation> SelectorLocs,
8064  SourceLocation RBracLoc,
8065  MultiExprArg Args,
8066  bool isImplicit = false);
8067 
8069  bool isSuperReceiver,
8070  SourceLocation Loc,
8071  Selector Sel,
8072  ObjCMethodDecl *Method,
8073  MultiExprArg Args);
8074 
8076  ParsedType Receiver,
8077  Selector Sel,
8078  SourceLocation LBracLoc,
8079  ArrayRef<SourceLocation> SelectorLocs,
8080  SourceLocation RBracLoc,
8081  MultiExprArg Args);
8082 
8084  QualType ReceiverType,
8085  SourceLocation SuperLoc,
8086  Selector Sel,
8087  ObjCMethodDecl *Method,
8088  SourceLocation LBracLoc,
8089  ArrayRef<SourceLocation> SelectorLocs,
8090  SourceLocation RBracLoc,
8091  MultiExprArg Args,
8092  bool isImplicit = false);
8093 
8095  QualType ReceiverType,
8096  SourceLocation Loc,
8097  Selector Sel,
8098  ObjCMethodDecl *Method,
8099  MultiExprArg Args);
8100 
8102  Expr *Receiver,
8103  Selector Sel,
8104  SourceLocation LBracLoc,
8105  ArrayRef<SourceLocation> SelectorLocs,
8106  SourceLocation RBracLoc,
8107  MultiExprArg Args);
8108 
8110  ObjCBridgeCastKind Kind,
8111  SourceLocation BridgeKeywordLoc,
8112  TypeSourceInfo *TSInfo,
8113  Expr *SubExpr);
8114 
8116  SourceLocation LParenLoc,
8117  ObjCBridgeCastKind Kind,
8118  SourceLocation BridgeKeywordLoc,
8119  ParsedType Type,
8120  SourceLocation RParenLoc,
8121  Expr *SubExpr);
8122 
8123  void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr);
8124 
8126 
8128  CastKind &Kind);
8129 
8131  QualType DestType, QualType SrcType,
8132  ObjCInterfaceDecl *&RelatedClass,
8133  ObjCMethodDecl *&ClassMethod,
8134  ObjCMethodDecl *&InstanceMethod,
8135  TypedefNameDecl *&TDNDecl,
8136  bool CfToNs, bool Diagnose = true);
8137 
8139  QualType DestType, QualType SrcType,
8140  Expr *&SrcExpr, bool Diagnose = true);
8141 
8142  bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr,
8143  bool Diagnose = true);
8144 
8145  bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
8146 
8147  /// \brief Check whether the given new method is a valid override of the
8148  /// given overridden method, and set any properties that should be inherited.
8149  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
8150  const ObjCMethodDecl *Overridden);
8151 
8152  /// \brief Describes the compatibility of a result type with its method.
8157  };
8158 
8159  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
8160  ObjCInterfaceDecl *CurrentClass,
8162 
8164  POAK_Native, // #pragma options align=native
8165  POAK_Natural, // #pragma options align=natural
8166  POAK_Packed, // #pragma options align=packed
8167  POAK_Power, // #pragma options align=power
8168  POAK_Mac68k, // #pragma options align=mac68k
8169  POAK_Reset // #pragma options align=reset
8170  };
8171 
8172  /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
8173  void ActOnPragmaClangSection(SourceLocation PragmaLoc,
8175  PragmaClangSectionKind SecKind, StringRef SecName);
8176 
8177  /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
8179  SourceLocation PragmaLoc);
8180 
8181  /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
8183  StringRef SlotLabel, Expr *Alignment);
8184 
8185  /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
8187 
8188  /// ActOnPragmaMSComment - Called on well formed
8189  /// \#pragma comment(kind, "arg").
8191  StringRef Arg);
8192 
8193  /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
8194  /// pointers_to_members(representation method[, general purpose
8195  /// representation]).
8198  SourceLocation PragmaLoc);
8199 
8200  /// \brief Called on well formed \#pragma vtordisp().
8202  SourceLocation PragmaLoc,
8203  MSVtorDispAttr::Mode Value);
8204 
8210  };
8211 
8212  bool UnifySection(StringRef SectionName,
8213  int SectionFlags,
8214  DeclaratorDecl *TheDecl);
8215  bool UnifySection(StringRef SectionName,
8216  int SectionFlags,
8217  SourceLocation PragmaSectionLocation);
8218 
8219  /// \brief Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
8220  void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
8222  llvm::StringRef StackSlotLabel,
8223  StringLiteral *SegmentName,
8224  llvm::StringRef PragmaName);
8225 
8226  /// \brief Called on well formed \#pragma section().
8227  void ActOnPragmaMSSection(SourceLocation PragmaLocation,
8228  int SectionFlags, StringLiteral *SegmentName);
8229 
8230  /// \brief Called on well-formed \#pragma init_seg().
8231  void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
8232  StringLiteral *SegmentName);
8233 
8234  /// \brief Called on #pragma clang __debug dump II
8236 
8237  /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
8238  void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
8239  StringRef Value);
8240 
8241  /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
8242  void ActOnPragmaUnused(const Token &Identifier,
8243  Scope *curScope,
8244  SourceLocation PragmaLoc);
8245 
8246  /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
8247  void ActOnPragmaVisibility(const IdentifierInfo* VisType,
8248  SourceLocation PragmaLoc);
8249 
8251  SourceLocation Loc);
8252  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);
8253 
8254  /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
8255  void ActOnPragmaWeakID(IdentifierInfo* WeakName,
8256  SourceLocation PragmaLoc,
8257  SourceLocation WeakNameLoc);
8258 
8259  /// ActOnPragmaRedefineExtname - Called on well formed
8260  /// \#pragma redefine_extname oldname newname.
8262  IdentifierInfo* AliasName,
8263  SourceLocation PragmaLoc,
8264  SourceLocation WeakNameLoc,
8265  SourceLocation AliasNameLoc);
8266 
8267  /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
8268  void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
8269  IdentifierInfo* AliasName,
8270  SourceLocation PragmaLoc,
8271  SourceLocation WeakNameLoc,
8272  SourceLocation AliasNameLoc);
8273 
8274  /// ActOnPragmaFPContract - Called on well formed
8275  /// \#pragma {STDC,OPENCL} FP_CONTRACT and
8276  /// \#pragma clang fp contract
8278 
8279  /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
8280  /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
8282 
8283  /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
8285 
8286  /// FreePackedContext - Deallocate and null out PackContext.
8287  void FreePackedContext();
8288 
8289  /// PushNamespaceVisibilityAttr - Note that we've entered a
8290  /// namespace with a visibility attribute.
8291  void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
8292  SourceLocation Loc);
8293 
8294  /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
8295  /// add an appropriate visibility attribute.
8297 
8298  /// PopPragmaVisibility - Pop the top element of the visibility stack; used
8299  /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
8300  void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
8301 
8302  /// FreeVisContext - Deallocate and null out VisContext.
8303  void FreeVisContext();
8304 
8305  /// AddCFAuditedAttribute - Check whether we're currently within
8306  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
8307  /// the appropriate attribute.
8308  void AddCFAuditedAttribute(Decl *D);
8309 
8310  /// \brief Called on well-formed '\#pragma clang attribute push'.
8311  void ActOnPragmaAttributePush(AttributeList &Attribute,
8312  SourceLocation PragmaLoc,
8314 
8315  /// \brief Called on well-formed '\#pragma clang attribute pop'.
8316  void ActOnPragmaAttributePop(SourceLocation PragmaLoc);
8317 
8318  /// \brief Adds the attributes that have been specified using the
8319  /// '\#pragma clang attribute push' directives to the given declaration.
8320  void AddPragmaAttributes(Scope *S, Decl *D);
8321 
8323 
8324  /// \brief Called on well formed \#pragma clang optimize.
8325  void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
8326 
8327  /// \brief Get the location for the currently active "\#pragma clang optimize
8328  /// off". If this location is invalid, then the state of the pragma is "on".
8331  }
8332 
8333  /// \brief Only called on function definitions; if there is a pragma in scope
8334  /// with the effect of a range-based optnone, consider marking the function
8335  /// with attribute optnone.
8337 
8338  /// \brief Adds the 'optnone' attribute to the function declaration if there
8339  /// are no conflicts; Loc represents the location causing the 'optnone'
8340  /// attribute to be added (usually because of a pragma).
8342 
8343  /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
8344  void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
8345  unsigned SpellingListIndex, bool IsPackExpansion);
8346  void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T,
8347  unsigned SpellingListIndex, bool IsPackExpansion);
8348 
8349  /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
8350  /// declaration.
8351  void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE,
8352  unsigned SpellingListIndex);
8353 
8354  /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
8355  /// declaration.
8356  void AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr,
8357  unsigned SpellingListIndex);
8358 
8359  /// AddAlignValueAttr - Adds an align_value attribute to a particular
8360  /// declaration.
8361  void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E,
8362  unsigned SpellingListIndex);
8363 
8364  /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
8365  /// declaration.
8366  void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads,
8367  Expr *MinBlocks, unsigned SpellingListIndex);
8368 
8369  /// AddModeAttr - Adds a mode attribute to a particular declaration.
8370  void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name,
8371  unsigned SpellingListIndex, bool InInstantiation = false);
8372 
8373  void AddParameterABIAttr(SourceRange AttrRange, Decl *D,
8374  ParameterABI ABI, unsigned SpellingListIndex);
8375 
8376  void AddNSConsumedAttr(SourceRange AttrRange, Decl *D,
8377  unsigned SpellingListIndex, bool isNSConsumed,
8379 
8381 
8382  //===--------------------------------------------------------------------===//
8383  // C++ Coroutines TS
8384  //
8386  StringRef Keyword);
8390 
8392  bool IsImplicit = false);
8394  UnresolvedLookupExpr* Lookup);
8397  bool IsImplicit = false);
8400  void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body);
8401 
8402  //===--------------------------------------------------------------------===//
8403  // OpenCL extensions.
8404  //
8405 private:
8406  std::string CurrOpenCLExtension;
8407  /// Extensions required by an OpenCL type.
8408  llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap;
8409  /// Extensions required by an OpenCL declaration.
8410  llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap;
8411 public:
8412  llvm::StringRef getCurrentOpenCLExtension() const {
8413  return CurrOpenCLExtension;
8414  }
8415  void setCurrentOpenCLExtension(llvm::StringRef Ext) {
8416  CurrOpenCLExtension = Ext;
8417  }
8418 
8419  /// \brief Set OpenCL extensions for a type which can only be used when these
8420  /// OpenCL extensions are enabled. If \p Exts is empty, do nothing.
8421  /// \param Exts A space separated list of OpenCL extensions.
8422  void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts);
8423 
8424  /// \brief Set OpenCL extensions for a declaration which can only be
8425  /// used when these OpenCL extensions are enabled. If \p Exts is empty, do
8426  /// nothing.
8427  /// \param Exts A space separated list of OpenCL extensions.
8428  void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts);
8429 
8430  /// \brief Set current OpenCL extensions for a type which can only be used
8431  /// when these OpenCL extensions are enabled. If current OpenCL extension is
8432  /// empty, do nothing.
8434 
8435  /// \brief Set current OpenCL extensions for a declaration which
8436  /// can only be used when these OpenCL extensions are enabled. If current
8437  /// OpenCL extension is empty, do nothing.
8439 
8440  bool isOpenCLDisabledDecl(Decl *FD);
8441 
8442  /// \brief Check if type \p T corresponding to declaration specifier \p DS
8443  /// is disabled due to required OpenCL extensions being disabled. If so,
8444  /// emit diagnostics.
8445  /// \return true if type is disabled.
8447 
8448  /// \brief Check if declaration \p D used by expression \p E
8449  /// is disabled due to required OpenCL extensions being disabled. If so,
8450  /// emit diagnostics.
8451  /// \return true if type is disabled.
8452  bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
8453 
8454  //===--------------------------------------------------------------------===//
8455  // OpenMP directives and clauses.
8456  //
8457 private:
8458  void *VarDataSharingAttributesStack;
8459  /// Set to true inside '#pragma omp declare target' region.
8460  bool IsInOpenMPDeclareTargetContext = false;
8461  /// \brief Initialization of data-sharing attributes stack.
8462  void InitDataSharingAttributesStack();
8463  void DestroyDataSharingAttributesStack();
8464  ExprResult
8465  VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
8466  bool StrictlyPositive = true);
8467  /// Returns OpenMP nesting level for current directive.
8468  unsigned getOpenMPNestingLevel() const;
8469 
8470  /// Push new OpenMP function region for non-capturing function.
8471  void pushOpenMPFunctionRegion();
8472 
8473  /// Pop OpenMP function region for non-capturing function.
8474  void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
8475 
8476  /// Checks if a type or a declaration is disabled due to the owning extension
8477  /// being disabled, and emits diagnostic messages if it is disabled.
8478  /// \param D type or declaration to be checked.
8479  /// \param DiagLoc source location for the diagnostic message.
8480  /// \param DiagInfo information to be emitted for the diagnostic message.
8481  /// \param SrcRange source range of the declaration.
8482  /// \param Map maps type or declaration to the extensions.
8483  /// \param Selector selects diagnostic message: 0 for type and 1 for
8484  /// declaration.
8485  /// \return true if the type or declaration is disabled.
8486  template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
8487  bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo,
8488  MapT &Map, unsigned Selector = 0,
8489  SourceRange SrcRange = SourceRange());
8490 
8491 public:
8492  /// \brief Return true if the provided declaration \a VD should be captured by
8493  /// reference.
8494  /// \param Level Relative level of nested OpenMP construct for that the check
8495  /// is performed.
8496  bool IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level);
8497 
8498  /// \brief Check if the specified variable is used in one of the private
8499  /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
8500  /// constructs.
8503  ExprObjectKind OK, SourceLocation Loc);
8504 
8505  /// \brief Check if the specified variable is used in 'private' clause.
8506  /// \param Level Relative level of nested OpenMP construct for that the check
8507  /// is performed.
8508  bool isOpenMPPrivateDecl(ValueDecl *D, unsigned Level);
8509 
8510  /// \brief Check if the specified variable is captured by 'target' directive.
8511  /// \param Level Relative level of nested OpenMP construct for that the check
8512  /// is performed.
8513  bool isOpenMPTargetCapturedDecl(ValueDecl *D, unsigned Level);
8514 
8516  Expr *Op);
8517  /// \brief Called on start of new data sharing attribute block.
8519  const DeclarationNameInfo &DirName, Scope *CurScope,
8520  SourceLocation Loc);
8521  /// \brief Start analysis of clauses.
8523  /// \brief End analysis of clauses.
8524  void EndOpenMPClause();
8525  /// \brief Called on end of data sharing attribute block.
8526  void EndOpenMPDSABlock(Stmt *CurDirective);
8527 
8528  /// \brief Check if the current region is an OpenMP loop region and if it is,
8529  /// mark loop control variable, used in \p Init for loop initialization, as
8530  /// private by default.
8531  /// \param Init First part of the for loop.
8533 
8534  // OpenMP directives and clauses.
8535  /// \brief Called on correct id-expression from the '#pragma omp
8536  /// threadprivate'.
8538  CXXScopeSpec &ScopeSpec,
8539  const DeclarationNameInfo &Id);
8540  /// \brief Called on well-formed '#pragma omp threadprivate'.
8542  SourceLocation Loc,
8543  ArrayRef<Expr *> VarList);
8544  /// \brief Builds a new OpenMPThreadPrivateDecl and checks its correctness.
8546  SourceLocation Loc,
8547  ArrayRef<Expr *> VarList);
8548  /// \brief Check if the specified type is allowed to be used in 'omp declare
8549  /// reduction' construct.
8552  /// \brief Called on start of '#pragma omp declare reduction'.
8555  ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
8556  AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
8557  /// \brief Initialize declare reduction construct initializer.
8559  /// \brief Finish current declare reduction construct initializer.
8560  void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner);
8561  /// \brief Initialize declare reduction construct initializer.
8563  /// \brief Finish current declare reduction construct initializer.
8564  void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer);
8565  /// \brief Called at the end of '#pragma omp declare reduction'.
8567  Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
8568 
8569  /// Called on the start of target region i.e. '#pragma omp declare target'.
8571  /// Called at the end of target region i.e. '#pragme omp end declare target'.
8573  /// Called on correct id-expression from the '#pragma omp declare target'.
8574  void ActOnOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec,
8575  const DeclarationNameInfo &Id,
8576  OMPDeclareTargetDeclAttr::MapTypeTy MT,
8577  NamedDeclSetType &SameDirectiveDecls);
8578  /// Check declaration inside target region.
8580  /// Return true inside OpenMP target region.
8582  return IsInOpenMPDeclareTargetContext;
8583  }
8584 
8585  /// Return the number of captured regions created for an OpenMP directive.
8587 
8588  /// \brief Initialization of captured region for OpenMP region.
8589  void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
8590  /// \brief End of OpenMP region.
8591  ///
8592  /// \param S Statement associated with the current OpenMP region.
8593  /// \param Clauses List of clauses for the current OpenMP region.
8594  ///
8595  /// \returns Statement for finished OpenMP region.
8598  OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
8599  OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
8600  Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
8601  /// \brief Called on well-formed '\#pragma omp parallel' after parsing
8602  /// of the associated statement.
8604  Stmt *AStmt,
8605  SourceLocation StartLoc,
8606  SourceLocation EndLoc);
8607  /// \brief Called on well-formed '\#pragma omp simd' after parsing
8608  /// of the associated statement.
8610  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8611  SourceLocation EndLoc,
8612  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8613  /// \brief Called on well-formed '\#pragma omp for' after parsing
8614  /// of the associated statement.
8616  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8617  SourceLocation EndLoc,
8618  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8619  /// \brief Called on well-formed '\#pragma omp for simd' after parsing
8620  /// of the associated statement.
8622  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8623  SourceLocation EndLoc,
8624  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8625  /// \brief Called on well-formed '\#pragma omp sections' after parsing
8626  /// of the associated statement.
8628  Stmt *AStmt, SourceLocation StartLoc,
8629  SourceLocation EndLoc);
8630  /// \brief Called on well-formed '\#pragma omp section' after parsing of the
8631  /// associated statement.
8633  SourceLocation EndLoc);
8634  /// \brief Called on well-formed '\#pragma omp single' after parsing of the
8635  /// associated statement.
8637  Stmt *AStmt, SourceLocation StartLoc,
8638  SourceLocation EndLoc);
8639  /// \brief Called on well-formed '\#pragma omp master' after parsing of the
8640  /// associated statement.
8642  SourceLocation EndLoc);
8643  /// \brief Called on well-formed '\#pragma omp critical' after parsing of the
8644  /// associated statement.
8646  ArrayRef<OMPClause *> Clauses,
8647  Stmt *AStmt, SourceLocation StartLoc,
8648  SourceLocation EndLoc);
8649  /// \brief Called on well-formed '\#pragma omp parallel for' after parsing
8650  /// of the associated statement.
8652  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8653  SourceLocation EndLoc,
8654  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8655  /// \brief Called on well-formed '\#pragma omp parallel for simd' after
8656  /// parsing of the associated statement.
8658  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8659  SourceLocation EndLoc,
8660  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8661  /// \brief Called on well-formed '\#pragma omp parallel sections' after
8662  /// parsing of the associated statement.
8664  Stmt *AStmt,
8665  SourceLocation StartLoc,
8666  SourceLocation EndLoc);
8667  /// \brief Called on well-formed '\#pragma omp task' after parsing of the
8668  /// associated statement.
8670  Stmt *AStmt, SourceLocation StartLoc,
8671  SourceLocation EndLoc);
8672  /// \brief Called on well-formed '\#pragma omp taskyield'.
8674  SourceLocation EndLoc);
8675  /// \brief Called on well-formed '\#pragma omp barrier'.
8677  SourceLocation EndLoc);
8678  /// \brief Called on well-formed '\#pragma omp taskwait'.
8680  SourceLocation EndLoc);
8681  /// \brief Called on well-formed '\#pragma omp taskgroup'.
8683  Stmt *AStmt, SourceLocation StartLoc,
8684  SourceLocation EndLoc);
8685  /// \brief Called on well-formed '\#pragma omp flush'.
8687  SourceLocation StartLoc,
8688  SourceLocation EndLoc);
8689  /// \brief Called on well-formed '\#pragma omp ordered' after parsing of the
8690  /// associated statement.
8692  Stmt *AStmt, SourceLocation StartLoc,
8693  SourceLocation EndLoc);
8694  /// \brief Called on well-formed '\#pragma omp atomic' after parsing of the
8695  /// associated statement.
8697  Stmt *AStmt, SourceLocation StartLoc,
8698  SourceLocation EndLoc);
8699  /// \brief Called on well-formed '\#pragma omp target' after parsing of the
8700  /// associated statement.
8702  Stmt *AStmt, SourceLocation StartLoc,
8703  SourceLocation EndLoc);
8704  /// \brief Called on well-formed '\#pragma omp target data' after parsing of
8705  /// the associated statement.
8707  Stmt *AStmt, SourceLocation StartLoc,
8708  SourceLocation EndLoc);
8709  /// \brief Called on well-formed '\#pragma omp target enter data' after
8710  /// parsing of the associated statement.
8712  SourceLocation StartLoc,
8713  SourceLocation EndLoc);
8714  /// \brief Called on well-formed '\#pragma omp target exit data' after
8715  /// parsing of the associated statement.
8717  SourceLocation StartLoc,
8718  SourceLocation EndLoc);
8719  /// \brief Called on well-formed '\#pragma omp target parallel' after
8720  /// parsing of the associated statement.
8722  Stmt *AStmt,
8723  SourceLocation StartLoc,
8724  SourceLocation EndLoc);
8725  /// \brief Called on well-formed '\#pragma omp target parallel for' after
8726  /// parsing of the associated statement.
8728  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8729  SourceLocation EndLoc,
8730  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8731  /// \brief Called on well-formed '\#pragma omp teams' after parsing of the
8732  /// associated statement.
8734  Stmt *AStmt, SourceLocation StartLoc,
8735  SourceLocation EndLoc);
8736  /// \brief Called on well-formed '\#pragma omp cancellation point'.
8737  StmtResult
8739  SourceLocation EndLoc,
8740  OpenMPDirectiveKind CancelRegion);
8741  /// \brief Called on well-formed '\#pragma omp cancel'.
8743  SourceLocation StartLoc,
8744  SourceLocation EndLoc,
8745  OpenMPDirectiveKind CancelRegion);
8746  /// \brief Called on well-formed '\#pragma omp taskloop' after parsing of the
8747  /// associated statement.
8749  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8750  SourceLocation EndLoc,
8751  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8752  /// \brief Called on well-formed '\#pragma omp taskloop simd' after parsing of
8753  /// the associated statement.
8755  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8756  SourceLocation EndLoc,
8757  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8758  /// \brief Called on well-formed '\#pragma omp distribute' after parsing
8759  /// of the associated statement.
8761  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8762  SourceLocation EndLoc,
8763  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8764  /// \brief Called on well-formed '\#pragma omp target update'.
8766  SourceLocation StartLoc,
8767  SourceLocation EndLoc);
8768  /// \brief Called on well-formed '\#pragma omp distribute parallel for' after
8769  /// parsing of the associated statement.
8771  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8772  SourceLocation EndLoc,
8773  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8774  /// \brief Called on well-formed '\#pragma omp distribute parallel for simd'
8775  /// after parsing of the associated statement.
8777  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8778  SourceLocation EndLoc,
8779  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8780  /// \brief Called on well-formed '\#pragma omp distribute simd' after
8781  /// parsing of the associated statement.
8783  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8784  SourceLocation EndLoc,
8785  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8786  /// \brief Called on well-formed '\#pragma omp target parallel for simd' after
8787  /// parsing of the associated statement.
8789  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8790  SourceLocation EndLoc,
8791  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8792  /// \brief Called on well-formed '\#pragma omp target simd' after parsing of
8793  /// the associated statement.
8795  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8796  SourceLocation EndLoc,
8797  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8798  /// Called on well-formed '\#pragma omp teams distribute' after parsing of
8799  /// the associated statement.
8801  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8802  SourceLocation EndLoc,
8803  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8804  /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
8805  /// of the associated statement.
8807  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8808  SourceLocation EndLoc,
8809  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8810  /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
8811  /// after parsing of the associated statement.
8813  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8814  SourceLocation EndLoc,
8815  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8816  /// Called on well-formed '\#pragma omp teams distribute parallel for'
8817  /// after parsing of the associated statement.
8819  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8820  SourceLocation EndLoc,
8821  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8822  /// Called on well-formed '\#pragma omp target teams' after parsing of the
8823  /// associated statement.
8825  Stmt *AStmt,
8826  SourceLocation StartLoc,
8827  SourceLocation EndLoc);
8828  /// Called on well-formed '\#pragma omp target teams distribute' after parsing
8829  /// of the associated statement.
8831  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8832  SourceLocation EndLoc,
8833  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8834  /// Called on well-formed '\#pragma omp target teams distribute parallel for'
8835  /// after parsing of the associated statement.
8837  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8838  SourceLocation EndLoc,
8839  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8840  /// Called on well-formed '\#pragma omp target teams distribute parallel for
8841  /// simd' after parsing of the associated statement.
8843  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8844  SourceLocation EndLoc,
8845  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8846  /// Called on well-formed '\#pragma omp target teams distribute simd' after
8847  /// parsing of the associated statement.
8849  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
8850  SourceLocation EndLoc,
8851  llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA);
8852 
8853  /// Checks correctness of linear modifiers.
8855  SourceLocation LinLoc);
8856  /// Checks that the specified declaration matches requirements for the linear
8857  /// decls.
8860 
8861  /// \brief Called on well-formed '\#pragma omp declare simd' after parsing of
8862  /// the associated method/function.
8864  DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
8865  Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
8866  ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
8867  ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
8868 
8870  Expr *Expr,
8871  SourceLocation StartLoc,
8872  SourceLocation LParenLoc,
8873  SourceLocation EndLoc);
8874  /// \brief Called on well-formed 'if' clause.
8876  Expr *Condition, SourceLocation StartLoc,
8877  SourceLocation LParenLoc,
8878  SourceLocation NameModifierLoc,
8880  SourceLocation EndLoc);
8881  /// \brief Called on well-formed 'final' clause.
8882  OMPClause *ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc,
8883  SourceLocation LParenLoc,
8884  SourceLocation EndLoc);
8885  /// \brief Called on well-formed 'num_threads' clause.
8887  SourceLocation StartLoc,
8888  SourceLocation LParenLoc,
8889  SourceLocation EndLoc);
8890  /// \brief Called on well-formed 'safelen' clause.
8892  SourceLocation StartLoc,
8893  SourceLocation LParenLoc,
8894  SourceLocation EndLoc);
8895  /// \brief Called on well-formed 'simdlen' clause.
8897  SourceLocation LParenLoc,
8898  SourceLocation EndLoc);
8899  /// \brief Called on well-formed 'collapse' clause.
8901  SourceLocation StartLoc,
8902  SourceLocation LParenLoc,
8903  SourceLocation EndLoc);
8904  /// \brief Called on well-formed 'ordered' clause.
8905  OMPClause *
8907  SourceLocation LParenLoc = SourceLocation(),
8908  Expr *NumForLoops = nullptr);
8909  /// \brief Called on well-formed 'grainsize' clause.
8911  SourceLocation LParenLoc,
8912  SourceLocation EndLoc);
8913  /// \brief Called on well-formed 'num_tasks' clause.
8915  SourceLocation LParenLoc,
8916  SourceLocation EndLoc);
8917  /// \brief Called on well-formed 'hint' clause.
8919  SourceLocation LParenLoc,
8920  SourceLocation EndLoc);
8921 
8923  unsigned Argument,
8924  SourceLocation ArgumentLoc,
8925  SourceLocation StartLoc,
8926  SourceLocation LParenLoc,
8927  SourceLocation EndLoc);
8928  /// \brief Called on well-formed 'default' clause.
8930  SourceLocation KindLoc,
8931  SourceLocation StartLoc,
8932  SourceLocation LParenLoc,
8933  SourceLocation EndLoc);
8934  /// \brief Called on well-formed 'proc_bind' clause.
8936  SourceLocation KindLoc,
8937  SourceLocation StartLoc,
8938  SourceLocation LParenLoc,
8939  SourceLocation EndLoc);
8940 
8942  OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
8943  SourceLocation StartLoc, SourceLocation LParenLoc,
8944  ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
8945  SourceLocation EndLoc);
8946  /// \brief Called on well-formed 'schedule' clause.
8949  OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
8950  SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
8951  SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
8952 
8954  SourceLocation EndLoc);
8955  /// \brief Called on well-formed 'nowait' clause.
8957  SourceLocation EndLoc);
8958  /// \brief Called on well-formed 'untied' clause.
8960  SourceLocation EndLoc);
8961  /// \brief Called on well-formed 'mergeable' clause.
8963  SourceLocation EndLoc);
8964  /// \brief Called on well-formed 'read' clause.
8966  SourceLocation EndLoc);
8967  /// \brief Called on well-formed 'write' clause.
8969  SourceLocation EndLoc);
8970  /// \brief Called on well-formed 'update' clause.
8972  SourceLocation EndLoc);
8973  /// \brief Called on well-formed 'capture' clause.
8975  SourceLocation EndLoc);
8976  /// \brief Called on well-formed 'seq_cst' clause.
8978  SourceLocation EndLoc);
8979  /// \brief Called on well-formed 'threads' clause.
8981  SourceLocation EndLoc);
8982  /// \brief Called on well-formed 'simd' clause.
8984  SourceLocation EndLoc);
8985  /// \brief Called on well-formed 'nogroup' clause.
8987  SourceLocation EndLoc);
8988 
8990  OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
8991  SourceLocation StartLoc, SourceLocation LParenLoc,
8993  CXXScopeSpec &ReductionIdScopeSpec,
8994  const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind,
8995  OpenMPLinearClauseKind LinKind, OpenMPMapClauseKind MapTypeModifier,
8996  OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
8997  SourceLocation DepLinMapLoc);
8998  /// \brief Called on well-formed 'private' clause.
9000  SourceLocation StartLoc,
9001  SourceLocation LParenLoc,
9002  SourceLocation EndLoc);
9003  /// \brief Called on well-formed 'firstprivate' clause.
9005  SourceLocation StartLoc,
9006  SourceLocation LParenLoc,
9007  SourceLocation EndLoc);
9008  /// \brief Called on well-formed 'lastprivate' clause.
9010  SourceLocation StartLoc,
9011  SourceLocation LParenLoc,
9012  SourceLocation EndLoc);
9013  /// \brief Called on well-formed 'shared' clause.
9015  SourceLocation StartLoc,
9016  SourceLocation LParenLoc,
9017  SourceLocation EndLoc);
9018  /// \brief Called on well-formed 'reduction' clause.
9020  ArrayRef<Expr *> VarList, SourceLocation StartLoc,
9022  CXXScopeSpec &ReductionIdScopeSpec,
9023  const DeclarationNameInfo &ReductionId,
9024  ArrayRef<Expr *> UnresolvedReductions = llvm::None);
9025  /// Called on well-formed 'task_reduction' clause.
9027  ArrayRef<Expr *> VarList, SourceLocation StartLoc,
9029  CXXScopeSpec &ReductionIdScopeSpec,
9030  const DeclarationNameInfo &ReductionId,
9031  ArrayRef<Expr *> UnresolvedReductions = llvm::None);
9032  /// \brief Called on well-formed 'linear' clause.
9033  OMPClause *
9035  SourceLocation StartLoc, SourceLocation LParenLoc,
9036  OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
9038  /// \brief Called on well-formed 'aligned' clause.
9040  Expr *Alignment,
9041  SourceLocation StartLoc,
9042  SourceLocation LParenLoc,
9044  SourceLocation EndLoc);
9045  /// \brief Called on well-formed 'copyin' clause.
9047  SourceLocation StartLoc,
9048  SourceLocation LParenLoc,
9049  SourceLocation EndLoc);
9050  /// \brief Called on well-formed 'copyprivate' clause.
9052  SourceLocation StartLoc,
9053  SourceLocation LParenLoc,
9054  SourceLocation EndLoc);
9055  /// \brief Called on well-formed 'flush' pseudo clause.
9057  SourceLocation StartLoc,
9058  SourceLocation LParenLoc,
9059  SourceLocation EndLoc);
9060  /// \brief Called on well-formed 'depend' clause.
9061  OMPClause *
9064  SourceLocation StartLoc, SourceLocation LParenLoc,
9065  SourceLocation EndLoc);
9066  /// \brief Called on well-formed 'device' clause.
9068  SourceLocation LParenLoc,
9069  SourceLocation EndLoc);
9070  /// \brief Called on well-formed 'map' clause.
9071  OMPClause *
9072  ActOnOpenMPMapClause(OpenMPMapClauseKind MapTypeModifier,
9073  OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
9075  ArrayRef<Expr *> VarList, SourceLocation StartLoc,
9076  SourceLocation LParenLoc, SourceLocation EndLoc);
9077  /// \brief Called on well-formed 'num_teams' clause.
9079  SourceLocation LParenLoc,
9080  SourceLocation EndLoc);
9081  /// \brief Called on well-formed 'thread_limit' clause.
9083  SourceLocation StartLoc,
9084  SourceLocation LParenLoc,
9085  SourceLocation EndLoc);
9086  /// \brief Called on well-formed 'priority' clause.
9088  SourceLocation LParenLoc,
9089  SourceLocation EndLoc);
9090  /// \brief Called on well-formed 'dist_schedule' clause.
9092  OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
9093  SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
9094  SourceLocation CommaLoc, SourceLocation EndLoc);
9095  /// \brief Called on well-formed 'defaultmap' clause.
9098  SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
9099  SourceLocation KindLoc, SourceLocation EndLoc);
9100  /// \brief Called on well-formed 'to' clause.
9102  SourceLocation StartLoc,
9103  SourceLocation LParenLoc,
9104  SourceLocation EndLoc);
9105  /// \brief Called on well-formed 'from' clause.
9107  SourceLocation StartLoc,
9108  SourceLocation LParenLoc,
9109  SourceLocation EndLoc);
9110  /// Called on well-formed 'use_device_ptr' clause.
9112  SourceLocation StartLoc,
9113  SourceLocation LParenLoc,
9114  SourceLocation EndLoc);
9115  /// Called on well-formed 'is_device_ptr' clause.
9117  SourceLocation StartLoc,
9118  SourceLocation LParenLoc,
9119  SourceLocation EndLoc);
9120 
9121  /// \brief The kind of conversion being performed.
9123  /// \brief An implicit conversion.
9125  /// \brief A C-style cast.
9127  /// \brief A functional-style cast.
9129  /// \brief A cast other than a C-style cast.
9131  };
9132 
9133  /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
9134  /// cast. If there is already an implicit cast, merge into the existing one.
9135  /// If isLvalue, the result of the cast is an lvalue.
9137  ExprValueKind VK = VK_RValue,
9138  const CXXCastPath *BasePath = nullptr,
9141 
9142  /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
9143  /// to the conversion from scalar type ScalarTy to the Boolean type.
9145 
9146  /// IgnoredValueConversions - Given that an expression's result is
9147  /// syntactically ignored, perform any conversions that are
9148  /// required.
9150 
9151  // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
9152  // functions and arrays to their respective pointers (C99 6.3.2.1).
9154 
9155  /// CallExprUnaryConversions - a special case of an unary conversion
9156  /// performed on a function designator of a call expression.
9158 
9159  // DefaultFunctionArrayConversion - converts functions and arrays
9160  // to their respective pointers (C99 6.3.2.1).
9161  ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose = true);
9162 
9163  // DefaultFunctionArrayLvalueConversion - converts functions and
9164  // arrays to their respective pointers and performs the
9165  // lvalue-to-rvalue conversion.
9167  bool Diagnose = true);
9168 
9169  // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
9170  // the operand. This is DefaultFunctionArrayLvalueConversion,
9171  // except that it assumes the operand isn't of function or array
9172  // type.
9174 
9175  // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
9176  // do not have a prototype. Integer promotions are performed on each
9177  // argument, and arguments that have type float are promoted to double.
9179 
9180  /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
9181  /// it as an xvalue. In C++98, the result will still be a prvalue, because
9182  /// we don't have xvalues there.
9184 
9185  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
9192  };
9193 
9195  const FunctionProtoType *Proto,
9196  Expr *Fn);
9197 
9198  // Used for determining in which context a type is allowed to be passed to a
9199  // vararg function.
9200  enum VarArgKind {
9206  };
9207 
9208  // Determines which VarArgKind fits an expression.
9210 
9211  /// Check to see if the given expression is a valid argument to a variadic
9212  /// function, issuing a diagnostic if not.
9213  void checkVariadicArgument(const Expr *E, VariadicCallType CT);
9214 
9215  /// Check to see if a given expression could have '.c_str()' called on it.
9216  bool hasCStrMethod(const Expr *E);
9217 
9218  /// GatherArgumentsForCall - Collector argument expressions for various
9219  /// form of call prototypes.
9220  bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
9221  const FunctionProtoType *Proto,
9222  unsigned FirstParam, ArrayRef<Expr *> Args,
9223  SmallVectorImpl<Expr *> &AllArgs,
9225  bool AllowExplicit = false,
9226  bool IsListInitialization = false);
9227 
9228  // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
9229  // will create a runtime trap if the resulting type is not a POD type.
9231  FunctionDecl *FDecl);
9232 
9233  // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
9234  // operands and then handles various conversions that are common to binary
9235  // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
9236  // routine returns the first non-arithmetic type found. The client is
9237  // responsible for emitting appropriate error diagnostics.
9239  bool IsCompAssign = false);
9240 
9241  /// AssignConvertType - All of the 'assignment' semantic checks return this
9242  /// enum to indicate whether the assignment was allowed. These checks are
9243  /// done for simple assignments, as well as initialization, return from
9244  /// function, argument passing, etc. The query is phrased in terms of a
9245  /// source and destination type.
9247  /// Compatible - the types are compatible according to the standard.
9249 
9250  /// PointerToInt - The assignment converts a pointer to an int, which we
9251  /// accept as an extension.
9253 
9254  /// IntToPointer - The assignment converts an int to a pointer, which we
9255  /// accept as an extension.
9257 
9258  /// FunctionVoidPointer - The assignment is between a function pointer and
9259  /// void*, which the standard doesn't allow, but we accept as an extension.
9261 
9262  /// IncompatiblePointer - The assignment is between two pointers types that
9263  /// are not compatible, but we accept them as an extension.
9265 
9266  /// IncompatiblePointerSign - The assignment is between two pointers types
9267  /// which point to integers which have a different sign, but are otherwise
9268  /// identical. This is a subset of the above, but broken out because it's by
9269  /// far the most common case of incompatible pointers.
9271 
9272  /// CompatiblePointerDiscardsQualifiers - The assignment discards
9273  /// c/v/r qualifiers, which we accept as an extension.
9275 
9276  /// IncompatiblePointerDiscardsQualifiers - The assignment
9277  /// discards qualifiers that we don't permit to be discarded,
9278  /// like address spaces.
9280 
9281  /// IncompatibleNestedPointerQualifiers - The assignment is between two
9282  /// nested pointer types, and the qualifiers other than the first two
9283  /// levels differ e.g. char ** -> const char **, but we accept them as an
9284  /// extension.
9286 
9287  /// IncompatibleVectors - The assignment is between two vector types that
9288  /// have the same size, which we accept as an extension.
9290 
9291  /// IntToBlockPointer - The assignment converts an int to a block
9292  /// pointer. We disallow this.
9294 
9295  /// IncompatibleBlockPointer - The assignment is between two block
9296  /// pointers types that are not compatible.
9298 
9299  /// IncompatibleObjCQualifiedId - The assignment is between a qualified
9300  /// id type and something else (that is incompatible with it). For example,
9301  /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
9303 
9304  /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
9305  /// object with __weak qualifier.
9307 
9308  /// Incompatible - We reject this conversion outright, it is invalid to
9309  /// represent it in the AST.
9311  };
9312 
9313  /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
9314  /// assignment conversion type specified by ConvTy. This returns true if the
9315  /// conversion was invalid or false if the conversion was accepted.
9317  SourceLocation Loc,
9318  QualType DstType, QualType SrcType,
9319  Expr *SrcExpr, AssignmentAction Action,
9320  bool *Complained = nullptr);
9321 
9322  /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
9323  /// enum. If AllowMask is true, then we also allow the complement of a valid
9324  /// value, to be used as a mask.
9325  bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
9326  bool AllowMask) const;
9327 
9328  /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
9329  /// integer not in the range of enum values.
9330  void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
9331  Expr *SrcExpr);
9332 
9333  /// CheckAssignmentConstraints - Perform type checking for assignment,
9334  /// argument passing, variable initialization, and function return values.
9335  /// C99 6.5.16.
9337  QualType LHSType,
9338  QualType RHSType);
9339 
9340  /// Check assignment constraints and optionally prepare for a conversion of
9341  /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
9342  /// is true.
9344  ExprResult &RHS,
9345  CastKind &Kind,
9346  bool ConvertRHS = true);
9347 
9348  /// Check assignment constraints for an assignment of RHS to LHSType.
9349  ///
9350  /// \param LHSType The destination type for the assignment.
9351  /// \param RHS The source expression for the assignment.
9352  /// \param Diagnose If \c true, diagnostics may be produced when checking
9353  /// for assignability. If a diagnostic is produced, \p RHS will be
9354  /// set to ExprError(). Note that this function may still return
9355  /// without producing a diagnostic, even for an invalid assignment.
9356  /// \param DiagnoseCFAudited If \c true, the target is a function parameter
9357  /// in an audited Core Foundation API and does not need to be checked
9358  /// for ARC retain issues.
9359  /// \param ConvertRHS If \c true, \p RHS will be updated to model the
9360  /// conversions necessary to perform the assignment. If \c false,
9361  /// \p Diagnose must also be \c false.
9363  QualType LHSType, ExprResult &RHS, bool Diagnose = true,
9364  bool DiagnoseCFAudited = false, bool ConvertRHS = true);
9365 
9366  // \brief If the lhs type is a transparent union, check whether we
9367  // can initialize the transparent union with the given expression.
9369  ExprResult &RHS);
9370 
9372 
9373  bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
9374 
9377  bool AllowExplicit = false);
9380  bool AllowExplicit,
9383  const ImplicitConversionSequence& ICS,
9388  const StandardConversionSequence& SCS,
9390  CheckedConversionKind CCK);
9391 
9392  /// the following "Check" methods will return a valid/converted QualType
9393  /// or a null QualType (indicating an error diagnostic was issued).
9394 
9395  /// type checking binary operators (subroutines of CreateBuiltinBinOp).
9397  ExprResult &RHS);
9399  ExprResult &RHS);
9401  ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
9402  SourceLocation OpLoc, bool isIndirect);
9404  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
9405  bool IsDivide);
9406  QualType CheckRemainderOperands( // C99 6.5.5
9407  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9408  bool IsCompAssign = false);
9409  QualType CheckAdditionOperands( // C99 6.5.6
9410  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9411  BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
9412  QualType CheckSubtractionOperands( // C99 6.5.6
9413  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9414  QualType* CompLHSTy = nullptr);
9415  QualType CheckShiftOperands( // C99 6.5.7
9416  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9417  BinaryOperatorKind Opc, bool IsCompAssign = false);
9418  QualType CheckCompareOperands( // C99 6.5.8/9
9419  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9420  BinaryOperatorKind Opc, bool isRelational);
9421  QualType CheckBitwiseOperands( // C99 6.5.[10...12]
9422  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9423  BinaryOperatorKind Opc);
9424  QualType CheckLogicalOperands( // C99 6.5.[13,14]
9425  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
9426  BinaryOperatorKind Opc);
9427  // CheckAssignmentOperands is used for both simple and compound assignment.
9428  // For simple assignment, pass both expressions and a null converted type.
9429  // For compound assignment, pass both expressions and the converted type.
9430  QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
9431  Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType);
9432 
9434  UnaryOperatorKind Opcode, Expr *Op);
9436  BinaryOperatorKind Opcode,
9437  Expr *LHS, Expr *RHS);
9440 
9441  QualType CheckConditionalOperands( // C99 6.5.15
9442  ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
9443  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
9445  ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
9446  ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
9448  bool ConvertArgs = true);
9450  ExprResult &E1, ExprResult &E2,
9451  bool ConvertArgs = true) {
9452  Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
9453  QualType Composite =
9454  FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
9455  E1 = E1Tmp;
9456  E2 = E2Tmp;
9457  return Composite;
9458  }
9459 
9461  SourceLocation QuestionLoc);
9462 
9463  bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
9464  SourceLocation QuestionLoc);
9465 
9468  bool IsEqual, SourceRange Range);
9469 
9470  /// type checking for vector binary operators.
9472  SourceLocation Loc, bool IsCompAssign,
9473  bool AllowBothBool, bool AllowBoolConversion);
9476  SourceLocation Loc, bool isRelational);
9478  SourceLocation Loc);
9479 
9480  bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
9481  bool isLaxVectorConversion(QualType srcType, QualType destType);
9482 
9483  /// type checking declaration initializers (C99 6.7.8)
9485 
9486  // type checking C++ declaration initializers (C++ [dcl.init]).
9487 
9488  /// ReferenceCompareResult - Expresses the result of comparing two
9489  /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
9490  /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
9492  /// Ref_Incompatible - The two types are incompatible, so direct
9493  /// reference binding is not possible.
9495  /// Ref_Related - The two types are reference-related, which means
9496  /// that their unqualified forms (T1 and T2) are either the same
9497  /// or T1 is a base class of T2.
9499  /// Ref_Compatible - The two types are reference-compatible.
9501  };
9502 
9504  QualType T1, QualType T2,
9505  bool &DerivedToBase,
9506  bool &ObjCConversion,
9507  bool &ObjCLifetimeConversion);
9508 
9511  ExprValueKind &VK, CXXCastPath &Path);
9512 
9513  /// \brief Force an expression with unknown-type to an expression of the
9514  /// given type.
9516 
9517  /// \brief Type-check an expression that's being passed to an
9518  /// __unknown_anytype parameter.
9520  Expr *result, QualType &paramType);
9521 
9522  // CheckVectorCast - check type constraints for vectors.
9523  // Since vectors are an extension, there are no C standard reference for this.
9524  // We allow casting between vectors and integer datatypes of the same size.
9525  // returns true if the cast is invalid
9526  bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
9527  CastKind &Kind);
9528 
9529  /// \brief Prepare `SplattedExpr` for a vector splat operation, adding
9530  /// implicit casts if necessary.
9531  ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
9532 
9533  // CheckExtVectorCast - check type constraints for extended vectors.
9534  // Since vectors are an extension, there are no C standard reference for this.
9535  // We allow casting between vectors and integer datatypes of the same size,
9536  // or vectors and the element type of that vector.
9537  // returns the cast expr
9539  CastKind &Kind);
9540 
9542  SourceLocation LParenLoc,
9543  Expr *CastExpr,
9544  SourceLocation RParenLoc);
9545 
9547 
9548  /// \brief Checks for invalid conversions and casts between
9549  /// retainable pointers and other pointer kinds for ARC and Weak.
9551  QualType castType, Expr *&op,
9553  bool Diagnose = true,
9554  bool DiagnoseCFAudited = false,
9555  BinaryOperatorKind Opc = BO_PtrMemD
9556  );
9557 
9559  void diagnoseARCUnbridgedCast(Expr *e);
9560 
9562  QualType ExprType);
9563 
9564  /// checkRetainCycles - Check whether an Objective-C message send
9565  /// might create an obvious retain cycle.
9567  void checkRetainCycles(Expr *receiver, Expr *argument);
9568  void checkRetainCycles(VarDecl *Var, Expr *Init);
9569 
9570  /// checkUnsafeAssigns - Check whether +1 expr is being assigned
9571  /// to weak/__unsafe_unretained type.
9572  bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
9573 
9574  /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
9575  /// to weak/__unsafe_unretained expression.
9576  void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
9577 
9578  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
9579  /// \param Method - May be null.
9580  /// \param [out] ReturnType - The return type of the send.
9581  /// \return true iff there were any incompatible types.
9582  bool CheckMessageArgumentTypes(QualType ReceiverType,
9583  MultiExprArg Args, Selector Sel,
9584  ArrayRef<SourceLocation> SelectorLocs,
9585  ObjCMethodDecl *Method, bool isClassMessage,
9586  bool isSuperMessage,
9587  SourceLocation lbrac, SourceLocation rbrac,
9588  SourceRange RecRange,
9589  QualType &ReturnType, ExprValueKind &VK);
9590 
9591  /// \brief Determine the result of a message send expression based on
9592  /// the type of the receiver, the method expected to receive the message,
9593  /// and the form of the message send.
9595  ObjCMethodDecl *Method,
9596  bool isClassMessage, bool isSuperMessage);
9597 
9598  /// \brief If the given expression involves a message send to a method
9599  /// with a related result type, emit a note describing what happened.
9600  void EmitRelatedResultTypeNote(const Expr *E);
9601 
9602  /// \brief Given that we had incompatible pointer types in a return
9603  /// statement, check whether we're in a method with a related result
9604  /// type, and if so, emit a note describing what happened.
9606 
9608  Decl *ConditionVar;
9609  FullExprArg Condition;
9610  bool Invalid;
9611  bool HasKnownValue;
9612  bool KnownValue;
9613 
9614  friend class Sema;
9615  ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
9616  bool IsConstexpr)
9617  : ConditionVar(ConditionVar), Condition(Condition), Invalid(false),
9618  HasKnownValue(IsConstexpr && Condition.get() &&
9619  !Condition.get()->isValueDependent()),
9620  KnownValue(HasKnownValue &&
9621  !!Condition.get()->EvaluateKnownConstInt(S.Context)) {}
9622  explicit ConditionResult(bool Invalid)
9623  : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
9624  HasKnownValue(false), KnownValue(false) {}
9625 
9626  public:
9628  bool isInvalid() const { return Invalid; }
9629  std::pair<VarDecl *, Expr *> get() const {
9630  return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
9631  Condition.get());
9632  }
9634  if (!HasKnownValue)
9635  return None;
9636  return KnownValue;
9637  }
9638  };
9640 
9641  enum class ConditionKind {
9642  Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
9643  ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
9644  Switch ///< An integral condition for a 'switch' statement.
9645  };
9646 
9647  ConditionResult ActOnCondition(Scope *S, SourceLocation Loc,
9648  Expr *SubExpr, ConditionKind CK);
9649 
9650  ConditionResult ActOnConditionVariable(Decl *ConditionVar,
9651  SourceLocation StmtLoc,
9652  ConditionKind CK);
9653 
9655 
9657  SourceLocation StmtLoc,
9658  ConditionKind CK);
9660 
9661  /// CheckBooleanCondition - Diagnose problems involving the use of
9662  /// the given expression as a boolean condition (e.g. in an if
9663  /// statement). Also performs the standard function and array
9664  /// decays, possibly changing the input variable.
9665  ///
9666  /// \param Loc - A location associated with the condition, e.g. the
9667  /// 'if' keyword.
9668  /// \return true iff there were any errors
9670  bool IsConstexpr = false);
9671 
9672  /// DiagnoseAssignmentAsCondition - Given that an expression is
9673  /// being used as a boolean condition, warn if it's an assignment.
9675 
9676  /// \brief Redundant parentheses over an equality comparison can indicate
9677  /// that the user intended an assignment used as condition.
9679 
9680  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
9681  ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
9682 
9683  /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
9684  /// the specified width and sign. If an overflow occurs, detect it and emit
9685  /// the specified diagnostic.
9686  void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
9687  unsigned NewWidth, bool NewSign,
9688  SourceLocation Loc, unsigned DiagID);
9689 
9690  /// Checks that the Objective-C declaration is declared in the global scope.
9691  /// Emits an error and marks the declaration as invalid if it's not declared
9692  /// in the global scope.
9693  bool CheckObjCDeclScope(Decl *D);
9694 
9695  /// \brief Abstract base class used for diagnosing integer constant
9696  /// expression violations.
9698  public:
9699  bool Suppress;
9700 
9701  VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { }
9702 
9703  virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) =0;
9704  virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR);
9705  virtual ~VerifyICEDiagnoser() { }
9706  };
9707 
9708  /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
9709  /// and reports the appropriate diagnostics. Returns false on success.
9710  /// Can optionally return the value of the expression.
9712  VerifyICEDiagnoser &Diagnoser,
9713  bool AllowFold = true);
9715  unsigned DiagID,
9716  bool AllowFold = true);
9718  llvm::APSInt *Result = nullptr);
9719 
9720  /// VerifyBitField - verifies that a bit field expression is an ICE and has
9721  /// the correct width, and that the field type is valid.
9722  /// Returns false on success.
9723  /// Can optionally return whether the bit-field is of width 0
9725  QualType FieldTy, bool IsMsStruct,
9726  Expr *BitWidth, bool *ZeroWidth = nullptr);
9727 
9728 private:
9729  unsigned ForceCUDAHostDeviceDepth = 0;
9730 
9731 public:
9732  /// Increments our count of the number of times we've seen a pragma forcing
9733  /// functions to be __host__ __device__. So long as this count is greater
9734  /// than zero, all functions encountered will be __host__ __device__.
9735  void PushForceCUDAHostDevice();
9736 
9737  /// Decrements our count of the number of times we've seen a pragma forcing
9738  /// functions to be __host__ __device__. Returns false if the count is 0
9739  /// before incrementing, so you can emit an error.
9740  bool PopForceCUDAHostDevice();
9741 
9742  /// Diagnostics that are emitted only if we discover that the given function
9743  /// must be codegen'ed. Because handling these correctly adds overhead to
9744  /// compilation, this is currently only enabled for CUDA compilations.
9745  llvm::DenseMap<CanonicalDeclPtr<FunctionDecl>,
9746  std::vector<PartialDiagnosticAt>>
9748 
9749  /// A pair of a canonical FunctionDecl and a SourceLocation. When used as the
9750  /// key in a hashtable, both the FD and location are hashed.
9754  };
9755 
9756  /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
9757  /// (maybe deferred) "bad call" diagnostic. We use this to avoid emitting the
9758  /// same deferred diag twice.
9760 
9761  /// An inverse call graph, mapping known-emitted functions to one of their
9762  /// known-emitted callers (plus the location of the call).
9763  ///
9764  /// Functions that we can tell a priori must be emitted aren't added to this
9765  /// map.
9766  llvm::DenseMap</* Callee = */ CanonicalDeclPtr<FunctionDecl>,
9767  /* Caller = */ FunctionDeclAndLoc>
9769 
9770  /// A partial call graph maintained during CUDA compilation to support
9771  /// deferred diagnostics.
9772  ///
9773  /// Functions are only added here if, at the time they're considered, they are
9774  /// not known-emitted. As soon as we discover that a function is
9775  /// known-emitted, we remove it and everything it transitively calls from this
9776  /// set and add those functions to CUDAKnownEmittedFns.
9777  llvm::DenseMap</* Caller = */ CanonicalDeclPtr<FunctionDecl>,
9778  /* Callees = */ llvm::MapVector<CanonicalDeclPtr<FunctionDecl>,
9779  SourceLocation>>
9781 
9782  /// Diagnostic builder for CUDA errors which may or may not be deferred.
9783  ///
9784  /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
9785  /// which are not allowed to appear inside __device__ functions and are
9786  /// allowed to appear in __host__ __device__ functions only if the host+device
9787  /// function is never codegen'ed.
9788  ///
9789  /// To handle this, we use the notion of "deferred diagnostics", where we
9790  /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
9791  ///
9792  /// This class lets you emit either a regular diagnostic, a deferred
9793  /// diagnostic, or no diagnostic at all, according to an argument you pass to
9794  /// its constructor, thus simplifying the process of creating these "maybe
9795  /// deferred" diagnostics.
9797  public:
9798  enum Kind {
9799  /// Emit no diagnostics.
9801  /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
9803  /// Emit the diagnostic immediately, and, if it's a warning or error, also
9804  /// emit a call stack showing how this function can be reached by an a
9805  /// priori known-emitted function.
9807  /// Create a deferred diagnostic, which is emitted only if the function
9808  /// it's attached to is codegen'ed. Also emit a call stack as with
9809  /// K_ImmediateWithCallStack.
9810  K_Deferred
9811  };
9812 
9813  CUDADiagBuilder(Kind K, SourceLocation Loc, unsigned DiagID,
9814  FunctionDecl *Fn, Sema &S);
9815  ~CUDADiagBuilder();
9816 
9817  /// Convertible to bool: True if we immediately emitted an error, false if
9818  /// we didn't emit an error or we created a deferred error.
9819  ///
9820  /// Example usage:
9821  ///
9822  /// if (CUDADiagBuilder(...) << foo << bar)
9823  /// return ExprError();
9824  ///
9825  /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
9826  /// want to use these instead of creating a CUDADiagBuilder yourself.
9827  operator bool() const { return ImmediateDiag.hasValue(); }
9828 
9829  template <typename T>
9831  const T &Value) {
9832  if (Diag.ImmediateDiag.hasValue())
9833  *Diag.ImmediateDiag << Value;
9834  else if (Diag.PartialDiag.hasValue())
9835  *Diag.PartialDiag << Value;
9836  return Diag;
9837  }
9838 
9839  private:
9840  Sema &S;
9841  SourceLocation Loc;
9842  unsigned DiagID;
9843  FunctionDecl *Fn;
9844  bool ShowCallStack;
9845 
9846  // Invariant: At most one of these Optionals has a value.
9847  // FIXME: Switch these to a Variant once that exists.
9850  };
9851 
9852  /// Creates a CUDADiagBuilder that emits the diagnostic if the current context
9853  /// is "used as device code".
9854  ///
9855  /// - If CurContext is a __host__ function, does not emit any diagnostics.
9856  /// - If CurContext is a __device__ or __global__ function, emits the
9857  /// diagnostics immediately.
9858  /// - If CurContext is a __host__ __device__ function and we are compiling for
9859  /// the device, creates a diagnostic which is emitted if and when we realize
9860  /// that the function will be codegen'ed.
9861  ///
9862  /// Example usage:
9863  ///
9864  /// // Variable-length arrays are not allowed in CUDA device code.
9865  /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
9866  /// return ExprError();
9867  /// // Otherwise, continue parsing as normal.
9868  CUDADiagBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID);
9869 
9870  /// Creates a CUDADiagBuilder that emits the diagnostic if the current context
9871  /// is "used as host code".
9872  ///
9873  /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
9874  CUDADiagBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID);
9875 
9882  };
9883 
9884  /// Determines whether the given function is a CUDA device/host/kernel/etc.
9885  /// function.
9886  ///
9887  /// Use this rather than examining the function's attributes yourself -- you
9888  /// will get it wrong. Returns CFT_Host if D is null.
9890  bool IgnoreImplicitHDAttr = false);
9892 
9893  /// Gets the CUDA target for the current context.
9895  return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
9896  }
9897 
9898  // CUDA function call preference. Must be ordered numerically from
9899  // worst to best.
9901  CFP_Never, // Invalid caller/callee combination.
9902  CFP_WrongSide, // Calls from host-device to host or device
9903  // function that do not match current compilation
9904  // mode.
9905  CFP_HostDevice, // Any calls to host/device functions.
9906  CFP_SameSide, // Calls from host-device to host or device
9907  // function matching current compilation mode.
9908  CFP_Native, // host-to-host or device-to-device calls.
9909  };
9910 
9911  /// Identifies relative preference of a given Caller/Callee
9912  /// combination, based on their host/device attributes.
9913  /// \param Caller function which needs address of \p Callee.
9914  /// nullptr in case of global context.
9915  /// \param Callee target function
9916  ///
9917  /// \returns preference value for particular Caller/Callee combination.
9919  const FunctionDecl *Callee);
9920 
9921  /// Determines whether Caller may invoke Callee, based on their CUDA
9922  /// host/device attributes. Returns false if the call is not allowed.
9923  ///
9924  /// Note: Will return true for CFP_WrongSide calls. These may appear in
9925  /// semantically correct CUDA programs, but only if they're never codegen'ed.
9926  bool IsAllowedCUDACall(const FunctionDecl *Caller,
9927  const FunctionDecl *Callee) {
9928  return IdentifyCUDAPreference(Caller, Callee) != CFP_Never;
9929  }
9930 
9931  /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
9932  /// depending on FD and the current compilation settings.
9934  const LookupResult &Previous);
9935 
9936 public:
9937  /// Check whether we're allowed to call Callee from the current context.
9938  ///
9939  /// - If the call is never allowed in a semantically-correct program
9940  /// (CFP_Never), emits an error and returns false.
9941  ///
9942  /// - If the call is allowed in semantically-correct programs, but only if
9943  /// it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
9944  /// be emitted if and when the caller is codegen'ed, and returns true.
9945  ///
9946  /// Will only create deferred diagnostics for a given SourceLocation once,
9947  /// so you can safely call this multiple times without generating duplicate
9948  /// deferred errors.
9949  ///
9950  /// - Otherwise, returns true without emitting any diagnostics.
9951  bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
9952 
9953  /// Set __device__ or __host__ __device__ attributes on the given lambda
9954  /// operator() method.
9955  ///
9956  /// CUDA lambdas declared inside __device__ or __global__ functions inherit
9957  /// the __device__ attribute. Similarly, lambdas inside __host__ __device__
9958  /// functions become __host__ __device__ themselves.
9959  void CUDASetLambdaAttrs(CXXMethodDecl *Method);
9960 
9961  /// Finds a function in \p Matches with highest calling priority
9962  /// from \p Caller context and erases all functions with lower
9963  /// calling priority.
9965  const FunctionDecl *Caller,
9966  SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
9967 
9968  /// Given a implicit special member, infer its CUDA target from the
9969  /// calls it needs to make to underlying base/field special members.
9970  /// \param ClassDecl the class for which the member is being created.
9971  /// \param CSM the kind of special member.
9972  /// \param MemberDecl the special member itself.
9973  /// \param ConstRHS true if this is a copy operation with a const object on
9974  /// its RHS.
9975  /// \param Diagnose true if this call should emit diagnostics.
9976  /// \return true if there was an error inferring.
9977  /// The result of this call is implicit CUDA target attribute(s) attached to
9978  /// the member declaration.
9980  CXXSpecialMember CSM,
9981  CXXMethodDecl *MemberDecl,
9982  bool ConstRHS,
9983  bool Diagnose);
9984 
9985  /// \return true if \p CD can be considered empty according to CUDA
9986  /// (E.2.3.1 in CUDA 7.5 Programming guide).
9989 
9990  /// Check whether NewFD is a valid overload for CUDA. Emits
9991  /// diagnostics and invalidates NewFD if not.
9993  const LookupResult &Previous);
9994  /// Copies target attributes from the template TD to the function FD.
9996 
9997  /// \name Code completion
9998  //@{
9999  /// \brief Describes the context in which code completion occurs.
10001  /// \brief Code completion occurs at top-level or namespace context.
10003  /// \brief Code completion occurs within a class, struct, or union.
10005  /// \brief Code completion occurs within an Objective-C interface, protocol,
10006  /// or category.
10008  /// \brief Code completion occurs within an Objective-C implementation or
10009  /// category implementation
10011  /// \brief Code completion occurs within the list of instance variables
10012  /// in an Objective-C interface, protocol, category, or implementation.
10014  /// \brief Code completion occurs following one or more template
10015  /// headers.
10017  /// \brief Code completion occurs following one or more template
10018  /// headers within a class.
10020  /// \brief Code completion occurs within an expression.
10022  /// \brief Code completion occurs within a statement, which may
10023  /// also be an expression or a declaration.
10025  /// \brief Code completion occurs at the beginning of the
10026  /// initialization statement (or expression) in a for loop.
10028  /// \brief Code completion occurs within the condition of an if,
10029  /// while, switch, or for statement.
10031  /// \brief Code completion occurs within the body of a function on a
10032  /// recovery path, where we do not have a specific handle on our position
10033  /// in the grammar.
10035  /// \brief Code completion occurs where only a type is permitted.
10037  /// \brief Code completion occurs in a parenthesized expression, which
10038  /// might also be a type cast.
10040  /// \brief Code completion occurs within a sequence of declaration
10041  /// specifiers within a function, method, or block.
10043  };
10044 
10047  ParserCompletionContext CompletionContext);
10048  void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
10049  bool AllowNonIdentifiers,
10050  bool AllowNestedNameSpecifiers);
10051 
10052  struct CodeCompleteExpressionData;
10054  const CodeCompleteExpressionData &Data);
10056  SourceLocation OpLoc, bool IsArrow,
10057  bool IsBaseExprStatement);
10059  void CodeCompleteTag(Scope *S, unsigned TagSpec);
10062  const VirtSpecifiers *VS = nullptr);
10064  void CodeCompleteCase(Scope *S);
10065  void CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args);
10067  ArrayRef<Expr *> Args);
10068  void CodeCompleteInitializer(Scope *S, Decl *D);
10069  void CodeCompleteReturn(Scope *S);
10070  void CodeCompleteAfterIf(Scope *S);
10071  void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS);
10072 
10074  bool EnteringContext);
10075  void CodeCompleteUsing(Scope *S);
10081  Decl *Constructor,
10082  ArrayRef<CXXCtorInitializer *> Initializers);
10083 
10085  bool AfterAmpersand);
10086 
10095  bool IsParameter);
10098  ArrayRef<IdentifierInfo *> SelIdents,
10099  bool AtArgumentExpression);
10101  ArrayRef<IdentifierInfo *> SelIdents,
10102  bool AtArgumentExpression,
10103  bool IsSuper = false);
10104  void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
10105  ArrayRef<IdentifierInfo *> SelIdents,
10106  bool AtArgumentExpression,
10107  ObjCInterfaceDecl *Super = nullptr);
10109  DeclGroupPtrTy IterationVar);
10111  ArrayRef<IdentifierInfo *> SelIdents);
10113  ArrayRef<IdentifierLocPair> Protocols);
10117  IdentifierInfo *ClassName,
10118  SourceLocation ClassNameLoc);
10121  IdentifierInfo *ClassName,
10122  SourceLocation ClassNameLoc);
10124  IdentifierInfo *ClassName,
10125  SourceLocation ClassNameLoc);
10128  IdentifierInfo *PropertyName);
10130  bool IsInstanceMethod,
10131  ParsedType ReturnType);
10133  bool IsInstanceMethod,
10134  bool AtParameterName,
10135  ParsedType ReturnType,
10136  ArrayRef<IdentifierInfo *> SelIdents);
10138  SourceLocation ClassNameLoc,
10139  bool IsBaseExprStatement);
10140  void CodeCompletePreprocessorDirective(bool InConditional);
10142  void CodeCompletePreprocessorMacroName(bool IsDefinition);
10145  IdentifierInfo *Macro,
10147  unsigned Argument);
10151  CodeCompletionTUInfo &CCTUInfo,
10153  //@}
10154 
10155  //===--------------------------------------------------------------------===//
10156  // Extra semantic analysis beyond the C type system
10157 
10158 public:
10160  unsigned ByteNo) const;
10161 
10162 private:
10163  void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
10164  const ArraySubscriptExpr *ASE=nullptr,
10165  bool AllowOnePastEnd=true, bool IndexNegated=false);
10166  void CheckArrayAccess(const Expr *E);
10167  // Used to grab the relevant information from a FormatAttr and a
10168  // FunctionDeclaration.
10169  struct FormatStringInfo {
10170  unsigned FormatIdx;
10171  unsigned FirstDataArg;
10172  bool HasVAListArg;
10173  };
10174 
10175  static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
10176  FormatStringInfo *FSI);
10177  bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
10178  const FunctionProtoType *Proto);
10179  bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
10180  ArrayRef<const Expr *> Args);
10181  bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
10182  const FunctionProtoType *Proto);
10183  bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
10184  void CheckConstructorCall(FunctionDecl *FDecl,
10185  ArrayRef<const Expr *> Args,
10186  const FunctionProtoType *Proto,
10187  SourceLocation Loc);
10188 
10189  void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
10190  const Expr *ThisArg, ArrayRef<const Expr *> Args,
10191  bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
10192  VariadicCallType CallType);
10193 
10194  bool CheckObjCString(Expr *Arg);
10195  ExprResult CheckOSLogFormatStringArg(Expr *Arg);
10196 
10197  ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
10198  unsigned BuiltinID, CallExpr *TheCall);
10199 
10200  bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
10201  unsigned MaxWidth);
10202  bool CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10203  bool CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10204 
10205  bool CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10206  bool CheckMipsBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10207  bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10208  bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
10209  bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
10210  bool CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10211  bool CheckPPCBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
10212 
10213  bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
10214  bool SemaBuiltinVAStartARM(CallExpr *Call);
10215  bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
10216  bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
10217  bool SemaBuiltinVSX(CallExpr *TheCall);
10218  bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
10219 
10220 public:
10221  // Used by C++ template instantiation.
10222  ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
10223  ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
10224  SourceLocation BuiltinLoc,
10225  SourceLocation RParenLoc);
10226 
10227 private:
10228  bool SemaBuiltinPrefetch(CallExpr *TheCall);
10229  bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
10230  bool SemaBuiltinAssume(CallExpr *TheCall);
10231  bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
10232  bool SemaBuiltinLongjmp(CallExpr *TheCall);
10233  bool SemaBuiltinSetjmp(CallExpr *TheCall);
10234  ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
10235  ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
10236  ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
10238  bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
10239  llvm::APSInt &Result);
10240  bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
10241  int Low, int High);
10242  bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
10243  unsigned Multiple);
10244  bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
10245  int ArgNum, unsigned ExpectedFieldNum,
10246  bool AllowName);
10247 public:
10259  };
10260  static FormatStringType GetFormatStringType(const FormatAttr *Format);
10261 
10262  bool FormatStringHasSArg(const StringLiteral *FExpr);
10263 
10264  static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
10265 
10266 private:
10267  bool CheckFormatArguments(const FormatAttr *Format,
10269  bool IsCXXMember,
10270  VariadicCallType CallType,
10271  SourceLocation Loc, SourceRange Range,
10272  llvm::SmallBitVector &CheckedVarArgs);
10273  bool CheckFormatArguments(ArrayRef<const Expr *> Args,
10274  bool HasVAListArg, unsigned format_idx,
10275  unsigned firstDataArg, FormatStringType Type,
10276  VariadicCallType CallType,
10277  SourceLocation Loc, SourceRange range,
10278  llvm::SmallBitVector &CheckedVarArgs);
10279 
10280  void CheckAbsoluteValueFunction(const CallExpr *Call,
10281  const FunctionDecl *FDecl);
10282 
10283  void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
10284 
10285  void CheckMemaccessArguments(const CallExpr *Call,
10286  unsigned BId,
10287  IdentifierInfo *FnName);
10288 
10289  void CheckStrlcpycatArguments(const CallExpr *Call,
10290  IdentifierInfo *FnName);
10291 
10292  void CheckStrncatArguments(const CallExpr *Call,
10293  IdentifierInfo *FnName);
10294 
10295  void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
10296  SourceLocation ReturnLoc,
10297  bool isObjCMethod = false,
10298  const AttrVec *Attrs = nullptr,
10299  const FunctionDecl *FD = nullptr);
10300 
10301  void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS);
10302  void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
10303  void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
10304  void CheckForIntOverflow(Expr *E);
10305  void CheckUnsequencedOperations(Expr *E);
10306 
10307  /// \brief Perform semantic checks on a completed expression. This will either
10308  /// be a full-expression or a default argument expression.
10309  void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
10310  bool IsConstexpr = false);
10311 
10312  void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
10313  Expr *Init);
10314 
10315  /// Check if there is a field shadowing.
10316  void CheckShadowInheritedFields(const SourceLocation &Loc,
10317  DeclarationName FieldName,
10318  const CXXRecordDecl *RD);
10319 
10320  /// \brief Check if the given expression contains 'break' or 'continue'
10321  /// statement that produces control flow different from GCC.
10322  void CheckBreakContinueBinding(Expr *E);
10323 
10324  /// \brief Check whether receiver is mutable ObjC container which
10325  /// attempts to add itself into the container
10326  void CheckObjCCircularContainer(ObjCMessageExpr *Message);
10327 
10328  void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
10329  void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
10330  bool DeleteWasArrayForm);
10331 public:
10332  /// \brief Register a magic integral constant to be used as a type tag.
10333  void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
10334  uint64_t MagicValue, QualType Type,
10335  bool LayoutCompatible, bool MustBeNull);
10336 
10337  struct TypeTagData {
10339 
10340  TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull) :
10341  Type(Type), LayoutCompatible(LayoutCompatible),
10342  MustBeNull(MustBeNull)
10343  {}
10344 
10346 
10347  /// If true, \c Type should be compared with other expression's types for
10348  /// layout-compatibility.
10349  unsigned LayoutCompatible : 1;
10350  unsigned MustBeNull : 1;
10351  };
10352 
10353  /// A pair of ArgumentKind identifier and magic value. This uniquely
10354  /// identifies the magic value.
10355  typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
10356 
10357 private:
10358  /// \brief A map from magic value to type information.
10359  std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
10360  TypeTagForDatatypeMagicValues;
10361 
10362  /// \brief Peform checks on a call of a function with argument_with_type_tag
10363  /// or pointer_with_type_tag attributes.
10364  void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
10365  const Expr * const *ExprArgs);
10366 
10367  /// \brief Check if we are taking the address of a packed field
10368  /// as this may be a problem if the pointer value is dereferenced.
10369  void CheckAddressOfPackedMember(Expr *rhs);
10370 
10371  /// \brief The parser's current scope.
10372  ///
10373  /// The parser maintains this state here.
10374  Scope *CurScope;
10375 
10376  mutable IdentifierInfo *Ident_super;
10377  mutable IdentifierInfo *Ident___float128;
10378 
10379  /// Nullability type specifiers.
10380  IdentifierInfo *Ident__Nonnull = nullptr;
10381  IdentifierInfo *Ident__Nullable = nullptr;
10382  IdentifierInfo *Ident__Null_unspecified = nullptr;
10383 
10384  IdentifierInfo *Ident_NSError = nullptr;
10385 
10386 protected:
10387  friend class Parser;
10389  friend class ASTReader;
10390  friend class ASTDeclReader;
10391  friend class ASTWriter;
10392 
10393 public:
10394  /// Retrieve the keyword associated
10396 
10397  /// The struct behind the CFErrorRef pointer.
10398  RecordDecl *CFError = nullptr;
10399 
10400  /// Retrieve the identifier "NSError".
10402 
10403  /// \brief Retrieve the parser's current scope.
10404  ///
10405  /// This routine must only be used when it is certain that semantic analysis
10406  /// and the parser are in precisely the same context, which is not the case
10407  /// when, e.g., we are performing any kind of template instantiation.
10408  /// Therefore, the only safe places to use this scope are in the parser
10409  /// itself and in routines directly invoked from the parser and *never* from
10410  /// template substitution or instantiation.
10411  Scope *getCurScope() const { return CurScope; }
10412 
10414  return CurScope->incrementMSManglingNumber();
10415  }
10416 
10419 
10420  Decl *getObjCDeclContext() const;
10421 
10424  }
10425 
10427  const DeclContext *DC = getCurLexicalContext();
10428  // A category implicitly has the attribute of the interface.
10429  if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
10430  DC = CatD->getClassInterface();
10431  return DC;
10432  }
10433 
10434  /// \brief To be used for checking whether the arguments being passed to
10435  /// function exceeds the number of parameters expected for it.
10436  static bool TooManyArguments(size_t NumParams, size_t NumArgs,
10437  bool PartialOverloading = false) {
10438  // We check whether we're just after a comma in code-completion.
10439  if (NumArgs > 0 && PartialOverloading)
10440  return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
10441  return NumArgs > NumParams;
10442  }
10443 
10444  // Emitting members of dllexported classes is delayed until the class
10445  // (including field initializers) is fully parsed.
10447 
10448 private:
10449  /// \brief Helper class that collects misaligned member designations and
10450  /// their location info for delayed diagnostics.
10451  struct MisalignedMember {
10452  Expr *E;
10453  RecordDecl *RD;
10454  ValueDecl *MD;
10455  CharUnits Alignment;
10456 
10457  MisalignedMember() : E(), RD(), MD(), Alignment() {}
10458  MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
10459  CharUnits Alignment)
10460  : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
10461  explicit MisalignedMember(Expr *E)
10462  : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
10463 
10464  bool operator==(const MisalignedMember &m) { return this->E == m.E; }
10465  };
10466  /// \brief Small set of gathered accesses to potentially misaligned members
10467  /// due to the packed attribute.
10468  SmallVector<MisalignedMember, 4> MisalignedMembers;
10469 
10470  /// \brief Adds an expression to the set of gathered misaligned members.
10471  void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
10472  CharUnits Alignment);
10473 
10474 public:
10475  /// \brief Diagnoses the current set of gathered accesses. This typically
10476  /// happens at full expression level. The set is cleared after emitting the
10477  /// diagnostics.
10479 
10480  /// \brief This function checks if the expression is in the sef of potentially
10481  /// misaligned members and it is converted to some pointer type T with lower
10482  /// or equal alignment requirements. If so it removes it. This is used when
10483  /// we do not want to diagnose such misaligned access (e.g. in conversions to
10484  /// void*).
10485  void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
10486 
10487  /// \brief This function calls Action when it determines that E designates a
10488  /// misaligned member due to the packed attribute. This is used to emit
10489  /// local diagnostics like in reference binding.
10491  Expr *E,
10492  llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
10493  Action);
10494 };
10495 
10496 /// \brief RAII object that enters a new expression evaluation context.
10498  Sema &Actions;
10499  bool Entered = true;
10500 
10501 public:
10502 
10505  Decl *LambdaContextDecl = nullptr,
10506  bool IsDecltype = false,
10507  bool ShouldEnter = true)
10508  : Actions(Actions), Entered(ShouldEnter) {
10509  if (Entered)
10510  Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
10511  IsDecltype);
10512  }
10516  bool IsDecltype = false)
10517  : Actions(Actions) {
10518  Actions.PushExpressionEvaluationContext(NewContext,
10520  IsDecltype);
10521  }
10522 
10523  enum InitListTag { InitList };
10525  bool ShouldEnter = true)
10526  : Actions(Actions), Entered(false) {
10527  // In C++11 onwards, narrowing checks are performed on the contents of
10528  // braced-init-lists, even when they occur within unevaluated operands.
10529  // Therefore we still need to instantiate constexpr functions used in such
10530  // a context.
10531  if (ShouldEnter && Actions.isUnevaluatedContext() &&
10532  Actions.getLangOpts().CPlusPlus11) {
10535  Entered = true;
10536  }
10537  }
10538 
10540  if (Entered)
10541  Actions.PopExpressionEvaluationContext();
10542  }
10543 };
10544 
10545 DeductionFailureInfo
10547  sema::TemplateDeductionInfo &Info);
10548 
10549 /// \brief Contains a late templated function.
10550 /// Will be parsed at the end of the translation unit, used by Sema & Parser.
10553  /// \brief The template function declaration to be late parsed.
10555 };
10556 
10557 } // end namespace clang
10558 
10559 namespace llvm {
10560 // Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
10561 // SourceLocation.
10562 template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
10565 
10567  return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
10568  }
10569 
10571  return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
10572  }
10573 
10574  static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
10575  return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
10576  FDL.Loc.getRawEncoding());
10577  }
10578 
10579  static bool isEqual(const FunctionDeclAndLoc &LHS,
10580  const FunctionDeclAndLoc &RHS) {
10581  return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
10582  }
10583 };
10584 } // namespace llvm
10585 
10586 #endif
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition: Sema.h:460
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
bool CheckNoCallerSavedRegsAttr(const AttributeList &attr)
Abstract class used to diagnose incomplete types.
Definition: Sema.h:1454
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
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)
NamespaceDecl * lookupStdExperimentalNamespace()
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid...
Definition: Sema.h:8329
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-...
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:14773
VariadicCallType
Definition: Sema.h:9186
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: Sema.h:830
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Definition: SemaDecl.cpp:2785
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:444
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:575
We are defining a synthesized function (such as a defaulted special member).
Definition: Sema.h:7044
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:14981
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary 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:1618
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1605
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
Definition: SemaDecl.cpp:6946
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
Definition: SemaType.cpp:5437
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:537
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
int Position
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchers.h:1510
A set of visible modules.
Definition: Module.h:548
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition: Sema.h:6422
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:222
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, TemplateIdAnnotation &TemplateId, AttributeList *Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition: Sema.h:525
CUDA Target attributes do not match.
Definition: Sema.h:6818
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:10411
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
Definition: SemaExpr.cpp:5951
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:7988
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...
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition: Sema.h:5247
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:14609
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition: Sema.h:7189
no exception specification
IdentifierInfo * getSuperIdentifier() const
Definition: Sema.cpp:1597
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:2354
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source. ...
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, llvm::MapVector< CanonicalDeclPtr< FunctionDecl >, SourceLocation > > CUDACallGraph
A partial call graph maintained during CUDA compilation to support deferred diagnostics.
Definition: Sema.h:9780
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false, bool ShouldEnter=true)
Definition: Sema.h:10503
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
Definition: SemaType.cpp:1981
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:9252
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:2062
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
Definition: SemaExpr.cpp:3166
A (possibly-)qualified type.
Definition: Type.h:616
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
ASTConsumer & Consumer
Definition: Sema.h:306
Keeps information about an identifier in a nested-name-spec.
Definition: Sema.h:5232
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:14684
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition: Sema.h:7456
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
Definition: SemaDecl.cpp:1519
Simple class containing the result of Sema::CorrectTypo.
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType)
Definition: SemaExpr.cpp:10417
TemplateDeductionResult
Describes the result of template argument deduction.
Definition: Sema.h:6772
LateTemplateParserCB * LateTemplateParser
Definition: Sema.h:609
bool isInvalid() const
Definition: Ownership.h:159
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:205
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:994
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
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:16396
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition: Sema.h:1339
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:1101
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:133
Instantiation or recovery rebuild of a for-range statement.
Definition: Sema.h:3698
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
DeclContext * getCurLexicalContext() const
Definition: Sema.h:10422
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:4020
NameClassification(const IdentifierInfo *Keyword)
Definition: Sema.h:1706
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:409
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:34
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:9130
LateParsedTemplateMapT LateParsedTemplateMap
Definition: Sema.h:604
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:202
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:621
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
Definition: SemaDecl.cpp:5654
FormatStringType
Definition: Sema.h:10248
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool ErrorRecoveryLookup=false, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
Definition: SemaExpr.cpp:7078
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
CorrectTypoKind
Definition: Sema.h:3150
static bool getPrintable(bool B)
Definition: Sema.h:1463
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:3656
bool operator==(CanQual< T > x, CanQual< U > y)
DeclContext * getFunctionLevelDeclContext()
Definition: Sema.cpp:1017
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
Definition: SemaExpr.cpp:3128
Code completion occurs within a class, struct, or union.
Definition: Sema.h:10004
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c.h:60
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:7631
Template argument deduction was successful.
Definition: Sema.h:6774
RecordDecl * MSVCGuidDecl
The MSVC "_GUID" struct, which is defined in MSVC header files.
Definition: Sema.h:809
OpenCL supported extensions and optional core features.
Definition: OpenCLOptions.h:23
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:441
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:2954
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition: Sema.h:553
A class which encapsulates the logic for delaying diagnostics during parsing and other processing...
Definition: Sema.h:632
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
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:2051
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:326
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
Definition: SemaExpr.cpp:6124
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:775
const LangOptions & getLangOpts() const
Definition: Sema.h:1166
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition: SemaCUDA.cpp:781
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Definition: Sema.h:9802
void CheckCompleteVariableDeclaration(VarDecl *VD)
Definition: SemaDecl.cpp:11004
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition: Sema.cpp:534
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
static ConditionResult ConditionError()
Definition: Sema.h:9639
Checking non-dependent argument conversions failed.
Definition: Sema.h:6814
An initializer.
Definition: Sema.h:6457
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:8033
Look up the name of an Objective-C protocol.
Definition: Sema.h:2988
Decl * Entity
The entity that is being synthesized.
Definition: Sema.h:7054
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition: Sema.h:4976
OpenCLOptions OpenCLFeatures
Definition: Sema.h:300
Stmt - This represents one statement.
Definition: Stmt.h:60
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:281
We are matching the template parameter lists of two templates that might be redeclarations.
Definition: Sema.h:6314
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:2923
FullExprArg MakeFullExpr(Expr *Arg)
Definition: Sema.h:3588
Provides information about an attempted template argument deduction, whose success or failure was des...
ImplicitExceptionSpecification ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defautled copy assignment operator of a class will h...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition: Sema.h:2368
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:6475
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)
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2554
LazyVector< CXXConstructorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition: Sema.h:579
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
StmtResult ActOnExprStmt(ExprResult Arg)
Definition: SemaStmt.cpp:44
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4091
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:2770
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class...
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:11586
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
Definition: SemaDecl.cpp:11582
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:1831
ActionResult< Expr * > ExprResult
Definition: Ownership.h:252
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed...
Definition: SemaExpr.cpp:4566
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:724
ObjCSubscriptKind
Definition: Sema.h:2637
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
Definition: SemaExpr.cpp:7940
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Stmt *InitStmt, ConditionResult Cond)
Definition: SemaStmt.cpp:672
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:3007
llvm::StringRef StackSlotLabel
Definition: Sema.h:381
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition: Sema.h:334
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
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:3177
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:12222
void setCurrentOpenCLExtension(llvm::StringRef Ext)
Definition: Sema.h:8415
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:338
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.
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition: Sema.h:6841
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Definition: Sema.h:1243
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:8419
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:6134
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
Definition: SemaExpr.cpp:12455
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:81
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
void incrementMSManglingNumber() const
Definition: Sema.h:10413
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:4775
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:778
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:7452
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispAttr::Mode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:232
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, 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...
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition: Sema.h:9246
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2655
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
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:5587
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
Microsoft __if_exists.
Definition: Sema.h:6472
PragmaOptionsAlignKind
Definition: Sema.h:8163
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.
Defines the C++ template declaration subclasses.
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:784
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4206
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:321
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:716
friend const CUDADiagBuilder & operator<<(const CUDADiagBuilder &Diag, const T &Value)
Definition: Sema.h:9830
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1662
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition: Sema.h:7102
The size of a bit-field.
Definition: Sema.h:6436
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
Definition: SemaType.cpp:2022
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:3770
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
Definition: SemaInit.cpp:8265
TypePropertyCache< Private > Cache
Definition: Type.cpp:3326
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
Definition: DeclBase.h:745
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:15469
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Evaluate the implicit exception specification for a defaulted special member function.
void CodeCompleteNaturalLanguage()
PtrTy get() const
Definition: Ownership.h:163
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:4312
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation. ...
Definition: Sema.h:7113
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
Definition: SemaExpr.cpp:12703
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition: Sema.h:7392
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, AttributeList *attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
The base class of the type hierarchy.
Definition: Type.h:1303
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:7499
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: Sema.h:3525
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.
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition: Sema.h:603
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:9045
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:8779
MissingImportKind
Kinds of missing import.
Definition: Sema.h:2067
std::unique_ptr< llvm::MemoryBuffer > Buffer
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1205
Declaration of a variable template.
ForRangeStatus
Definition: Sema.h:2854
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition: Sema.h:6046
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:461
Template argument deduction produced inconsistent deduced values for the given template parameter...
Definition: Sema.h:6785
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Sema.h:2999
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:45
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:3537
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST...
Definition: Sema.h:9310
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:94
void ActOnExitFunctionContext()
Definition: SemaDecl.cpp:1312
LazyVector< const DeclaratorDecl *, ExternalSemaSource,&ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition: Sema.h:571
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:1467
Wrapper for void* pointer.
Definition: Ownership.h:45
Parser - This implements a parser for the C family of languages.
Definition: Parser.h:57
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition: Sema.h:2970
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:7448
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:203
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
Definition: SemaStmt.cpp:2782
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:264
IdentifierInfo * getFloat128Identifier() const
Definition: Sema.cpp:1603
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Definition: SemaExpr.cpp:9945
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
We are instantiating a default argument for a template parameter.
Definition: Sema.h:7008
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition: Sema.h:669
ArrayRef< TemplateArgument > template_arguments() const
Definition: Sema.h:7075
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
void PopDeclContext()
Definition: SemaDecl.cpp:1218
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target update'.
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
Abstract base class used for diagnosing integer constant expression violations.
Definition: Sema.h:9697
FileNullability Nullability
Definition: Sema.h:247
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:3009
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition: Sema.cpp:608
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted, bool UpdateArgsWithConversions=true)
Check that the given template arguments can be be provided to the given template, converting the argu...
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2329
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3946
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:115
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
Definition: SemaCUDA.cpp:486
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
Definition: SemaExpr.cpp:4462
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:1031
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore, should not be counted as part of the instantiation depth.
Definition: Sema.h:7143
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:13482
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.
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
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:7450
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
Definition: SemaExpr.cpp:12818
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:3701
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:6153
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)
bool PopForceCUDAHostDevice()
Decrements our count of the number of times we've seen a pragma forcing functions to be host device...
Definition: SemaCUDA.cpp:32
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
VerifyICEDiagnoser(bool Suppress=false)
Definition: Sema.h:9701
RAII object to handle the state changes required to synthesize a function body.
Definition: Sema.h:718
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
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:2974
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: Lookup.h:744
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition: Sema.h:7423
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:12193
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:82
void ActOnFinishCXXNonNestedClass(Decl *D)
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
Definition: SemaStmt.cpp:1269
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:5099
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
Definition: SemaExpr.cpp:5863
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition: Sema.cpp:49
void ActOnObjCReenterContainerContext(DeclContext *DC)
Definition: SemaDecl.cpp:14188
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
Definition: SemaExpr.cpp:2641
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:10497
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:758
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Definition: SemaInternal.h:25
ImplicitExceptionSpecification ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move constructor of a class will have...
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:1893
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:4390
std::pair< CXXRecordDecl *, CXXSpecialMember > SpecialMemberDecl
Definition: Sema.h:1113
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition: Sema.h:495
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1733
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaStmt.cpp:3553
DiagnosticsEngine & Diags
Definition: Sema.h:307
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition: Sema.h:2664
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
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)
Determine whether the given New declaration is an overload of the declarations in Old...
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition: Sema.h:1124
Records and restores the FP_CONTRACT state on entry/exit of compound statements.
Definition: Sema.h:1144
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
Definition: Type.h:3234
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:303
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:9900
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
Represents a variable template specialization, which refers to a variable template with a given set o...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
Definition: SemaDecl.cpp:1239
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition: Sema.h:10446
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:1495
void ActOnObjCTemporaryExitContainerContext(DeclContext *DC)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaDecl.cpp:14182
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition: Sema.h:4980
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition: Sema.h:1076
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
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:3014
PragmaClangSection PragmaClangBSSSection
Definition: Sema.h:363
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1490
void ActOnStartStmtExpr()
Definition: SemaExpr.cpp:12104
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:7533
void Clear() const
Clear out the current diagnostic.
Definition: Diagnostic.h:987
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:50
MangleNumberingContext & getMangleNumberingContext(ASTContext &Ctx)
Retrieve the mangling numbering context, used to consistently number constructs like lambdas for mang...
Definition: SemaLambda.cpp:353
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[]{return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
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
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition: Sema.h:6996
Code completion occurs within an Objective-C implementation or category implementation.
Definition: Sema.h:10010
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:839
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:8172
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: Sema.h:1100
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
Definition: SemaDecl.cpp:11629
bool IsDecltype
Whether we are in a decltype expression.
Definition: Sema.h:924
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement. ...
Definition: SemaStmt.cpp:2553
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition: Sema.h:5253
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input)
Definition: SemaExpr.cpp:12019
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
Definition: SemaDecl.cpp:273
static NameClassification NestedNameSpecifier()
Definition: Sema.h:1717
SourceLocation PragmaLocation
Definition: Sema.h:383
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:12257
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:14137
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition: Sema.h:2983
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:1434
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, bool KnownDependent, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
Definition: SemaLambda.cpp:246
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:1167
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: Sema.h:848
FPOptions & getFPOptions()
Definition: Sema.h:1168
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
FormatAttr * mergeFormatAttr(Decl *D, SourceRange Range, IdentifierInfo *Format, int FormatIdx, int FirstArg, unsigned AttrSpellingListIndex)
ImplicitExceptionSpecification ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted destructor of a class will have...
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition: Sema.h:7063
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
Definition: SemaDecl.cpp:4021
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:118
MethodMatchStrategy
Definition: Sema.h:3435
Information about a template-id annotation token.
static SourceRange getPrintable(TypeLoc TL)
Definition: Sema.h:1475
UuidAttr * mergeUuidAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex, StringRef Uuid)
void setMethod(CXXMethodDecl *MD)
Definition: Sema.h:1021
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:5110
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:14315
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)
Mark all of the declarations referenced within a particular AST node as referenced.
Definition: SemaExpr.cpp:14689
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)
void ActOnUninitializedDecl(Decl *dcl)
Definition: SemaDecl.cpp:10694
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS)
Create a binary operation that may resolve to an overloaded operator.
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement...
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:2403
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:11909
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.
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3354
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, AttributeList *AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
Definition: SemaExpr.cpp:6770
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition: Sema.h:7302
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.
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, 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...
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
Definition: SemaAttr.cpp:665
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:8040
An arbitrary expression.
Definition: Sema.h:6424
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6...
Definition: SemaExpr.cpp:667
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition: Sema.h:1234
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
Definition: SemaExpr.cpp:4049
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:2566
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:812
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:7419
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:1582
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition: Sema.cpp:1280
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition: Sema.h:3017
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension...
Definition: Sema.h:9256
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:4829
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition: Sema.h:647
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:5569
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:233
Step
Definition: OpenMPClause.h:137
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:3539
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition: Sema.h:4648
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier...
Definition: Sema.h:9306
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:2549
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition: Sema.cpp:1323
Value of a non-type template parameter.
Definition: Sema.h:2550
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
Represents a class type in Objective C.
Definition: Type.h:4969
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, bool IsDecltype)
Definition: Sema.h:960
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:128
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:1146
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:1750
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:14077
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
Definition: SemaDecl.cpp:12871
A C-style cast.
Definition: Sema.h:9126
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.
void CUDASetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
Definition: SemaCUDA.cpp:841
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, ParsedAttributes &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition: Sema.cpp:1284
void setCurrentOpenCLExtensionForType(QualType T)
Set current OpenCL extensions for a type which can only be used when these OpenCL extensions are enab...
Definition: Sema.cpp:1649
FileNullability & operator[](FileID file)
Definition: Sema.h:251
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:1537
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:12978
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:2366
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
AttributeList * Attribute
Definition: Sema.h:473
The current expression is potentially evaluated at run time, which means that code may be generated t...
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:7434
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)
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition: Sema.h:7438
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition: SemaDecl.cpp:54
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:15765
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: Sema.h:818
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaStmt.cpp:1756
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:95
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation, for substitutions of prior template arguments.
Definition: Sema.h:7059
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:726
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:281
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)
Code completion occurs following one or more template headers within a class.
Definition: Sema.h:10019
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
This is not an overload because the signature exactly matches an existing declaration.
Definition: Sema.h:2457
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition: Type.h:3150
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:27
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
Definition: SemaExpr.cpp:14923
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:10552
StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt *InitStmt, ConditionResult Cond, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:538
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaType.cpp:5485
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)
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6...
Definition: SemaType.cpp:7120
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
Definition: SemaDecl.cpp:15468
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:9274
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:3869
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
The fixed underlying type of an enumeration.
Definition: Sema.h:6442
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
Definition: SemaDecl.cpp:9549
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *P, TemplateDecl *AArg, SourceLocation Loc)
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3350
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible...
Definition: Sema.h:9494
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
LazyVector< VarDecl *, ExternalSemaSource,&ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition: Sema.h:564
FrontendAction * Action
Definition: Tooling.cpp:205
llvm::Optional< bool > getKnownValue() const
Definition: Sema.h:9633
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
Definition: SemaDecl.cpp:12813
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:2827
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...
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
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:15654
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, AttributeList *Attrs, SourceLocation EqualLoc, Expr *Val)
Definition: SemaDecl.cpp:15494
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
Definition: SemaCUDA.cpp:105
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition: SemaDecl.cpp:634
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:12592
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
bool isOpenCLDisabledDecl(Decl *FD)
Definition: Sema.cpp:1661
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:6634
The type of a non-type template parameter.
Definition: Sema.h:6463
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
Diagnostic builder for CUDA errors which may or may not be deferred.
Definition: Sema.h:9796
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 CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
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:416
void PopExpressionEvaluationContext()
Definition: SemaExpr.cpp:13343
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
OverloadKind
C++ Overloading.
Definition: Sema.h:2450
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:407
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:6116
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
Code completion occurs where only a type is permitted.
Definition: Sema.h:10036
Describes a module or submodule.
Definition: Module.h:57
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:1053
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures...
Definition: Sema.h:3543
void ActOnAbortSEHFinallyBlock()
Definition: SemaStmt.cpp:3921
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
Definition: DeclSpec.h:2427
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition: Sema.h:1004
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition: SemaExpr.cpp:91
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors...
Definition: Sema.h:5929
EnumDecl * getStdAlignValT() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:106
The type of an exception.
Definition: Sema.h:6466
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
Code completion occurs at top-level or namespace context.
Definition: Sema.h:10002
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Definition: SemaStmt.cpp:3943
A pair of a canonical FunctionDecl and a SourceLocation.
Definition: Sema.h:9751
We are instantiating the exception specification for a function template which was deferred until it ...
Definition: Sema.h:7037
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Definition: SemaDecl.cpp:11544
SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition: Sema.h:1201
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
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:7426
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:3183
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition: Sema.h:10034
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:4894
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:6525
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
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:12584
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
Definition: SemaExpr.cpp:1304
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized...
Definition: Sema.h:1128
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:3773
BinaryOperatorKind
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:899
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:1585
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:1165
Look up implicit 'self' parameter of an objective-c method.
Definition: Sema.h:2990
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:347
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:40
Represents the results of name lookup.
Definition: Lookup.h:32
bool IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level)
Return true if the provided declaration VD should be captured by reference.
Definition: SemaOpenMP.cpp:948
static const std::string & getPrintable(const std::string &S)
Definition: Sema.h:1466
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition: SemaExpr.cpp:645
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:2562
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...
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition: Sema.h:7401
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
Definition: SemaDecl.cpp:3949
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:6108
MinSizeAttr * mergeMinSizeAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:919
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, bool IsTemplateParamOrArg, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
Definition: SemaDecl.cpp:13141
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
Definition: SemaExpr.cpp:12427
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition: Sema.cpp:1042
void ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
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:524
void ActOnStartSEHFinallyBlock()
Definition: SemaStmt.cpp:3917
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:865
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:1849
uint32_t Offset
Definition: CacheTokens.cpp:43
void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope)
Introduce the lambda parameters into scope.
Definition: SemaLambda.cpp:482
Module * getOwningModule(Decl *Entity)
Get the module owning an entity.
Definition: Sema.h:1522
bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T)
Check if type T corresponding to declaration specifier DS is disabled due to required OpenCL extensio...
Definition: Sema.cpp:1691
bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
Definition: SemaDecl.cpp:14091
bool isObjCMethodDecl(Decl *D)
Definition: Sema.h:1970
Ref_Compatible - The two types are reference-compatible.
Definition: Sema.h:9500
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation Loc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:2777
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition: Sema.h:2613
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:10016
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:6427
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 ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
Definition: SemaDecl.cpp:10652
Look up all declarations in a scope with the given name, including resolved using declarations...
Definition: Sema.h:2978
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
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:7386
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:10021
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)
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
PragmaStack(const ValueType &Default)
Definition: Sema.h:416
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition: Sema.h:544
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
Definition: SemaDecl.cpp:14101
ObjCContainerKind
Definition: Sema.h:7745
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...
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
Definition: SemaStmt.cpp:3967
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition: Sema.h:3025
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:147
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
Definition: SemaExpr.cpp:14601
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:7118
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:5127
bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: Sema.h:1096
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2642
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:6793
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced...
Definition: Sema.h:7151
A set of unresolved declarations.
Definition: UnresolvedSet.h:56
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition: Sema.h:7051
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition: Sema.h:530
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:15673
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:2794
Look up the name of an OpenMP user-defined reduction operation.
Definition: Sema.h:2992
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition: Sema.h:6779
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition: Sema.h:6974
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:9122
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
EnterExpressionEvaluationContext(Sema &Actions, InitListTag, bool ShouldEnter=true)
Definition: Sema.h:10524
void ActOnPragmaAttributePop(SourceLocation PragmaLoc)
Called on well-formed '#pragma clang attribute pop'.
Definition: SemaAttr.cpp:562
std::pair< StringRef, QualType > CapturedParamNameType
Definition: Sema.h:3731
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition: Sema.h:3038
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
Definition: SemaStmt.cpp:2738
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:278
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition: Sema.h:791
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, std::vector< PartialDiagnosticAt > > CUDADeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition: Sema.h:9747
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:645
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:14348
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:346
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
Definition: SemaDecl.cpp:16200
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:6433
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:16001
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.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition: Sema.h:2129
bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
Definition: SemaCUDA.cpp:392
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5167
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:2226
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition: Sema.h:677
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:10206
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, bool UseGlobal, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete)
FindAllocationFunctions - Finds the overloads of operator new and delete that are appropriate for the...
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)
void ActOnPragmaFPContract(LangOptions::FPContractModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
Definition: SemaAttr.cpp:694
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:1707
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:698
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2701
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
Definition: SemaStmt.cpp:615
Optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
The current expression occurs within a discarded statement.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1985
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:7188
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:5864
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:89
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
Definition: SemaDecl.cpp:2012
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:217
void CheckVariableDeclarationType(VarDecl *NewVD)
Definition: SemaDecl.cpp:7221
Preprocessor & PP
Definition: Sema.h:304
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: Sema.h:815
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:633
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3194
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
Definition: SemaStmt.cpp:3925
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
Definition: SemaStmt.cpp:3932
LambdaCaptureInitKind
Definition: DeclSpec.h:2477
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
Definition: SemaExpr.cpp:7789
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition: Sema.h:7437
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:9696
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
Definition: SemaDecl.cpp:12277
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:3726
Represents an ObjC class declaration.
Definition: DeclObjC.h:1108
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
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.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition: SemaDecl.cpp:650
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition: Sema.h:938
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:5636
Member name lookup, which finds the names of class/struct/union members.
Definition: Sema.h:2962
We are matching the template parameter lists of a template template argument against the template par...
Definition: Sema.h:6335
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:2231
detail::InMemoryDirectory::const_iterator I
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition: Sema.h:9270
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Definition: SemaExpr.cpp:2721
NamespaceDecl * StdExperimentalNamespaceCache
The C++ "std::experimental" namespace, where the experimental parts of the standard library resides...
Definition: Sema.h:799
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared...
Definition: Sema.h:766
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...
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
void PushCompoundScope()
Definition: Sema.cpp:1267
FullExprArg(Sema &actions)
Definition: Sema.h:3566
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
Definition: SemaExpr.cpp:15473
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:836
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:3590
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:14562
OMPClause * ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
const LangOptions & LangOpts
Definition: Sema.h:303
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location...
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:1721
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo)
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:7165
bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E)
Check if declaration D used by expression E is disabled due to required OpenCL extensions being disab...
Definition: Sema.cpp:1707
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition: Sema.h:3005
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:717
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition: Sema.h:232
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:55
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 ...
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition: Sema.h:1802
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
Definition: Sema.h:7357
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:12108
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void CodeCompleteAvailabilityPlatformName()
ParsingClassState PushParsingClass()
Definition: Sema.h:3875
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition: Sema.h:928
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition: Sema.h:545
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:7524
void PrintPragmaAttributeInstantiationPoint()
Definition: SemaAttr.cpp:602
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: Sema.h:3520
Code completion occurs within a sequence of declaration specifiers within a function, method, or block.
Definition: Sema.h:10042
bool CaptureHasSideEffects(const sema::LambdaScopeInfo::Capture &From)
Does copying/destroying the captured variable have side effects?
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
bool MSStructPragmaOn
Definition: Sema.h:327
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
CXXMethodDecl * getMethod() const
Definition: Sema.h:1020
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition: Sema.h:6324
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition: Sema.h:7366
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:7170
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)
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
Definition: SemaInit.cpp:6413
CXXSpecialMember
Kinds of C++ special members.
Definition: Sema.h:1103
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * >> &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
Definition: SemaCUDA.cpp:212
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...
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Definition: SemaType.cpp:2454
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:1458
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:2021
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:4402
We are substituting explicit template arguments provided for a function template. ...
Definition: Sema.h:7017
IdentifierInfo * IdentInfo
Definition: Sema.h:4356
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:269
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:1404
Merge availability attributes for an implementation of a protocol requirement.
Definition: Sema.h:2371
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:953
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:874
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:813
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3129
A functional-style cast.
Definition: Sema.h:9128
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:954
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:14636
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition: Sema.h:567
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:1626
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: Sema.h:8153
llvm::DenseMap< Selector, GlobalMethods > GlobalMethodPool
Definition: Sema.h:1088
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:11239
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
Definition: Sema.h:10579
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:7082
Retains information about a captured region.
Definition: ScopeInfo.h:696
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: Sema.h:3338
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:3613
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:601
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:5794
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:636
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
CastKind
CastKind - The kind of operation required for a conversion.
bool hasMergedDefinitionInCurrentModule(NamedDecl *Def)
The return type of classify().
Definition: Expr.h:300
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
Definition: SemaStmt.cpp:3302
NameClassificationKind getKind() const
Definition: Sema.h:1739
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:951
Template argument deduction did not deduce a value for every template parameter.
Definition: Sema.h:6782
static FunctionDeclAndLoc getTombstoneKey()
Definition: Sema.h:10570
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:8701
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:9260
void PopCompoundScope()
Definition: Sema.cpp:1271
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...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition: Sema.h:1038
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)
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:2503
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:2874
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
Definition: SemaLambda.cpp:478
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.
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
Definition: SemaDecl.cpp:9185
void ActOnFinishOfCompoundStmt()
Definition: SemaStmt.cpp:330
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack...
Definition: Sema.h:481
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition: Sema.h:6306
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:627
We are instantiating a template declaration.
Definition: Sema.h:7001
SourceLocation NameLoc
Definition: Sema.h:7981
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:490
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:1297
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:3036
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:3548
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:10002
SmallVector< PragmaAttributeEntry, 2 > PragmaAttributeStack
Definition: Sema.h:477
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:1026
llvm::SpecificBumpPtrAllocator< StateNode > Allocator
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
Definition: SemaExpr.cpp:5496
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition...
Definition: SemaExpr.cpp:14865
int * Depth
SourceLocation IdentifierLoc
The location of the identifier.
Definition: Sema.h:5241
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:11660
Allows QualTypes to be sorted and hence used in maps and sets.
NameClassification(ParsedType Type)
Definition: Sema.h:1704
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:669
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:663
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCUDACall has emitted a (maybe deferred) "bad call" d...
Definition: Sema.h:9759
void Act(SourceLocation PragmaLocation, PragmaClangSectionAction Action, StringLiteral *Name)
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3070
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3557
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...
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:580
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:5289
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:1771
Emit no diagnostics.
Definition: Sema.h:9800
Defines the clang::LangOptions interface.
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts)
Set OpenCL extensions for a declaration which can only be used when these OpenCL extensions are enabl...
Definition: Sema.cpp:1640
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
LookupNameKind
Describes the kind of name lookup to perform.
Definition: Sema.h:2950
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:3976
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:777
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void PushForceCUDAHostDevice()
Increments our count of the number of times we've seen a pragma forcing functions to be host device...
Definition: SemaCUDA.cpp:27
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition: Sema.h:653
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:103
DLLImportAttr * mergeDLLImportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
TemplateNameKind getTemplateNameKind() const
Definition: Sema.h:1757
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast...
std::string Label
ModuleDeclKind
Definition: Sema.h:2024
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:4622
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:712
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:6806
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition: Sema.h:557
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
StateNode * Previous
Declaration of a template type parameter.
The message is an instance message.
Definition: Sema.h:8037
void CodeCompleteObjCPropertyDefinition(Scope *S)
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
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 makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location...
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:352
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition: SemaStmt.cpp:452
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:127
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:1528
We are substituting template argument determined as part of template argument deduction for either a ...
Definition: Sema.h:7024
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:4503
TypeResult ActOnTypeName(Scope *S, Declarator &D)
Definition: SemaType.cpp:5456
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
Definition: SemaDecl.cpp:7050
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:4820
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2551
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition: Sema.h:787
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
Definition: SemaDecl.cpp:16047
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
QualType BuildAtomicType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:7666
llvm::SmallSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition: Sema.h:1118
Code completion occurs within an Objective-C interface, protocol, or category.
Definition: Sema.h:10007
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition: Sema.h:7134
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure...
Definition: SemaDecl.cpp:4776
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:2846
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:13138
IncompatibleVectors - The assignment is between two vector types that have the same size...
Definition: Sema.h:9289
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition: Sema.h:760
void completeExprArrayBound(Expr *E)
Definition: SemaType.cpp:7009
#define bool
Definition: stdbool.h:31
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)
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition: Sema.h:9449
void PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, const BlockExpr *blkExpr=nullptr)
Definition: Sema.cpp:1248
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:442
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:4668
SourceLocation LocStart
Definition: Sema.h:4353
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition: SemaCast.cpp:240
Initial building of a for-range statement.
Definition: Sema.h:3695
SourceLocation Begin
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:12890
When performing template argument deduction for a function template, there were too few call argument...
Definition: Sema.h:6809
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...
PragmaClangSectionAction
Definition: Sema.h:348
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.
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
Definition: SemaDecl.cpp:16345
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition: Sema.h:9279
void NoteAllFoundTemplates(TemplateName Name)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Definition: SemaExpr.cpp:15541
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition: Sema.h:9498
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:5694
void CodeCompletePreprocessorExpression()
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: Sema.h:821
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition: Sema.h:9491
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:443
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Definition: SemaType.cpp:7107
Block expression,.
Definition: Sema.h:6481
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:14305
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition: Sema.h:1531
void DiscardCleanupsInEvaluationContext()
Definition: SemaExpr.cpp:13409
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:10024
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:361
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...
std::unique_ptr< MangleNumberingContext > MangleNumbering
The context information used to mangle lambda expressions and block literals within this context...
Definition: Sema.h:950
bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
Definition: SemaCUDA.cpp:426
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:14433
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:337
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:209
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition: Sema.h:7649
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition: Sema.h:5676
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:3628
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:202
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition: Sema.h:921
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:10436
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition: Sema.h:516
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:225
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
Partial specialization.
Definition: Sema.h:6469
llvm::StringRef getCurrentOpenCLExtension() const
Definition: Sema.h:8412
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:1702
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition: SemaStmt.cpp:67
bool resolveAndFixAddressOfOnlyViableOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
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:240
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)
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
Definition: SemaDecl.cpp:7623
TypeSourceInfo * GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, TypeSourceInfo *ReturnTypeInfo)
Create and instantiate a TypeSourceInfo with type source information.
Definition: SemaType.cpp:5390
bool isExternallyVisible() const
Definition: Decl.h:338
ConditionKind
Definition: Sema.h:9641
unsigned Map[FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
Definition: AddressSpaces.h:53
TemplateNameKind ActOnDependentTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a dependent template name.
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...
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:7433
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition: Sema.h:5238
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:12383
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:1594
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
DiagnosticsEngine & getDiagnostics() const
Definition: Sema.h:1170
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:845
OMPClause * ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
void CleanupVarDeclMarking()
Definition: SemaExpr.cpp:14423
DeclContext * getContainingDC(DeclContext *DC)
Definition: SemaDecl.cpp:1175
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
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:7543
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:9900
void addContextNote(SourceLocation UseLoc)
Definition: Sema.h:735
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1344
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:628
Wraps an identifier and optional source location for the identifier.
Definition: AttributeList.h:73
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:4392
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition: Sema.h:474
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
Definition: Sema.h:6796
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2605
sema::LambdaScopeInfo * PushLambdaScope()
Definition: Sema.cpp:1233
The result type of a method or function.
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:10013
void CodeCompleteNamespaceDecl(Scope *S)
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
Definition: SemaType.cpp:7067
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
Definition: SemaExpr.cpp:5510
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:514
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
Definition: Specifiers.h:166
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
PragmaClangSectionKind
pragma clang section kind
Definition: Sema.h:340
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:4655
const SourceManager & SM
Definition: Format.cpp:1293
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
CXXMethodDecl * startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, ArrayRef< ParmVarDecl * > Params, bool IsConstexprSpecified)
Start the definition of a lambda expression.
Definition: SemaLambda.cpp:361
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:232
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition: Sema.h:229
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition: Sema.h:1056
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation. ...
OMPClause * ActOnOpenMPDeviceClause(Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
const TypoExprState & getTypoExprState(TypoExpr *TE) const
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition: Sema.h:2453
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:4940
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
ExprResult ActOnFinishFullExpr(Expr *Expr)
Definition: Sema.h:5184
bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body)
Check the body for the given constexpr function declaration only contains the permitted types of stat...
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, FunctionDeclAndLoc > CUDAKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Definition: Sema.h:9768
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
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:847
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, llvm::function_ref< ExprResult(Expr *)> Filter)
Definition: Sema.h:3208
CanonicalDeclPtr< FunctionDecl > FD
Definition: Sema.h:9752
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
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:1465
BuildForRangeKind
Definition: Sema.h:3693
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:583
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
Definition: SemaCast.cpp:2659
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
Definition: SemaExpr.cpp:3480
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:5828
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
A declaration qualifier.
Definition: Sema.h:6454
FieldDecl * buildInitCaptureField(sema::LambdaScopeInfo *LSI, VarDecl *Var)
Build the implicit field for an init-capture.
Definition: SemaLambda.cpp:796
void CodeCompleteTypeQualifiers(DeclSpec &DS)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition: Sema.h:10355
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:11981
const QualType * data() const
The set of exceptions in the exception specification.
Definition: Sema.h:4658
Decl * ActOnSkippedFunctionBody(Decl *Decl)
Definition: SemaDecl.cpp:12269
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
Definition: SemaDecl.cpp:11763
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:520
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:12606
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:621
bool hasVisibleDefinition(const NamedDecl *D)
Definition: Sema.h:1555
void ActOnStartOfCompoundStmt()
Definition: SemaStmt.cpp:326
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:235
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:463
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition: Sema.cpp:1228
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
Definition: SemaDecl.cpp:16205
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:1462
Represents a C++ Modules TS module export declaration.
Definition: Decl.h:3894
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition: Sema.h:1680
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)
const Decl * FoundDecl
void CodeCompleteObjCAtDirective(Scope *S)
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
We are declaring an implicit special member function.
Definition: Sema.h:7040
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
Definition: SemaDecl.cpp:11872
ARCConversionResult
Definition: Sema.h:9546
CXXSpecialMember SpecialMember
The special member being declared or defined.
Definition: Sema.h:7072
#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:2957
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition: Sema.h:806
Kind
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2467
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:387
PragmaSectionKind
Definition: Sema.h:8205
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Sema::ReuseLambdaContextDecl_t, bool IsDecltype=false)
Definition: Sema.h:10513
bool CheckCaseExpression(Expr *E)
Definition: SemaExpr.cpp:15644
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Definition: Ownership.h:145
OMPClause * ActOnOpenMPTaskReductionClause(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 'task_reduction' clause.
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:3220
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:2347
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4938
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:52
void DiagnoseMisalignedMembers()
Diagnoses the current set of gathered accesses.
Represents the parsed form of a C++ template argument.
A stack object to be created when performing template instantiation.
Definition: Sema.h:7202
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition: SemaStmt.cpp:444
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition: Sema.h:10340
void RefersToMemberWithReducedAlignment(Expr *E, llvm::function_ref< void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> Action)
This function calls Action when it determines that E designates a misaligned member due to the packed...
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition: Sema.h:795
The template argument was deduced from an array bound via template argument deduction.
Definition: Sema.h:6238
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:15736
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, AttributeList *AttrList, bool IsInstantiation)
Builds a using declaration.
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
Definition: SemaExpr.cpp:1330
This is not an overload because the lookup results contain a non-function.
Definition: Sema.h:2461
DeduceAutoResult
Result type of DeduceAutoType.
Definition: Sema.h:6900
Encodes a location in the source.
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
Definition: SemaExpr.cpp:5274
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:508
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: SemaAttr.cpp:242
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
Definition: SemaDecl.cpp:9716
void setCurrentOpenCLExtensionForDecl(Decl *FD)
Set current OpenCL extensions for a declaration which can only be used when these OpenCL extensions a...
Definition: Sema.cpp:1655
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:14148
Defines enumerations for expression traits intrinsics.
void DiagnoseAvailabilityOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false)
SourceLocation CurrentPragmaLocation
Definition: Sema.h:422
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:934
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
Definition: SemaExpr.cpp:5621
void DiagnoseUnusedLambdaCapture(const sema::LambdaScopeInfo::Capture &From)
Diagnose if an explicit lambda capture is unused.
ObjCPropertyQueryKind
Definition: DeclObjC.h:692
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
Definition: Sema.h:10574
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition: SemaExpr.cpp:766
static const char * getPrintable(const char *S)
Definition: Sema.h:1464
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:159
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:1191
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition: Sema.h:7082
DLLExportAttr * mergeDLLExportAttr(Decl *D, SourceRange Range, unsigned AttrSpellingListIndex)
bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
Definition: SemaExpr.cpp:12836
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
Definition: SemaDecl.cpp:11249
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function...
Definition: SemaDecl.cpp:12705
static SourceRange getPrintable(const Expr *E)
Definition: Sema.h:1474
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
Definition: SemaDecl.cpp:16382
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
Definition: SemaStmt.cpp:3283
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.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
void InstantiateStaticDataMemberDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given variable from its template.
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:467
const std::string ID
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition: Sema.h:6790
void ExitDeclaratorContext(Scope *S)
Definition: SemaDecl.cpp:1275
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2816
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:1742
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration...
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP target region.
Definition: Sema.h:8581
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
Definition: SemaInit.cpp:8342
ASTContext & getASTContext() const
Definition: Sema.h:1173
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:384
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:316
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:414
IncompatiblePointer - The assignment is between two pointers types that are not compatible, but we accept them as an extension.
Definition: Sema.h:9264
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
SynthesisKind
The kind of template instantiation we are performing.
Definition: Sema.h:6998
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3073
DelayedDiagnosticsState ProcessingContextState
Definition: Sema.h:628
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:943
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:120
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>. ...
Definition: Sema.h:803
ObjCSpecialMethodKind
Definition: Sema.h:7970
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1903
StmtResult ActOnCapturedRegionEnd(Stmt *S)
Definition: SemaStmt.cpp:4121
SourceLocation CCLoc
The location of the '::'.
Definition: Sema.h:5244
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition: Sema.h:644
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:13314
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
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:12233
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.
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
Definition: SemaDecl.cpp:3893
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: Sema.h:10398
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:7143
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:3186
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:217
ExprResult DefaultLvalueConversion(Expr *E)
Definition: SemaExpr.cpp:537
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:3564
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:7515
void DiagnoseUseOfUnimplementedSelectors()
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition: Sema.h:548
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition: Sema.h:7373
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
We are checking the validity of a default template argument that has been used when naming a template...
Definition: Sema.h:7033
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:6776
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: SemaStmt.cpp:3903
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
ASTConsumer & getASTConsumer() const
Definition: Sema.h:1174
static DeclarationName getPrintable(DeclarationName N)
Definition: Sema.h:1470
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:2189
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:33
OMPClause * ActOnOpenMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
The message is sent to 'super'.
Definition: Sema.h:8035
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:3458
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:5580
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition: Sema.h:311
CUDADiagBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a CUDADiagBuilder that emits the diagnostic if the current context is "used as host code"...
Definition: SemaCUDA.cpp:668
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
SourceLocation PragmaLocation
Definition: Sema.h:356
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:5946
Describes the kind of initialization being performed, along with location information for tokens rela...
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:435
A friend declaration.
Definition: Sema.h:6451
AbstractDiagSelID
Definition: Sema.h:5931
Look up any declaration with any name.
Definition: Sema.h:2994
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
Definition: SemaExpr.cpp:7737
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:1056
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
Definition: SemaType.cpp:1658
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:486
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
Definition: SemaType.cpp:1003
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition: SemaStmt.cpp:747
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:2435
bool FormatStringHasSArg(const StringLiteral *FExpr)
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition: Sema.h:314
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition: Sema.h:932
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:704
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition: Sema.h:613
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 isInvalid() const
Definition: Sema.h:9628
OpaquePtr< TemplateName > TemplateTy
Definition: Sema.h:297
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition: SemaAttr.cpp:129
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:9402
void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD, const FunctionProtoType *T)
Check whether the exception specification provided for an explicitly-defaulted special member matches...
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition: Sema.h:7105
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:281
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
Definition: SemaDecl.cpp:16319
void updateOutOfDateSelector(Selector Sel)
A default argument.
Definition: Sema.h:6460
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition: Sema.h:2665
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLoc, Expr *Length, SourceLocation RBLoc)
Definition: SemaExpr.cpp:4166
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:528
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:1733
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, AttributeList *AttrList)
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:1912
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:4399
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond, Stmt *Body)
Definition: SemaStmt.cpp:1247
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions...
Definition: SemaDecl.cpp:14798
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:11778
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition: Sema.h:492
sema::FunctionScopeInfo * getCurFunction() const
Definition: Sema.h:1293
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:1618
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
Definition: SemaDecl.cpp:11921
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition: Sema.h:7531
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:724
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition: Sema.cpp:714
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
Definition: SemaDecl.cpp:14832
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaStmt.cpp:3646
Constant expression in a noptr-new-declarator.
Definition: Sema.h:2551
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
Definition: SemaExpr.cpp:13417
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:298
ImplicitExceptionSpecification ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted copy constructor of a class will have...
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition: Sema.h:1059
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap< ValueDecl *, Expr * > &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement...
TentativeAnalysisScope(Sema &SemaRef)
Definition: Sema.h:7407
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
Definition: Sema.h:9894
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:12117
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:216
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition: Sema.h:724
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList)
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: Sema.h:824
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
getSpecialMember - get the special member enum for a method.
Definition: SemaDecl.cpp:2735
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:15449
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:6439
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts)
Set OpenCL extensions for a type which can only be used when these OpenCL extensions are enabled...
Definition: Sema.cpp:1630
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:5606
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:2548
ReuseLambdaContextDecl_t
Definition: Sema.h:3915
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: Lookup.h:771
OpaquePtr< QualType > TypeTy
Definition: Sema.h:298
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
Definition: SemaDecl.cpp:6924
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:16298
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:14614
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2682
Abstract interface for a consumer of code-completion information.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
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:1288
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:8280
ParserCompletionContext
Describes the context in which code completion occurs.
Definition: Sema.h:10000
ObjCDeclSpec DeclSpec
Definition: Sema.h:7985
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
Definition: SemaDecl.cpp:12949
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:1712
TagTypeKind
The kind of a tag type.
Definition: Type.h:4488
llvm::PointerUnion3< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
Definition: DeclTemplate.h:40
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:67
bool checkStringLiteralArgumentAttr(const AttributeList &Attr, unsigned ArgNum, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument ArgNum of Attr is a ASCII string literal.
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition: Sema.h:2561
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:7429
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition: Sema.h:610
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:958
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:3664
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:337
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:7159
Don't merge availability attributes at all.
Definition: Sema.h:2362
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: Sema.h:7069
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
Definition: SemaDecl.cpp:11750
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:1310
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:1215
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: Sema.h:827
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:12067
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:1992
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:2273
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
StringRef Name
Definition: USRFinder.cpp:123
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:378
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:2589
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:1246
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:623
QualType GetSignedVectorType(QualType V)
Definition: SemaExpr.cpp:9860
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:2126
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:401
We are instantiating a default argument for a function.
Definition: Sema.h:7013
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:1687
void ActOnCapturedRegionError()
Definition: SemaStmt.cpp:4105
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
void ProcessPragmaWeak(Scope *S, Decl *D)
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:1615
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:328
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
Definition: SemaExpr.cpp:9252
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition: Sema.cpp:385
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:12888
void CodeCompleteTag(Scope *S, unsigned TagSpec)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2594
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:1239
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types...
bool IsAllowedCUDACall(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition: Sema.h:9926
StmtResult ActOnExprStmtError()
Definition: SemaStmt.cpp:62
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=None)
Definition: SemaDecl.cpp:6148
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:16234
static NameClassification VarTemplate(TemplateName Name)
Definition: Sema.h:1727
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:5253
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Definition: SemaExpr.cpp:14794
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
Definition: SemaExpr.cpp:203
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.
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition: Sema.h:7644
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
Definition: SemaCast.cpp:1706
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
Definition: SemaType.cpp:1872
SectionAttr * mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name, unsigned AttrSpellingListIndex)
A decomposition declaration.
Definition: DeclCXX.h:3672
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition: Sema.h:7428
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:6803
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:861
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
Definition: SemaStmt.cpp:2747
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
Definition: SemaExpr.cpp:3573
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:537
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)
void AddNSConsumedAttr(SourceRange AttrRange, Decl *D, unsigned SpellingListIndex, bool isNSConsumed, bool isTemplateInstantiation)
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition: Sema.h:7087
Label name lookup.
Definition: Sema.h:2959
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
Definition: SemaDecl.cpp:3994
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:1559
PragmaClangSection PragmaClangRodataSection
Definition: Sema.h:365
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1211
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:5672
ExpressionEvaluationContext Context
The expression evaluation context.
Definition: Sema.h:918
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
Definition: SemaExpr.cpp:5883
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
Definition: SemaType.cpp:1969
EnumDecl - Represents an enum.
Definition: Decl.h:3102
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition: Sema.h:9297
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:3021
detail::InMemoryDirectory::const_iterator E
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition: Sema.h:7328
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 BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, UnresolvedLookupExpr *Lookup)
void ProcessDeclAttributeDelayed(Decl *D, const AttributeList *AttrList)
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:119
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:142
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition: SemaStmt.cpp:334
IdentifierResolver IdResolver
Definition: Sema.h:779
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:455
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:14111
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:3057
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)
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition: Sema.h:1017
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
Definition: SemaDecl.cpp:11805
Abstract interface for a module loader.
Definition: ModuleLoader.h:69
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in...
Definition: Sema.cpp:1049
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:14409
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition: Sema.h:692
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
Definition: SemaDecl.cpp:10239
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
Definition: SemaDecl.cpp:1155
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
Definition: SemaAttr.cpp:577
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:546
void DiagnoseUnterminatedPragmaAttribute()
Definition: SemaAttr.cpp:608
A dependently-generated diagnostic.
void checkCUDATargetOverload(FunctionDecl *NewFD, const LookupResult &Previous)
Check whether NewFD is a valid overload for CUDA.
Definition: SemaCUDA.cpp:857
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:368
Represents a pointer to an Objective C object.
Definition: Type.h:5220
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated", "unavailable", and "availability").
Definition: Sema.h:2360
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
Definition: SemaDecl.cpp:5604
PragmaClangSection PragmaClangDataSection
Definition: Sema.h:364
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition: Sema.h:607
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:134
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:34
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures...
Definition: Sema.h:3535
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaType.cpp:3226
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:1062
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
Definition: SemaStmt.cpp:3955
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...
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition: Sema.h:7109
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2448
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:3995
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:382
ExprResult getExpression() const
Definition: Sema.h:1746
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:3784
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition: Sema.h:325
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:428
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:811
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:225
SourceManager & getSourceManager() const
Definition: Sema.h:1171
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:3002
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
Definition: SemaDecl.cpp:14193
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition: Sema.h:6230
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:1176
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2118
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
Definition: Sema.h:2100
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition: Sema.h:6227
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:161
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:4660
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
ObjCLiteralKind
Definition: Sema.h:2646
ValueType CurrentValue
Definition: Sema.h:421
LocalInstantiationScope * Scope
Definition: Sema.h:7641
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:9293
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2105
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Definition: SemaExpr.cpp:13325
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:2264
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, 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...
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:5916
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:1409
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:1037
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
Definition: SemaDecl.cpp:15294
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
Module * getOwningModule() const
Get the module that owns this declaration.
Definition: DeclBase.h:737
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:1414
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.
void * OpaqueParser
Definition: Sema.h:611
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition: Sema.h:1068
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
Definition: SemaInit.cpp:6398
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:7615
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:985
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)
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, Optional< unsigned > DependentDeductionDepth=None)
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:11473
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 ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname...
Definition: SemaDecl.cpp:16357
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
Definition: SemaExpr.cpp:11792
static NameClassification Error()
Definition: Sema.h:1709
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:1751
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 CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement)
void ActOnCXXForRangeDecl(Decl *D)
Definition: SemaDecl.cpp:10931
OpenMPDefaultClauseKind
OpenMP attributes for 'default' clause.
Definition: OpenMPKinds.h:43
friend class ArgumentPackSubstitutionRAII
Definition: Sema.h:7180
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:4509
Deduction failed; that's all we know.
Definition: Sema.h:6816
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Definition: Sema.h:3201
static NameClassification Unknown()
Definition: Sema.h:1713
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: Sema.h:842
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:10974
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:500
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:16154
static SourceRange getPrintable(SourceLocation L)
Definition: Sema.h:1473
Represents a base class of a C++ class.
Definition: DeclCXX.h:158
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
Definition: SemaExpr.cpp:12364
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
const Expr * Replacement
Definition: AttributeList.h:59
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:2468
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition: Sema.h:7048
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init.list]p2.
void checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:443
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:315
Condition in a constexpr if statement.
Definition: Sema.h:2552
bool mightBeIntendedToBeTemplateName(ExprResult E)
Determine whether it's plausible that E was intended to be a template-name.
Definition: Sema.h:1815
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:3222
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
ProcessingContextState ParsingClassState
Definition: Sema.h:3874
PragmaClangSection PragmaClangTextSection
Definition: Sema.h:366
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression...
Definition: Sema.h:5235
void * SkippedDefinitionContext
Definition: Sema.h:2236
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:7929
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:2019
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
Definition: SemaDecl.cpp:5209
Describes whether we've seen any nullability information for the given file.
Definition: Sema.h:226
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:854
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
An implicit conversion.
Definition: Sema.h:9124
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
void ActOnTranslationUnitScope(Scope *S)
Definition: Sema.cpp:68
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition: Sema.cpp:1193
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Definition: SemaDecl.cpp:1800
A template argument list.
Definition: DeclTemplate.h:195
bool CheckRegparmAttr(const AttributeList &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
Definition: SemaCast.cpp:2685
Merge availability attributes for a redeclaration, which requires an exact match. ...
Definition: Sema.h:2365
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:2622
const DeclContext * getCurObjCLexicalContext() const
Definition: Sema.h:10426
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:3224
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:10080
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute...
Definition: SemaAttr.cpp:708
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:3906
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:7127
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
Definition: ASTMatchers.h:2063
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:3838
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
CCEKind
Contexts in which a converted constant expression is required.
Definition: Sema.h:2547
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition: SemaExpr.cpp:859
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: Sema.h:296
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:1639
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:2897
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their argum...
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
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:2378
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:3195
Data structure used to record current or nested expression evaluation contexts.
Definition: Sema.h:916
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:467
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:9967
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:10027
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
void LateTemplateParserCleanupCB(void *P)
Definition: Sema.h:608
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D...
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization)
Perform semantic checking of a new function declaration.
Definition: SemaDecl.cpp:9219
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes...
Definition: SemaStmt.cpp:2984
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'.
Represents a C++ struct/union/class.
Definition: DeclCXX.h:267
Compatible - the types are compatible according to the standard.
Definition: Sema.h:9248
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:10554
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:3663
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
CUDAFunctionTarget
Definition: Sema.h:9876
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:14212
StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
Look up a friend of a local class.
Definition: Sema.h:2986
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...
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void PopParsingClass(ParsingClassState state)
Definition: Sema.h:3878
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
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.
bool checkNullabilityTypeSpecifier(QualType &type, NullabilityKind nullability, SourceLocation nullabilityLoc, bool isContextSensitive, bool allowArrayTypes)
Check whether a nullability type specifier can be added to the given type.
Definition: SemaType.cpp:6056
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1866
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:331
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...
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:5855
TryCaptureKind
Definition: Sema.h:3950
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:14340
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: Sema.h:857
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:138
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
ImplicitExceptionSpecification ComputeInheritingCtorExceptionSpec(SourceLocation Loc, CXXConstructorDecl *CD)
Determine what sort of exception specification an inheriting constructor of a class will have...
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
Definition: SemaExpr.cpp:8396
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:317
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition: SemaExpr.cpp:180
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:237
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
Definition: SemaDecl.cpp:1746
Declaration of a class template.
ImplicitExceptionSpecification ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move assignment operator of a class will h...
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:615
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
The enumerator value.
Definition: Sema.h:6445
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:82
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
Definition: SemaType.cpp:3205
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)
After substituting deduced template arguments, an element of a dependent parameter type did not match...
Definition: Sema.h:6800
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant, according to C++ [class.virtual]p5.
ImplicitExceptionSpecification ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted default constructor of a class will have...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:245
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition: Sema.cpp:1404
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
Definition: SemaExpr.cpp:10551
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:1051
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all...
Definition: Sema.h:869
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:1506
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2206
void AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr, unsigned SpellingListIndex)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
Definition: SemaExpr.cpp:8177
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
Definition: SemaStmt.cpp:2720
void UpdateMarkingForLValueToRValue(Expr *E)
Definition: SemaExpr.cpp:14384
Represents a complete lambda introducer.
Definition: DeclSpec.h:2485
We are substituting prior template arguments into a new template parameter.
Definition: Sema.h:7029
a linked list of methods with the same selector name but different signatures.
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
Definition: Sema.h:1087
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
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:239
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:2493
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)
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
Definition: SemaStmt.cpp:3608
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:6448
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:363
void ActOnComment(SourceRange Comment)
Definition: Sema.cpp:1332
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
Designation - Represent a full designation, which is a sequence of designators.
Definition: Designator.h:181
void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization)
static OpaquePtr make(QualTypeP)
Definition: Ownership.h:54
FPOptions FPFeatures
Definition: Sema.h:301
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:3591
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:679
The name refers to a variable template whose specialization produces a variable.
Definition: TemplateKinds.h:33
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:953
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
void ActOnPragmaAttributePush(AttributeList &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Called on well-formed '#pragma clang attribute push'.
Definition: SemaAttr.cpp:456
static SourceRange getPrintable(SourceRange R)
Definition: Sema.h:1472
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition: Sema.h:10030
Lambda expression.
Definition: Sema.h:6478
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
Definition: SemaExpr.cpp:12710
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.
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:5579
void ActOnObjCContainerFinishDefinition()
Definition: SemaDecl.cpp:14177
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:5682
SourceManager & SourceMgr
Definition: Sema.h:308
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:1519
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:10551
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:1211
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
static int getPrintable(int I)
Definition: Sema.h:1461
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
Definition: SemaDecl.cpp:1225
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:439
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.
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Definition: Sema.h:9806
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3741
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
Definition: SemaDecl.cpp:16258
#define true
Definition: stdbool.h:32
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
Definition: SemaCUDA.cpp:896
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition: Sema.h:7298
A wrapper class around a pointer that always points to its canonical declaration. ...
Definition: Redeclarable.h:345
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:305
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:9302
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:371
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:14950
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:1609
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
Definition: SemaExpr.cpp:6025
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:6515
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:14823
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.
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition: Sema.cpp:1299
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:11693
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: Sema.h:833
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition: Sema.h:3594
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:548
Represents C++ using-directive.
Definition: DeclCXX.h:2758
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:589
The template argument was deduced via template argument deduction.
Definition: Sema.h:6234
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=false, ConversionSequenceList EarlyConversions=None)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition: Sema.h:2966
Describes an entity that is being initialized.
static QualType getPrintable(QualType T)
Definition: Sema.h:1471
Decl * getObjCDeclContext() const
Definition: SemaDecl.cpp:16415
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:66
ExprResult release()
Definition: Sema.h:3568
NamedDecl * Previous
Definition: Sema.h:1643
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
Definition: SemaDecl.cpp:3494
The type of an arbitrary declaration.
Definition: Sema.h:6430
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
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:2438
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:513
SourceLocation ColonLoc
Location of ':'.
Definition: OpenMPClause.h:90
SmallVector< Slot, 2 > Stack
Definition: Sema.h:419
brief A function argument from which we performed template argument
Definition: Sema.h:6840
ParsedType getType() const
Definition: Sema.h:1741
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:2396
The explicitly-specified template arguments were not valid template arguments for the given template...
Definition: Sema.h:6812
The lookup resulted in an error.
Definition: Sema.h:3011
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
Definition: SemaDecl.cpp:4823
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:599
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:1172
void PrintContextStack()
Definition: Sema.h:7332
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types...
Definition: Sema.h:9285
The symbol does not exist.
Definition: Sema.h:4395
Declaration of a template function.
Definition: DeclTemplate.h:939
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition: Sema.h:1042
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition: Sema.h:10039
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
CUDADiagBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a CUDADiagBuilder that emits the diagnostic if the current context is "used as device code"...
Definition: SemaCUDA.cpp:641
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:1212
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
void CodeCompleteObjCProtocolDecl(Scope *S)
The current expression occurs within a braced-init-list within an unevaluated operand.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
Definition: Expr.h:670
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:533
Attr - This represents one attribute.
Definition: Attr.h:43
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:7980
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:1224
This represents the stack of attributes that were pushed by #pragma clang attribute.
Definition: Sema.h:471
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2978
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Definition: SemaExpr.cpp:12073
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Definition: SemaType.cpp:4823
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:614
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
Definition: SemaExpr.cpp:10798
static const unsigned kMac68kAlignmentSentinel
Definition: Sema.h:438
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and...
Definition: SemaAttr.cpp:389
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:5428
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
Definition: SemaType.cpp:7530
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: SemaStmt.cpp:3867
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: Sema.h:851
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:12572
Helper class that creates diagnostics with optional template instantiation stacks.
Definition: Sema.h:1196
Decl * ActOnDeclarator(Scope *S, Declarator &D)
Definition: SemaDecl.cpp:5078
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:98
AttributeList - Represents a syntactic attribute.
Definition: AttributeList.h:95
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
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:1431
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition: Sema.h:1072
VarDecl * buildCoroutinePromise(SourceLocation Loc)
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:684
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:4574
ValueType DefaultValue
Definition: Sema.h:420
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
Definition: SemaDecl.cpp:1693
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).
Definition: Overload.h:141
SourceLocation CurInitSegLoc
Definition: Sema.h:464